Skip to content

Commit ffdcc50

Browse files
committed
fix: ...
1 parent 5fbd22d commit ffdcc50

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/rules/valid-initdata.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ module.exports = {
257257
const properties = node.arguments[0].properties
258258
if (!properties) return
259259
for (const element of properties) {
260-
if (element.key.name === 'initData') {
260+
if (element.key && element.key.name === 'initData') {
261261
hasInitData = 1
262262
}
263263
}
@@ -276,17 +276,17 @@ module.exports = {
276276
Array.isArray(node.properties)
277277
if (isinit) {
278278
for (const item of node.properties) {
279-
if (item.key.name === 'initData') {
279+
if (item.key && item.key.name === 'initData') {
280280
handleInitData(item.value.properties, propsSet)
281281
}
282282
}
283283
}
284284
},
285285
Property(node) {
286-
if (node.key.name === 'computed') {
286+
if (node.key && node.key.name === 'computed') {
287287
commonFunction(node.value, computedSet)
288288
}
289-
if (node.key.name === 'initData') {
289+
if (node.key && node.key.name === 'initData') {
290290
const isCreate =
291291
node.parent.parent.callee &&
292292
node.parent.parent.callee.name === 'createComponent'

0 commit comments

Comments
 (0)