@@ -14,7 +14,7 @@ const rule = {
14
14
return utils . executeOnVueComponent ( context , obj => {
15
15
context . report ( {
16
16
node : obj ,
17
- message : 'Internal test: component .'
17
+ message : 'Component detected .'
18
18
} )
19
19
} )
20
20
} ,
@@ -32,13 +32,13 @@ const parserOptions = {
32
32
33
33
function makeError ( line ) {
34
34
return {
35
- message : 'Internal test: component .' ,
35
+ message : 'Component detected .' ,
36
36
line,
37
37
type : 'ObjectExpression'
38
38
}
39
39
}
40
40
41
- function notFoundTests ( ext ) {
41
+ function validTests ( ext ) {
42
42
return [
43
43
{
44
44
filename : `test.${ ext } ` ,
@@ -100,15 +100,16 @@ function notFoundTests (ext) {
100
100
]
101
101
}
102
102
103
- function foundTests ( ext ) {
103
+ function invalidTests ( ext ) {
104
104
return [
105
105
{
106
106
filename : `test.${ ext } ` ,
107
- code : `// ${ ext }
107
+ code : `
108
108
Vue.component('async-example', function (resolve, reject) {
109
109
// @vue/component
110
110
resolve({})
111
- })` ,
111
+ })
112
+ // ${ ext } ` ,
112
113
parserOptions,
113
114
errors : [ makeError ( 4 ) ]
114
115
} ,
@@ -120,15 +121,16 @@ function foundTests (ext) {
120
121
} ,
121
122
{
122
123
filename : `test.${ ext } ` ,
123
- code : `// ${ ext }
124
+ code : `
124
125
// @vue/component
125
- export default { }` ,
126
+ export default { }
127
+ // ${ ext } ` ,
126
128
parserOptions,
127
129
errors : [ makeError ( 3 ) ]
128
130
} ,
129
131
{
130
132
filename : `test.${ ext } ` ,
131
- code : `// ${ ext }
133
+ code : `
132
134
/* @vue/component */
133
135
export default { }
134
136
// ${ ext } ` ,
@@ -239,7 +241,7 @@ ruleTester.run('vue-component', rule, {
239
241
code : `export default { }` ,
240
242
parserOptions
241
243
}
242
- ] . concat ( notFoundTests ( 'js' ) ) . concat ( notFoundTests ( 'jsx' ) ) . concat ( notFoundTests ( 'vue' ) ) ,
244
+ ] . concat ( validTests ( 'js' ) ) . concat ( validTests ( 'jsx' ) ) . concat ( validTests ( 'vue' ) ) ,
243
245
invalid : [
244
246
{
245
247
filename : 'test.vue' ,
@@ -253,5 +255,5 @@ ruleTester.run('vue-component', rule, {
253
255
parserOptions,
254
256
errors : [ makeError ( 1 ) ]
255
257
}
256
- ] . concat ( foundTests ( 'js' ) ) . concat ( foundTests ( 'jsx' ) ) . concat ( foundTests ( 'vue' ) )
258
+ ] . concat ( invalidTests ( 'js' ) ) . concat ( invalidTests ( 'jsx' ) ) . concat ( invalidTests ( 'vue' ) )
257
259
} )
0 commit comments