Skip to content

Commit 9b55ed4

Browse files
authored
fix: cannot read property in time-picker rule (#93)
1 parent bffe10a commit 9b55ed4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

vue-transformations/element-ui/time-picker-format-attribute.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ function nodeFilter(node: Node): boolean {
2020
return (
2121
node.type === 'VAttribute' &&
2222
node.key.type === 'VDirectiveKey' &&
23-
node.key.name.name === 'bind' &&
23+
node.key.name?.name === 'bind' &&
2424
// @ts-ignore
25-
node.key.argument.name === 'picker-options' &&
25+
node.key.argument?.name === 'picker-options' &&
2626
node.value?.type === 'VExpressionContainer' &&
2727
node.value.expression?.type === 'ObjectExpression' &&
2828
// @ts-ignore
29-
node.value.expression.properties.filter(item => item.key.name === 'format')
29+
node.value.expression.properties?.filter(item => item.key.name === 'format')
3030
.length > 0 &&
31-
node.parent.parent.type === 'VElement' &&
32-
node.parent.parent.name === 'el-time-picker' &&
33-
node.parent.attributes.filter(pre).length === 0
31+
node.parent?.parent.type === 'VElement' &&
32+
node.parent.parent?.name === 'el-time-picker' &&
33+
node.parent.attributes?.filter(pre).length === 0
3434
)
3535
}
3636

0 commit comments

Comments
 (0)