Closed
Description
Tell us about your environment
- ESLint version: 5.12.0
- eslint-plugin-vue version: 5.2.2
- Node version: 10.15.0
Firstly, huge thanks for adding the no-restricted-syntax rule. It's proving very useful.
However, I'm having trouble with the following rule
CallExpression[callee.name=interpolate] > :nth-child(3)[value!=true])
This works fine on no-restricted-syntax
, but fails on vue/no-restriceted-syntax
.
To reproduce, add the following test case to the no-restricted-syntax test:
{
code: `
<template>
<input :value="interpolate(foo, bar, true)">
</template>`,
options: [
{
'selector': 'CallExpression > :nth-child(3)[value!=true]',
'message': 'Third argument of interpolate must be true'
}
]
}
What did you expect to happen?
Test would pass
What actually happened?
Test failed:
TypeError: Cannot read property 'length' of undefined
Occurred while linting <input>:1
at nthChild (node_modules/esquery/esquery.js:256:34)
at matches (node_modules/esquery/esquery.js:158:25)
at matches (node_modules/esquery/esquery.js:76:30)
at Function.matches (node_modules/esquery/esquery.js:103:25)
at NodeEventGenerator.applySelector (node_modules/vue-eslint-parser/index.js:3272:21)
at NodeEventGenerator.applySelectors (node_modules/vue-eslint-parser/index.js:3284:22)
at NodeEventGenerator.enterNode (node_modules/vue-eslint-parser/index.js:3295:14)
at traverse (node_modules/vue-eslint-parser/index.js:113:13)
at traverseNodes (node_modules/vue-eslint-parser/index.js:131:5)
at scriptVisitor.Program:exit.node (node_modules/vue-eslint-parser/index.js:3731:25)
Note that the test passes if the rule is changed to
CallExpression > Literal:nth-child(3)[value!=true]
Thanks again!
Metadata
Metadata
Assignees
Labels
No labels