eslint-plugin-lube 0.4.3 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +126 -125
- package/package.json +39 -31
- package/rules/pretty-imports.js +15 -15
- package/rules/pretty-jsdoc-casting.js +37 -29
- package/rules/pretty-sequence.js +61 -52
- package/rules/svelte-naming-convention.js +19 -19
- package/test/pretty-imports/ExportNamedDeclaration.js +32 -24
- package/test/pretty-imports/ImportDeclaration.js +32 -24
- package/test/pretty-imports.js +3 -3
- package/test/pretty-jsdoc-casting/case_by_expression.js +73 -25
- package/test/pretty-jsdoc-casting/various_situations.js +31 -11
- package/test/pretty-jsdoc-casting.js +3 -3
- package/test/pretty-sequence/case_by_node_type.js +62 -30
- package/test/pretty-sequence/case_by_option.js +31 -15
- package/test/pretty-sequence/various_situations.js +34 -9
- package/test/pretty-sequence.js +3 -3
- package/test/svelte-naming-convention/basic_snake_case.js +21 -8
- package/test/svelte-naming-convention/case_by_identifier.js +761 -195
- package/test/svelte-naming-convention/snake_case_with_symbols.js +28 -7
- package/test/svelte-naming-convention.js +3 -3
- package/tsconfig.json +10 -2
- package/types/index.d.ts +15 -0
- package/types/index.d.ts.map +1 -0
- package/types/rules/pretty-imports.d.ts +3 -0
- package/types/rules/pretty-imports.d.ts.map +1 -0
- package/types/rules/pretty-jsdoc-casting.d.ts +3 -0
- package/types/rules/pretty-jsdoc-casting.d.ts.map +1 -0
- package/types/rules/pretty-sequence.d.ts +3 -0
- package/types/rules/pretty-sequence.d.ts.map +1 -0
- package/types/rules/svelte-naming-convention.d.ts +3 -0
- package/types/rules/svelte-naming-convention.d.ts.map +1 -0
- package/types/test/pretty-imports/ExportNamedDeclaration.d.ts +2 -0
- package/types/test/pretty-imports/ExportNamedDeclaration.d.ts.map +1 -0
- package/types/test/pretty-imports/ImportDeclaration.d.ts +2 -0
- package/types/test/pretty-imports/ImportDeclaration.d.ts.map +1 -0
- package/types/test/pretty-imports.d.ts +2 -0
- package/types/test/pretty-imports.d.ts.map +1 -0
- package/types/test/pretty-jsdoc-casting/case_by_expression.d.ts +2 -0
- package/types/test/pretty-jsdoc-casting/case_by_expression.d.ts.map +1 -0
- package/types/test/pretty-jsdoc-casting/various_situations.d.ts +2 -0
- package/types/test/pretty-jsdoc-casting/various_situations.d.ts.map +1 -0
- package/types/test/pretty-jsdoc-casting.d.ts +2 -0
- package/types/test/pretty-jsdoc-casting.d.ts.map +1 -0
- package/types/test/pretty-sequence/case_by_node_type.d.ts +2 -0
- package/types/test/pretty-sequence/case_by_node_type.d.ts.map +1 -0
- package/types/test/pretty-sequence/case_by_option.d.ts +2 -0
- package/types/test/pretty-sequence/case_by_option.d.ts.map +1 -0
- package/types/test/pretty-sequence/various_situations.d.ts +2 -0
- package/types/test/pretty-sequence/various_situations.d.ts.map +1 -0
- package/types/test/pretty-sequence.d.ts +2 -0
- package/types/test/pretty-sequence.d.ts.map +1 -0
- package/types/test/svelte-naming-convention/basic_snake_case.d.ts +2 -0
- package/types/test/svelte-naming-convention/basic_snake_case.d.ts.map +1 -0
- package/types/test/svelte-naming-convention/case_by_identifier.d.ts +2 -0
- package/types/test/svelte-naming-convention/case_by_identifier.d.ts.map +1 -0
- package/types/test/svelte-naming-convention/snake_case_with_symbols.d.ts +2 -0
- package/types/test/svelte-naming-convention/snake_case_with_symbols.d.ts.map +1 -0
- package/types/test/svelte-naming-convention.d.ts +2 -0
- package/types/test/svelte-naming-convention.d.ts.map +1 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {string} value
|
|
4
4
|
* @returns {import("eslint").RuleTester.InvalidTestCase}
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
const test_case = (type, value) => ({
|
|
7
7
|
code: `
|
|
8
8
|
var value = /** @type {A} */(${value})
|
|
9
9
|
var value = /** @type {B} */(${value}) // comment...
|
|
@@ -14,11 +14,36 @@ let test_case = (type, value) => ({
|
|
|
14
14
|
var value = ((/** @type {E} */(${value})))
|
|
15
15
|
`,
|
|
16
16
|
errors: [
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
{
|
|
18
|
+
column: 13,
|
|
19
|
+
line: 2,
|
|
20
|
+
messageId: "not_match",
|
|
21
|
+
type
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
column: 13,
|
|
25
|
+
line: 3,
|
|
26
|
+
messageId: "not_match",
|
|
27
|
+
type
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
column: 13,
|
|
31
|
+
line: 4,
|
|
32
|
+
messageId: "not_match",
|
|
33
|
+
type
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
column: 13,
|
|
37
|
+
line: 7,
|
|
38
|
+
messageId: "not_match",
|
|
39
|
+
type
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
column: 13,
|
|
43
|
+
line: 8,
|
|
44
|
+
messageId: "not_match",
|
|
45
|
+
type
|
|
46
|
+
}
|
|
22
47
|
],
|
|
23
48
|
output: `
|
|
24
49
|
var value = /** @type {A} */(${value})/**/
|
|
@@ -29,7 +54,9 @@ let test_case = (type, value) => ({
|
|
|
29
54
|
var value = /** @type {D} */((${value}))/**/
|
|
30
55
|
var value = ((/** @type {E} */(${value})/**/))
|
|
31
56
|
`,
|
|
32
|
-
|
|
57
|
+
languageOptions: {
|
|
58
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
59
|
+
}
|
|
33
60
|
})
|
|
34
61
|
|
|
35
62
|
/**
|
|
@@ -58,28 +85,33 @@ exports.module = (valid, invalid) => {
|
|
|
58
85
|
`,
|
|
59
86
|
errors: [
|
|
60
87
|
{
|
|
61
|
-
line: 2,
|
|
62
88
|
column: 24,
|
|
89
|
+
line: 2,
|
|
90
|
+
messageId: "not_match",
|
|
63
91
|
type: "AwaitExpression"
|
|
64
92
|
},
|
|
65
93
|
{
|
|
66
|
-
line: 3,
|
|
67
94
|
column: 31,
|
|
95
|
+
line: 3,
|
|
96
|
+
messageId: "not_match",
|
|
68
97
|
type: "AwaitExpression"
|
|
69
98
|
},
|
|
70
99
|
{
|
|
71
|
-
line: 4,
|
|
72
100
|
column: 31,
|
|
101
|
+
line: 4,
|
|
102
|
+
messageId: "not_match",
|
|
73
103
|
type: "AwaitExpression"
|
|
74
104
|
},
|
|
75
105
|
{
|
|
76
|
-
line: 7,
|
|
77
106
|
column: 7,
|
|
107
|
+
line: 7,
|
|
108
|
+
messageId: "not_match",
|
|
78
109
|
type: "AwaitExpression"
|
|
79
110
|
},
|
|
80
111
|
{
|
|
81
|
-
line: 8,
|
|
82
112
|
column: 33,
|
|
113
|
+
line: 8,
|
|
114
|
+
messageId: "not_match",
|
|
83
115
|
type: "AwaitExpression"
|
|
84
116
|
}
|
|
85
117
|
],
|
|
@@ -94,7 +126,9 @@ exports.module = (valid, invalid) => {
|
|
|
94
126
|
((/** @type {E} */(await b)/**/));
|
|
95
127
|
}
|
|
96
128
|
`,
|
|
97
|
-
|
|
129
|
+
languageOptions: {
|
|
130
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
131
|
+
}
|
|
98
132
|
},
|
|
99
133
|
test_case("BinaryExpression", "a / b"),
|
|
100
134
|
test_case("CallExpression", "a(b, c)"),
|
|
@@ -133,28 +167,33 @@ exports.module = (valid, invalid) => {
|
|
|
133
167
|
`,
|
|
134
168
|
errors: [
|
|
135
169
|
{
|
|
136
|
-
line: 2,
|
|
137
170
|
column: 18,
|
|
171
|
+
line: 2,
|
|
172
|
+
messageId: "not_match",
|
|
138
173
|
type: "MetaProperty"
|
|
139
174
|
},
|
|
140
175
|
{
|
|
141
|
-
line: 3,
|
|
142
176
|
column: 34,
|
|
177
|
+
line: 3,
|
|
178
|
+
messageId: "not_match",
|
|
143
179
|
type: "MetaProperty"
|
|
144
180
|
},
|
|
145
181
|
{
|
|
146
|
-
line: 4,
|
|
147
182
|
column: 34,
|
|
183
|
+
line: 4,
|
|
184
|
+
messageId: "not_match",
|
|
148
185
|
type: "MetaProperty"
|
|
149
186
|
},
|
|
150
187
|
{
|
|
151
|
-
line: 7,
|
|
152
188
|
column: 7,
|
|
189
|
+
line: 7,
|
|
190
|
+
messageId: "not_match",
|
|
153
191
|
type: "MetaProperty"
|
|
154
192
|
},
|
|
155
193
|
{
|
|
156
|
-
line: 8,
|
|
157
194
|
column: 36,
|
|
195
|
+
line: 8,
|
|
196
|
+
messageId: "not_match",
|
|
158
197
|
type: "MetaProperty"
|
|
159
198
|
}
|
|
160
199
|
],
|
|
@@ -169,7 +208,9 @@ exports.module = (valid, invalid) => {
|
|
|
169
208
|
((/** @type {E} */(new.target)/**/));
|
|
170
209
|
}
|
|
171
210
|
`,
|
|
172
|
-
|
|
211
|
+
languageOptions: {
|
|
212
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
213
|
+
}
|
|
173
214
|
},
|
|
174
215
|
test_case("NewExpression", "new a(b, c)"),
|
|
175
216
|
test_case(
|
|
@@ -199,28 +240,33 @@ exports.module = (valid, invalid) => {
|
|
|
199
240
|
`,
|
|
200
241
|
errors: [
|
|
201
242
|
{
|
|
202
|
-
line: 2,
|
|
203
243
|
column: 19,
|
|
244
|
+
line: 2,
|
|
245
|
+
messageId: "not_match",
|
|
204
246
|
type: "YieldExpression"
|
|
205
247
|
},
|
|
206
248
|
{
|
|
207
|
-
line: 3,
|
|
208
249
|
column: 31,
|
|
250
|
+
line: 3,
|
|
251
|
+
messageId: "not_match",
|
|
209
252
|
type: "YieldExpression"
|
|
210
253
|
},
|
|
211
254
|
{
|
|
212
|
-
line: 4,
|
|
213
255
|
column: 31,
|
|
256
|
+
line: 4,
|
|
257
|
+
messageId: "not_match",
|
|
214
258
|
type: "YieldExpression"
|
|
215
259
|
},
|
|
216
260
|
{
|
|
217
|
-
line: 7,
|
|
218
261
|
column: 7,
|
|
262
|
+
line: 7,
|
|
263
|
+
messageId: "not_match",
|
|
219
264
|
type: "YieldExpression"
|
|
220
265
|
},
|
|
221
266
|
{
|
|
222
|
-
line: 8,
|
|
223
267
|
column: 33,
|
|
268
|
+
line: 8,
|
|
269
|
+
messageId: "not_match",
|
|
224
270
|
type: "YieldExpression"
|
|
225
271
|
}
|
|
226
272
|
],
|
|
@@ -235,7 +281,9 @@ exports.module = (valid, invalid) => {
|
|
|
235
281
|
((/** @type {E} */(yield b)/**/));
|
|
236
282
|
}
|
|
237
283
|
`,
|
|
238
|
-
|
|
284
|
+
languageOptions: {
|
|
285
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
286
|
+
}
|
|
239
287
|
}
|
|
240
288
|
)
|
|
241
289
|
}
|
|
@@ -37,28 +37,44 @@ exports.module = (valid, invalid) => {
|
|
|
37
37
|
.../** @type {X} */(x)/**/
|
|
38
38
|
})/**/;
|
|
39
39
|
/** @type {Y} */(y, /** @type {Z} */(z[/** @type {123} */(123)/**/])/**/)/**/`,
|
|
40
|
-
|
|
40
|
+
languageOptions: {
|
|
41
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
)
|
|
43
45
|
invalid.push(
|
|
44
46
|
{
|
|
45
47
|
code: "var v = /**@type {A}*/(a)/**/",
|
|
46
|
-
errors: [
|
|
48
|
+
errors: [
|
|
49
|
+
{
|
|
50
|
+
column: 8,
|
|
51
|
+
line: 1,
|
|
52
|
+
messageId: "not_match"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
47
55
|
output: "var v = /** @type {A} */(a)/**/"
|
|
48
56
|
},
|
|
49
57
|
{
|
|
50
58
|
code: "var v = /** @type {A} */( /** @type {B} */(/** @type {C} */((a) /* block... */))) // line...",
|
|
51
|
-
errors: [
|
|
59
|
+
errors: [
|
|
60
|
+
{
|
|
61
|
+
column: 8,
|
|
62
|
+
line: 1,
|
|
63
|
+
messageId: "not_match"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
// eslint-disable-next-line max-len
|
|
52
67
|
output: "var v = /** @type {A} */(/** @type {B} */(/** @type {C} */((a))/**/)/**/)/**/ /* block... */ // line..."
|
|
53
68
|
},
|
|
54
69
|
{
|
|
55
70
|
code: "var v = { b: /** @type {A} */(a) }",
|
|
56
|
-
errors: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
errors: [
|
|
72
|
+
{
|
|
73
|
+
column: 13,
|
|
74
|
+
line: 1,
|
|
75
|
+
messageId: "not_match"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
62
78
|
output: "var v = { b: /** @type {A} */(a)/**/ }"
|
|
63
79
|
},
|
|
64
80
|
{
|
|
@@ -73,7 +89,9 @@ exports.module = (valid, invalid) => {
|
|
|
73
89
|
.../** @type {X} */(x)
|
|
74
90
|
});
|
|
75
91
|
/** @type {Y} */(y, /** @type {Z} */(z[/** @type {123} */(123)]))`,
|
|
76
|
-
errors: [
|
|
92
|
+
errors: [
|
|
93
|
+
...new Array(21).fill({ messageId: "not_match" })
|
|
94
|
+
],
|
|
77
95
|
output: `var v = /** @type {V} */({
|
|
78
96
|
a: /** @type {A} */([/** @type {B} */(b)/**/, /** @type {C} */(c)/**/, /** @type {D} */(d)/**/])/**/,
|
|
79
97
|
e: /** @type {F} */(f)/**/(/** @type {G} */(g)/**/, /** @type {E} */(E)/**/, /** @type {I} */(i)/**/),
|
|
@@ -85,7 +103,9 @@ exports.module = (valid, invalid) => {
|
|
|
85
103
|
.../** @type {X} */(x)/**/
|
|
86
104
|
})/**/;
|
|
87
105
|
/** @type {Y} */(y, /** @type {Z} */(z[/** @type {123} */(123)/**/])/**/)/**/`,
|
|
88
|
-
|
|
106
|
+
languageOptions: {
|
|
107
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
108
|
+
}
|
|
89
109
|
}
|
|
90
110
|
)
|
|
91
111
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict"
|
|
2
|
-
|
|
2
|
+
const { RuleTester } = require("eslint")
|
|
3
3
|
|
|
4
4
|
/** @type {RuleTester.ValidTestCase[]} */
|
|
5
|
-
|
|
5
|
+
const valid = []
|
|
6
6
|
/** @type {RuleTester.InvalidTestCase[]} */
|
|
7
|
-
|
|
7
|
+
const invalid = []
|
|
8
8
|
|
|
9
9
|
require(
|
|
10
10
|
"./pretty-jsdoc-casting/case_by_expression"
|
|
@@ -12,13 +12,15 @@ exports.module = (valid, invalid) => {
|
|
|
12
12
|
`,
|
|
13
13
|
errors: [
|
|
14
14
|
{
|
|
15
|
-
line: 2,
|
|
16
15
|
column: 17,
|
|
16
|
+
line: 2,
|
|
17
|
+
messageId: "not_match",
|
|
17
18
|
type: "ArrayExpression"
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
|
-
line: 3,
|
|
21
21
|
column: 17,
|
|
22
|
+
line: 3,
|
|
23
|
+
messageId: "not_match",
|
|
22
24
|
type: "ArrayExpression"
|
|
23
25
|
}
|
|
24
26
|
],
|
|
@@ -40,13 +42,15 @@ exports.module = (valid, invalid) => {
|
|
|
40
42
|
`,
|
|
41
43
|
errors: [
|
|
42
44
|
{
|
|
43
|
-
line: 2,
|
|
44
45
|
column: 9,
|
|
46
|
+
line: 2,
|
|
47
|
+
messageId: "not_match",
|
|
45
48
|
type: "ArrayPattern"
|
|
46
49
|
},
|
|
47
50
|
{
|
|
48
|
-
line: 3,
|
|
49
51
|
column: 9,
|
|
52
|
+
line: 3,
|
|
53
|
+
messageId: "not_match",
|
|
50
54
|
type: "ArrayPattern"
|
|
51
55
|
}
|
|
52
56
|
],
|
|
@@ -59,7 +63,9 @@ exports.module = (valid, invalid) => {
|
|
|
59
63
|
] = value
|
|
60
64
|
var [] = value
|
|
61
65
|
`,
|
|
62
|
-
|
|
66
|
+
languageOptions: {
|
|
67
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
68
|
+
}
|
|
63
69
|
},
|
|
64
70
|
{
|
|
65
71
|
code: `
|
|
@@ -76,13 +82,15 @@ exports.module = (valid, invalid) => {
|
|
|
76
82
|
`,
|
|
77
83
|
errors: [
|
|
78
84
|
{
|
|
79
|
-
line: 2,
|
|
80
85
|
column: 17,
|
|
86
|
+
line: 2,
|
|
87
|
+
messageId: "not_match",
|
|
81
88
|
type: "ArrowFunctionExpression"
|
|
82
89
|
},
|
|
83
90
|
{
|
|
84
|
-
line: 5,
|
|
85
91
|
column: 17,
|
|
92
|
+
line: 5,
|
|
93
|
+
messageId: "not_match",
|
|
86
94
|
type: "ArrowFunctionExpression"
|
|
87
95
|
}
|
|
88
96
|
],
|
|
@@ -102,7 +110,9 @@ exports.module = (valid, invalid) => {
|
|
|
102
110
|
var value = async a => b
|
|
103
111
|
var value = async (a, b, c) => {}
|
|
104
112
|
`,
|
|
105
|
-
|
|
113
|
+
languageOptions: {
|
|
114
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
115
|
+
}
|
|
106
116
|
},
|
|
107
117
|
{
|
|
108
118
|
code: `
|
|
@@ -112,18 +122,20 @@ exports.module = (valid, invalid) => {
|
|
|
112
122
|
function func2(aaaaaaaaaa, bbbbbbbbbbb, ccccccccccc) {
|
|
113
123
|
//
|
|
114
124
|
}
|
|
115
|
-
function
|
|
116
|
-
async function
|
|
125
|
+
function func3() {}
|
|
126
|
+
async function func4() {}
|
|
117
127
|
`,
|
|
118
128
|
errors: [
|
|
119
129
|
{
|
|
120
|
-
line: 2,
|
|
121
130
|
column: 18,
|
|
131
|
+
line: 2,
|
|
132
|
+
messageId: "not_match",
|
|
122
133
|
type: "FunctionDeclaration"
|
|
123
134
|
},
|
|
124
135
|
{
|
|
125
|
-
line: 5,
|
|
126
136
|
column: 19,
|
|
137
|
+
line: 5,
|
|
138
|
+
messageId: "not_match",
|
|
127
139
|
type: "FunctionDeclaration"
|
|
128
140
|
}
|
|
129
141
|
],
|
|
@@ -138,10 +150,12 @@ exports.module = (valid, invalid) => {
|
|
|
138
150
|
) {
|
|
139
151
|
//
|
|
140
152
|
}
|
|
141
|
-
function
|
|
142
|
-
async function
|
|
153
|
+
function func3() {}
|
|
154
|
+
async function func4() {}
|
|
143
155
|
`,
|
|
144
|
-
|
|
156
|
+
languageOptions: {
|
|
157
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
158
|
+
}
|
|
145
159
|
},
|
|
146
160
|
{
|
|
147
161
|
code: `
|
|
@@ -156,13 +170,15 @@ exports.module = (valid, invalid) => {
|
|
|
156
170
|
`,
|
|
157
171
|
errors: [
|
|
158
172
|
{
|
|
159
|
-
line: 2,
|
|
160
173
|
column: 26,
|
|
174
|
+
line: 2,
|
|
175
|
+
messageId: "not_match",
|
|
161
176
|
type: "FunctionExpression"
|
|
162
177
|
},
|
|
163
178
|
{
|
|
164
|
-
line: 5,
|
|
165
179
|
column: 26,
|
|
180
|
+
line: 5,
|
|
181
|
+
messageId: "not_match",
|
|
166
182
|
type: "FunctionExpression"
|
|
167
183
|
}
|
|
168
184
|
],
|
|
@@ -180,7 +196,9 @@ exports.module = (valid, invalid) => {
|
|
|
180
196
|
var value = function () {}
|
|
181
197
|
var value = async function () {}
|
|
182
198
|
`,
|
|
183
|
-
|
|
199
|
+
languageOptions: {
|
|
200
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
201
|
+
}
|
|
184
202
|
},
|
|
185
203
|
{
|
|
186
204
|
code: `
|
|
@@ -190,13 +208,15 @@ exports.module = (valid, invalid) => {
|
|
|
190
208
|
`,
|
|
191
209
|
errors: [
|
|
192
210
|
{
|
|
193
|
-
line: 2,
|
|
194
211
|
column: 9,
|
|
212
|
+
line: 2,
|
|
213
|
+
messageId: "not_match",
|
|
195
214
|
type: "CallExpression"
|
|
196
215
|
},
|
|
197
216
|
{
|
|
198
|
-
line: 3,
|
|
199
217
|
column: 9,
|
|
218
|
+
line: 3,
|
|
219
|
+
messageId: "not_match",
|
|
200
220
|
type: "CallExpression"
|
|
201
221
|
}
|
|
202
222
|
],
|
|
@@ -218,13 +238,15 @@ exports.module = (valid, invalid) => {
|
|
|
218
238
|
`,
|
|
219
239
|
errors: [
|
|
220
240
|
{
|
|
221
|
-
line: 2,
|
|
222
241
|
column: 10,
|
|
242
|
+
line: 2,
|
|
243
|
+
messageId: "not_match",
|
|
223
244
|
type: "NewExpression"
|
|
224
245
|
},
|
|
225
246
|
{
|
|
226
|
-
line: 3,
|
|
227
247
|
column: 10,
|
|
248
|
+
line: 3,
|
|
249
|
+
messageId: "not_match",
|
|
228
250
|
type: "NewExpression"
|
|
229
251
|
}
|
|
230
252
|
],
|
|
@@ -246,13 +268,15 @@ exports.module = (valid, invalid) => {
|
|
|
246
268
|
`,
|
|
247
269
|
errors: [
|
|
248
270
|
{
|
|
249
|
-
line: 2,
|
|
250
271
|
column: 17,
|
|
272
|
+
line: 2,
|
|
273
|
+
messageId: "not_match",
|
|
251
274
|
type: "ObjectExpression"
|
|
252
275
|
},
|
|
253
276
|
{
|
|
254
|
-
line: 3,
|
|
255
277
|
column: 17,
|
|
278
|
+
line: 3,
|
|
279
|
+
messageId: "not_match",
|
|
256
280
|
type: "ObjectExpression"
|
|
257
281
|
}
|
|
258
282
|
],
|
|
@@ -265,7 +289,9 @@ exports.module = (valid, invalid) => {
|
|
|
265
289
|
}
|
|
266
290
|
var value = {}
|
|
267
291
|
`,
|
|
268
|
-
|
|
292
|
+
languageOptions: {
|
|
293
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
294
|
+
}
|
|
269
295
|
},
|
|
270
296
|
{
|
|
271
297
|
code: `
|
|
@@ -275,13 +301,15 @@ exports.module = (valid, invalid) => {
|
|
|
275
301
|
`,
|
|
276
302
|
errors: [
|
|
277
303
|
{
|
|
278
|
-
line: 2,
|
|
279
304
|
column: 9,
|
|
305
|
+
line: 2,
|
|
306
|
+
messageId: "not_match",
|
|
280
307
|
type: "ObjectPattern"
|
|
281
308
|
},
|
|
282
309
|
{
|
|
283
|
-
line: 3,
|
|
284
310
|
column: 9,
|
|
311
|
+
line: 3,
|
|
312
|
+
messageId: "not_match",
|
|
285
313
|
type: "ObjectPattern"
|
|
286
314
|
}
|
|
287
315
|
],
|
|
@@ -294,7 +322,9 @@ exports.module = (valid, invalid) => {
|
|
|
294
322
|
} = value
|
|
295
323
|
var {} = value
|
|
296
324
|
`,
|
|
297
|
-
|
|
325
|
+
languageOptions: {
|
|
326
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
327
|
+
}
|
|
298
328
|
},
|
|
299
329
|
{
|
|
300
330
|
code: `
|
|
@@ -306,13 +336,15 @@ exports.module = (valid, invalid) => {
|
|
|
306
336
|
`,
|
|
307
337
|
errors: [
|
|
308
338
|
{
|
|
309
|
-
line: 2,
|
|
310
339
|
column: 4,
|
|
340
|
+
line: 2,
|
|
341
|
+
messageId: "not_match",
|
|
311
342
|
type: "SequenceExpression"
|
|
312
343
|
},
|
|
313
344
|
{
|
|
314
|
-
line: 6,
|
|
315
345
|
column: 4,
|
|
346
|
+
line: 6,
|
|
347
|
+
messageId: "not_match",
|
|
316
348
|
type: "SequenceExpression"
|
|
317
349
|
}
|
|
318
350
|
],
|
|
@@ -19,7 +19,9 @@ exports.module = (valid, invalid) => {
|
|
|
19
19
|
checkSequence: false
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
-
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
24
|
+
}
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
code: `
|
|
@@ -28,14 +30,18 @@ exports.module = (valid, invalid) => {
|
|
|
28
30
|
}
|
|
29
31
|
`,
|
|
30
32
|
options: [ { indent: " " } ],
|
|
31
|
-
|
|
33
|
+
languageOptions: {
|
|
34
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
35
|
+
}
|
|
32
36
|
},
|
|
33
37
|
{
|
|
34
38
|
code: `
|
|
35
39
|
var value = { aaaaaaaaaa_aaaaaaaaaa_aaaaaaaaaa }
|
|
36
40
|
`,
|
|
37
41
|
options: [ { maxLength: 40 } ],
|
|
38
|
-
|
|
42
|
+
languageOptions: {
|
|
43
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
)
|
|
41
47
|
invalid.push(
|
|
@@ -43,7 +49,7 @@ exports.module = (valid, invalid) => {
|
|
|
43
49
|
code: `
|
|
44
50
|
var value = [a,b,c]
|
|
45
51
|
`,
|
|
46
|
-
errors: [ {} ],
|
|
52
|
+
errors: [ { messageId: "not_match" } ],
|
|
47
53
|
options: [ { arrayBracketSpacing: true } ],
|
|
48
54
|
output: `
|
|
49
55
|
var value = [ a, b, c ]
|
|
@@ -53,7 +59,7 @@ exports.module = (valid, invalid) => {
|
|
|
53
59
|
code: `
|
|
54
60
|
var value = [a,b,c]
|
|
55
61
|
`,
|
|
56
|
-
errors: [ {} ],
|
|
62
|
+
errors: [ { messageId: "not_match" } ],
|
|
57
63
|
options: [ { arrayBracketSpacing: false } ],
|
|
58
64
|
output: `
|
|
59
65
|
var value = [a, b, c]
|
|
@@ -65,23 +71,27 @@ exports.module = (valid, invalid) => {
|
|
|
65
71
|
code: `
|
|
66
72
|
var value = (a,b,c) => {}
|
|
67
73
|
`,
|
|
68
|
-
errors: [ {} ],
|
|
74
|
+
errors: [ { messageId: "not_match" } ],
|
|
69
75
|
options: [ { funcCallSpacing: true } ],
|
|
70
76
|
output: `
|
|
71
77
|
var value = ( a, b, c ) => {}
|
|
72
78
|
`,
|
|
73
|
-
|
|
79
|
+
languageOptions: {
|
|
80
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
81
|
+
}
|
|
74
82
|
},
|
|
75
83
|
{
|
|
76
84
|
code: `
|
|
77
85
|
var value = (a,b,c) => {}
|
|
78
86
|
`,
|
|
79
|
-
errors: [ {} ],
|
|
87
|
+
errors: [ { messageId: "not_match" } ],
|
|
80
88
|
options: [ { funcCallSpacing: false } ],
|
|
81
89
|
output: `
|
|
82
90
|
var value = (a, b, c) => {}
|
|
83
91
|
`,
|
|
84
|
-
|
|
92
|
+
languageOptions: {
|
|
93
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
94
|
+
}
|
|
85
95
|
}
|
|
86
96
|
)
|
|
87
97
|
invalid.push(
|
|
@@ -89,23 +99,27 @@ exports.module = (valid, invalid) => {
|
|
|
89
99
|
code: `
|
|
90
100
|
var value = {a,b,c}
|
|
91
101
|
`,
|
|
92
|
-
errors: [ {} ],
|
|
102
|
+
errors: [ { messageId: "not_match" } ],
|
|
93
103
|
options: [ { objectCurlySpacing: true } ],
|
|
94
104
|
output: `
|
|
95
105
|
var value = { a, b, c }
|
|
96
106
|
`,
|
|
97
|
-
|
|
107
|
+
languageOptions: {
|
|
108
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
109
|
+
}
|
|
98
110
|
},
|
|
99
111
|
{
|
|
100
112
|
code: `
|
|
101
113
|
var value = {a,b,c}
|
|
102
114
|
`,
|
|
103
|
-
errors: [ {} ],
|
|
115
|
+
errors: [ { messageId: "not_match" } ],
|
|
104
116
|
options: [ { objectCurlySpacing: false } ],
|
|
105
117
|
output: `
|
|
106
118
|
var value = {a, b, c}
|
|
107
119
|
`,
|
|
108
|
-
|
|
120
|
+
languageOptions: {
|
|
121
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
122
|
+
}
|
|
109
123
|
}
|
|
110
124
|
)
|
|
111
125
|
invalid.push(
|
|
@@ -113,14 +127,16 @@ exports.module = (valid, invalid) => {
|
|
|
113
127
|
code: `
|
|
114
128
|
var value = \`\${[a,b,c]}\`
|
|
115
129
|
`,
|
|
116
|
-
errors: [ {} ],
|
|
130
|
+
errors: [ { messageId: "not_match" } ],
|
|
117
131
|
options: [
|
|
118
132
|
{ ignoreTemplateLiteral: false }
|
|
119
133
|
],
|
|
120
134
|
output: `
|
|
121
135
|
var value = \`\${[ a, b, c ]}\`
|
|
122
136
|
`,
|
|
123
|
-
|
|
137
|
+
languageOptions: {
|
|
138
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
139
|
+
}
|
|
124
140
|
}
|
|
125
141
|
)
|
|
126
142
|
}
|