Skip to content

Commit 97a51b2

Browse files
mysticateamichalsnik
authored andcommitted
Chore: update vue-eslint-parser (#754)
* Chore: update vue-eslint-parser Fixes #716 Fiees #722 Fixes #733 As a side effect, it gets ignoring expressions on outside of the template. * Update tests cases
1 parent 9c49dcc commit 97a51b2

File tree

5 files changed

+62
-40
lines changed

5 files changed

+62
-40
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"eslint": "^5.0.0"
4747
},
4848
"dependencies": {
49-
"vue-eslint-parser": "^4.0.2"
49+
"vue-eslint-parser": "^5.0.0"
5050
},
5151
"devDependencies": {
5252
"@types/node": "^4.2.16",

tests/lib/rules/no-unused-vars.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ tester.run('no-unused-vars', rule, {
3636
code: '<template><ol v-for="i in data"><li v-for="f in i">{{ f.bar.baz }}</li></ol></template>'
3737
},
3838
{
39-
code: '<template scope="props">{{props}}</template>'
39+
code: '<template><template scope="props">{{props}}</template></template>'
4040
},
4141
{
42-
code: '<template scope="props"><span v-if="props"></span></template>'
42+
code: '<template><template scope="props"><span v-if="props"></span></template></template>'
4343
},
4444
{
4545
code: '<template><div v-for="(item, key) in items" :key="key">{{item.name}}</div></template>'
@@ -57,11 +57,19 @@ tester.run('no-unused-vars', rule, {
5757
errors: ["'i' is defined but never used."]
5858
},
5959
{
60-
code: '<template scope="props"></template>',
60+
code: '<template><template scope="props"></template></template>',
6161
errors: ["'props' is defined but never used."]
6262
},
6363
{
64-
code: '<template v-for="i in 5"><comp v-for="j in 10">{{i}}{{i}}</comp></template>',
64+
code: '<template><span slot-scope="props"></span></template>',
65+
errors: ["'props' is defined but never used."]
66+
},
67+
{
68+
code: '<template><span><template scope="props"></template></span></template>',
69+
errors: ["'props' is defined but never used."]
70+
},
71+
{
72+
code: '<template><div v-for="i in 5"><comp v-for="j in 10">{{i}}{{i}}</comp></div></template>',
6573
errors: ["'j' is defined but never used."]
6674
},
6775
{

tests/lib/rules/valid-v-else-if.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ tester.run('valid-v-else-if', rule, {
4343
invalid: [
4444
{
4545
filename: 'test.vue',
46-
code: '<template v-else-if="foo"><div></div></template>',
46+
code: '<template><template v-else-if="foo"><div></div></template></template>',
4747
errors: ["'v-else-if' directives require being preceded by the element which has a 'v-if' or 'v-else-if' directive."]
4848
},
4949
{

tests/lib/rules/valid-v-else.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ tester.run('valid-v-else', rule, {
4343
invalid: [
4444
{
4545
filename: 'test.vue',
46-
code: '<template v-else><div></div></template>',
46+
code: '<template><template v-else><div></div></template></template>',
4747
errors: ["'v-else' directives require being preceded by the element which has a 'v-if' or 'v-else' directive."]
4848
},
4949
{

tests/lib/rules/valid-v-for.js

+47-33
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ tester.run('valid-v-for', rule, {
7777
},
7878
{
7979
filename: 'test.vue',
80-
code: '<template v-for="x of list"><slot name="item" /></template>'
80+
code: '<template><template v-for="x of list"><slot name="item" /></template></template>'
8181
},
8282
{
8383
filename: 'test.vue',
84-
code: '<template v-for="x of list">foo<div></div></template>'
84+
code: '<template><template v-for="x of list">foo<div></div></template></template>'
8585
},
8686
{
8787
filename: 'test.vue',
@@ -90,24 +90,30 @@ tester.run('valid-v-for', rule, {
9090
{
9191
filename: 'test.vue',
9292
code: `
93-
<template v-for="x in xs">
94-
<template v-for="y in x.ys">
95-
<li v-for="z in y.zs" :key="z.id">
96-
123
97-
</li>
93+
<template>
94+
<template v-for="x in xs">
95+
<template v-for="y in x.ys">
96+
<li v-for="z in y.zs" :key="z.id">
97+
123
98+
</li>
99+
</template>
98100
</template>
99-
</template>`
101+
</template>
102+
`
100103
},
101104
{
102105
filename: 'test.vue',
103106
code: `
104-
<template v-for="x in xs">
105-
<template v-for="y in ys">
106-
<li v-for="z in zs" :key="x.id + y.id + z.id">
107-
123
108-
</li>
107+
<template>
108+
<template v-for="x in xs">
109+
<template v-for="y in ys">
110+
<li v-for="z in zs" :key="x.id + y.id + z.id">
111+
123
112+
</li>
113+
</template>
109114
</template>
110-
</template>`
115+
</template>
116+
`
111117
}
112118
],
113119
invalid: [
@@ -215,38 +221,46 @@ tester.run('valid-v-for', rule, {
215221
filename: 'test.vue',
216222
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
217223
code: `
218-
<template v-for="x in xs">
219-
<template v-for="y in a.ys">
220-
<li v-for="z in y.zs" :key="z.id">
221-
123
222-
</li>
224+
<template>
225+
<template v-for="x in xs">
226+
<template v-for="y in a.ys">
227+
<li v-for="z in y.zs" :key="z.id">
228+
123
229+
</li>
230+
</template>
223231
</template>
224-
</template>`
232+
</template>
233+
`
225234
},
226235
{
227236
filename: 'test.vue',
228237
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
229238
code: `
230-
<template v-for="x in xs">
231-
<template v-for="y in x.ys">
232-
<li v-for="z in a.zs" :key="z.id">
233-
123
234-
</li>
239+
<template>
240+
<template v-for="x in xs">
241+
<template v-for="y in x.ys">
242+
<li v-for="z in a.zs" :key="z.id">
243+
123
244+
</li>
245+
</template>
235246
</template>
236-
</template>`
247+
</template>
248+
`
237249
},
238250
{
239251
filename: 'test.vue',
240252
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."],
241253
code: `
242-
<template v-for="x in xs">
243-
<template v-for="y in x.ys">
244-
<li v-for="z in x.zs" :key="z.id">
245-
123
246-
</li>
254+
<template>
255+
<template v-for="x in xs">
256+
<template v-for="y in x.ys">
257+
<li v-for="z in x.zs" :key="z.id">
258+
123
259+
</li>
260+
</template>
247261
</template>
248-
</template>`
262+
</template>
263+
`
249264
}
250-
251265
]
252266
})

0 commit comments

Comments
 (0)