eslint-plugin-lube 0.2.5 → 0.3.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/README.md +4 -4
- package/docs/pretty-imports.md +73 -0
- package/docs/pretty-jsdoc-casting.md +24 -0
- package/docs/svelte-naming-convention.md +48 -0
- package/index.js +5 -3
- package/package.json +26 -26
- package/private.d.ts +43 -22
- package/rules/pretty-imports.js +41 -29
- package/rules/pretty-jsdoc-casting.js +215 -0
- package/rules/svelte-naming-convention.js +169 -205
- package/test/pretty-imports/{check_exports.js → ExportNamedDeclaration.js} +4 -4
- package/test/pretty-imports/{check_imports.js → ImportDeclaration.js} +4 -4
- package/test/pretty-imports.js +2 -2
- package/test/pretty-jsdoc-casting/case_by_expression.js +240 -0
- package/test/pretty-jsdoc-casting/nested_casting.js +99 -0
- package/test/pretty-jsdoc-casting.js +19 -0
- package/test/svelte-naming-convention/basic_snake_case.js +0 -7
- package/test/svelte-naming-convention/case_by_identifier.js +0 -137
- package/test/svelte-naming-convention/snake_case_with_symbols.js +0 -8
- package/node-type.text +0 -71
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
docs: {
|
|
6
6
|
description: "Enforces snake_case with some symbols for variable declaration.",
|
|
7
7
|
recommended: true,
|
|
8
|
-
url: "https://github.com/
|
|
8
|
+
url: "https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/docs/svelte-naming-convention.md"
|
|
9
9
|
},
|
|
10
10
|
fixable: "code",
|
|
11
11
|
messages: {
|
|
@@ -20,10 +20,10 @@ module.exports = {
|
|
|
20
20
|
},
|
|
21
21
|
type: "object"
|
|
22
22
|
}],
|
|
23
|
-
type: "
|
|
23
|
+
type: "layout"
|
|
24
24
|
},
|
|
25
25
|
create(context) {
|
|
26
|
-
const fix_same_names = /** @type {boolean} */
|
|
26
|
+
const fix_same_names = /** @type {boolean} */(context.options[0]?.fixSameNames)/**/ ?? true
|
|
27
27
|
|
|
28
28
|
// let name | const name | class name
|
|
29
29
|
const allow_regex = /^[_$]?[_$]?(?:[\da-z]+(?:_[\da-z]+)*\$?\$?)?$|^[A-Z](?:_?[\dA-Z]+)*$|^(?:[\dA-Z][\da-z]*)+$/
|
|
@@ -31,23 +31,17 @@ module.exports = {
|
|
|
31
31
|
const fix_regex = /([\da-z]?)([A-Z][\dA-Z]*)/g
|
|
32
32
|
const camel_case_regex = /^[\da-z]+([A-Z][\da-z]*)*$/
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* @param {string} _
|
|
36
|
-
* @param {string} a
|
|
37
|
-
* @param {string} b
|
|
38
|
-
*/
|
|
39
|
-
function fix_callback(_, a, b) {
|
|
40
|
-
return a + (a ? "_" : "") + b.toLowerCase()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
34
|
/** @type {Set<string>} */
|
|
44
35
|
const reported_declarations = new Set()
|
|
45
|
-
/** @type {Map<string, import("../private").
|
|
36
|
+
/** @type {Map<string, import("../private").AstNode[]>} */
|
|
46
37
|
const pending_usages = new Map()
|
|
47
|
-
/** @type {Set<import("../private").
|
|
38
|
+
/** @type {Set<import("../private").AstNode>} */
|
|
48
39
|
const shortand_properties = new Set()
|
|
49
40
|
|
|
50
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* @param {import("../private").AstNode & import("estree").Identifier} node
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
51
45
|
function defer(node) {
|
|
52
46
|
if (fix_same_names) {
|
|
53
47
|
const name = node.name
|
|
@@ -63,7 +57,20 @@ module.exports = {
|
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
|
|
66
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* @param {string} _
|
|
62
|
+
* @param {string} a
|
|
63
|
+
* @param {string} b
|
|
64
|
+
* @returns {string}
|
|
65
|
+
*/
|
|
66
|
+
function fix_callback(_, a, b) {
|
|
67
|
+
return a + (a ? "_" : "") + b.toLowerCase()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {import("../private").AstNode & import("estree").Identifier} node
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
67
74
|
function report(node) {
|
|
68
75
|
const name = node.name
|
|
69
76
|
context.report({
|
|
@@ -79,313 +86,270 @@ module.exports = {
|
|
|
79
86
|
return null
|
|
80
87
|
},
|
|
81
88
|
messageId: "not_match",
|
|
82
|
-
node: /** @type {import("estree").Node} */(node)
|
|
89
|
+
node: /** @type {import("estree").Node} */(node)/**/
|
|
83
90
|
})
|
|
84
91
|
if (fix_same_names) {
|
|
85
92
|
const usages = pending_usages.get(name)
|
|
86
93
|
while (usages?.length) {
|
|
87
|
-
report(/** @type {import("../private").
|
|
88
|
-
usages.pop()
|
|
89
|
-
))
|
|
94
|
+
report(/** @type {import("../private").AstNode & import("estree").Identifier} */(usages.pop())/**/)
|
|
90
95
|
}
|
|
91
96
|
reported_declarations.add(name)
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
return {
|
|
96
|
-
/** @param {import("../private").
|
|
101
|
+
/** @param {import("../private").AstNode & import("estree").Identifier} node */
|
|
97
102
|
Identifier(node) {
|
|
98
103
|
const name = node.name
|
|
99
104
|
if (allow_regex.test(name)) return
|
|
100
105
|
const parent = node.parent
|
|
101
106
|
const type = parent.type
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
switch (type) {
|
|
108
|
+
case "ArrayExpression":
|
|
109
|
+
// var value = [ camelCase ]
|
|
104
110
|
defer(node)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if ("ArrayPattern" == type) {
|
|
111
|
+
break
|
|
112
|
+
case "ArrayPattern":
|
|
113
|
+
// var [ camelCase ] = value
|
|
109
114
|
report(node)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if ("ArrowFunctionExpression" == type) {
|
|
115
|
+
break
|
|
116
|
+
case "ArrowFunctionExpression":
|
|
117
|
+
// (camelCase) => {}
|
|
114
118
|
report(node)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if ("AssignmentExpression" == type) {
|
|
119
|
+
break
|
|
120
|
+
case "AssignmentExpression":
|
|
121
|
+
// left = right
|
|
119
122
|
defer(node)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if ("AssignmentPattern" == type) {
|
|
123
|
+
break
|
|
124
|
+
case "AssignmentPattern":
|
|
125
|
+
// (left = right) => {}
|
|
124
126
|
if (parent.left == node) {
|
|
125
|
-
// function func({ camelCase = true }) {}
|
|
126
127
|
if (parent.parent?.type != "Property") {
|
|
128
|
+
// function func({ camelCase = true }) {}
|
|
127
129
|
report(node)
|
|
128
130
|
}
|
|
129
131
|
} else {
|
|
130
132
|
defer(node)
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if ("AwaitExpression" == type) {
|
|
134
|
+
break
|
|
135
|
+
case "AwaitExpression":
|
|
136
|
+
// await camelCase
|
|
136
137
|
defer(node)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if ("BinaryExpression" == type) {
|
|
138
|
+
break
|
|
139
|
+
case "BinaryExpression":
|
|
140
|
+
// left +-*/&| right
|
|
141
141
|
defer(node)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if ("CallExpression" == type) {
|
|
142
|
+
break
|
|
143
|
+
/* BlockStatement */
|
|
144
|
+
/* BreakStatement */
|
|
145
|
+
case "CallExpression":
|
|
146
|
+
// camelCase()
|
|
148
147
|
defer(node)
|
|
149
|
-
|
|
150
|
-
}
|
|
148
|
+
break
|
|
151
149
|
/* CatchClause */
|
|
152
150
|
/* ChainExpression */
|
|
153
151
|
/* ClassBody */
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
case "ClassDeclaration":
|
|
153
|
+
// class camelCase {}
|
|
156
154
|
report(node)
|
|
157
|
-
|
|
158
|
-
}
|
|
155
|
+
break
|
|
159
156
|
/* ClassExpression */
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
case "ConditionalExpression":
|
|
158
|
+
// test ? alternate : consequent
|
|
162
159
|
defer(node)
|
|
163
|
-
|
|
164
|
-
}
|
|
160
|
+
break
|
|
165
161
|
/* ContinueStatement */
|
|
166
162
|
/* DebuggerStatement */
|
|
167
163
|
/* DoWhileStatement */
|
|
168
164
|
/* EmptyStatement */
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if ("ExportDefaultDeclaration" == type) {
|
|
165
|
+
case "ExportAllDeclaration":
|
|
166
|
+
// export * as camelCase from "module"
|
|
167
|
+
break
|
|
168
|
+
case "ExportDefaultDeclaration":
|
|
169
|
+
// export default camelCase
|
|
175
170
|
defer(node)
|
|
176
|
-
|
|
177
|
-
}
|
|
171
|
+
break
|
|
178
172
|
/* ExportNamedDeclaration */
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if ("ExpressionStatement" == type) {
|
|
173
|
+
case "ExportSpecifier":
|
|
174
|
+
// export { default as camelCase, camelCase2 } from "module"
|
|
175
|
+
break
|
|
176
|
+
case "ExpressionStatement":
|
|
177
|
+
// camelCase
|
|
185
178
|
defer(node)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if ("ForInStatement" == type) {
|
|
179
|
+
break
|
|
180
|
+
case "ForInStatement":
|
|
181
|
+
// for (left in right) {}
|
|
190
182
|
if (parent.left == node) {
|
|
191
183
|
report(node)
|
|
192
184
|
} else {
|
|
193
185
|
defer(node)
|
|
194
186
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if ("ForOfStatement" == type) {
|
|
187
|
+
break
|
|
188
|
+
case "ForOfStatement":
|
|
189
|
+
// for (left of right) {}
|
|
199
190
|
if (parent.left == node) {
|
|
200
191
|
report(node)
|
|
201
192
|
} else {
|
|
202
193
|
defer(node)
|
|
203
194
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if ("ForStatement" == type) {
|
|
195
|
+
break
|
|
196
|
+
case "ForStatement":
|
|
197
|
+
// for (init; test; update) {}
|
|
208
198
|
defer(node)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (
|
|
199
|
+
break
|
|
200
|
+
case "FunctionDeclaration":
|
|
201
|
+
// function camelCase() {}
|
|
202
|
+
if (
|
|
214
203
|
parent.parent?.type != "ExportNamedDeclaration"
|
|
215
204
|
|| !camel_case_regex.test(name)
|
|
216
205
|
) {
|
|
217
206
|
report(node)
|
|
218
207
|
}
|
|
219
208
|
// export function camelCase() {}
|
|
220
|
-
|
|
221
|
-
}
|
|
209
|
+
break
|
|
222
210
|
/* FunctionExpression */
|
|
223
211
|
/* Identifier */
|
|
224
|
-
|
|
225
|
-
|
|
212
|
+
case "IfStatement":
|
|
213
|
+
// if (camelCase) {}
|
|
226
214
|
defer(node)
|
|
227
|
-
|
|
228
|
-
}
|
|
215
|
+
break
|
|
229
216
|
/* ImportDeclaration */
|
|
230
|
-
|
|
231
|
-
|
|
217
|
+
case "ImportDefaultSpecifier":
|
|
218
|
+
// import camelCase from "module"
|
|
232
219
|
report(node)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// import * as camelCase from "module"
|
|
237
|
-
if ("ImportNamespaceSpecifier" == type) {
|
|
220
|
+
break
|
|
221
|
+
/* ImportExpression */
|
|
222
|
+
case "ImportNamespaceSpecifier":
|
|
238
223
|
report(node)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// import { imported as camelCase } from "module"
|
|
224
|
+
// import * as camelCase from "module"
|
|
225
|
+
break
|
|
226
|
+
case "ImportSpecifier":
|
|
227
|
+
// import { imported as local, local2 } from "module"
|
|
244
228
|
if (parent.local == node && parent.imported.name != parent.local.name) {
|
|
229
|
+
// import { imported as camelCase } from "module"
|
|
245
230
|
report(node)
|
|
246
231
|
}
|
|
247
|
-
|
|
248
|
-
}
|
|
232
|
+
break
|
|
249
233
|
/* LabeledStatement */
|
|
250
234
|
/* Literal */
|
|
251
|
-
|
|
252
|
-
|
|
235
|
+
case "LogicalExpression":
|
|
236
|
+
// left &&||?? right
|
|
253
237
|
defer(node)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if ("MemberExpression" == type) {
|
|
238
|
+
break
|
|
239
|
+
case "MemberExpression":
|
|
240
|
+
// object.property
|
|
258
241
|
if (parent.object == node) {
|
|
259
242
|
defer(node)
|
|
260
243
|
}
|
|
261
|
-
// object[camelCase]
|
|
262
|
-
// camelCase[key]
|
|
263
244
|
else if (parent.computed) {
|
|
245
|
+
// object[camelCase]
|
|
246
|
+
// camelCase[key]
|
|
264
247
|
defer(node)
|
|
265
248
|
}
|
|
266
|
-
|
|
267
|
-
}
|
|
249
|
+
break
|
|
268
250
|
/* MetaProperty */
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if ("NewExpression" == type) {
|
|
251
|
+
case "MethodDefinition":
|
|
252
|
+
// class Object { camelCase() {} }
|
|
253
|
+
break
|
|
254
|
+
case "NewExpression":
|
|
255
|
+
// new camelCase
|
|
275
256
|
defer(node)
|
|
276
|
-
|
|
277
|
-
}
|
|
257
|
+
break
|
|
278
258
|
/* ObjectExpression */
|
|
279
259
|
/* ObjectPattern */
|
|
280
260
|
/* PrivateIdentifier */
|
|
281
261
|
/* Program */
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
262
|
+
case "Property":
|
|
263
|
+
// var value = { key: value }
|
|
264
|
+
// var { key: value } = value
|
|
285
265
|
if (parent.value == node) {
|
|
286
266
|
if (parent.key.name == parent.value.name) {
|
|
287
267
|
shortand_properties.add(node)
|
|
288
268
|
}
|
|
289
269
|
defer(node)
|
|
290
270
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
// var { ...camelCase } = value
|
|
299
|
-
if ("RestElement" == type) {
|
|
271
|
+
break
|
|
272
|
+
case "PropertyDefinition":
|
|
273
|
+
// class Object { camelCase = value }
|
|
274
|
+
break
|
|
275
|
+
case "RestElement":
|
|
276
|
+
// var [ ...camelCase ] = value
|
|
277
|
+
// var { ...camelCase } = value
|
|
300
278
|
report(node)
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if ("ReturnStatement" == type) {
|
|
279
|
+
break
|
|
280
|
+
case "ReturnStatement":
|
|
281
|
+
// function func() { return camelCase }
|
|
305
282
|
defer(node)
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if ("SequenceExpression" == type) {
|
|
283
|
+
break
|
|
284
|
+
case "SequenceExpression":
|
|
285
|
+
// a, b, camelCase
|
|
310
286
|
defer(node)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if ("SpreadElement" == type) {
|
|
287
|
+
break
|
|
288
|
+
case "SpreadElement":
|
|
289
|
+
// var value = [ ...camelCase ]
|
|
290
|
+
// var value = { ...camelCase }
|
|
316
291
|
defer(node)
|
|
317
|
-
|
|
318
|
-
}
|
|
292
|
+
break
|
|
319
293
|
/* StaticBlock */
|
|
320
294
|
/* Super */
|
|
321
|
-
|
|
322
|
-
|
|
295
|
+
case "SwitchCase":
|
|
296
|
+
// switch (camelCase) {}
|
|
323
297
|
defer(node)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if ("SwitchStatement" == type) {
|
|
298
|
+
break
|
|
299
|
+
case "SwitchStatement":
|
|
300
|
+
// switch (cond) { case camelCase: break }
|
|
328
301
|
defer(node)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if ("TaggedTemplateExpression" == type) {
|
|
302
|
+
break
|
|
303
|
+
case "TaggedTemplateExpression":
|
|
304
|
+
// camelCase`quasis${expression}quasis`
|
|
333
305
|
defer(node)
|
|
334
|
-
|
|
335
|
-
}
|
|
306
|
+
break
|
|
336
307
|
/* TemplateElement */
|
|
337
|
-
|
|
338
|
-
|
|
308
|
+
case "TemplateLiteral":
|
|
309
|
+
// `quasis${camelCase}quasis`
|
|
339
310
|
defer(node)
|
|
340
|
-
|
|
341
|
-
}
|
|
311
|
+
break
|
|
342
312
|
/* ThisExpression */
|
|
343
|
-
|
|
344
|
-
|
|
313
|
+
case "ThrowStatement":
|
|
314
|
+
// throw camelCase
|
|
345
315
|
defer(node)
|
|
346
|
-
|
|
347
|
-
}
|
|
316
|
+
break
|
|
348
317
|
/* TryStatement */
|
|
349
|
-
|
|
350
|
-
|
|
318
|
+
case "UnaryExpression":
|
|
319
|
+
// +-!~ camelCase
|
|
351
320
|
defer(node)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if ("UpdateExpression" == type) {
|
|
321
|
+
break
|
|
322
|
+
case "UpdateExpression":
|
|
323
|
+
// ++--camelCase++--
|
|
356
324
|
defer(node)
|
|
357
|
-
|
|
358
|
-
}
|
|
325
|
+
break
|
|
359
326
|
/* VariableDeclaration */
|
|
360
|
-
|
|
361
|
-
|
|
327
|
+
case "VariableDeclarator":
|
|
328
|
+
// var id = init
|
|
362
329
|
if (parent.id == node) {
|
|
363
|
-
if (
|
|
330
|
+
if (
|
|
364
331
|
parent.parent?.parent?.type != "ExportNamedDeclaration"
|
|
365
332
|
|| !camel_case_regex.test(name)
|
|
366
333
|
) {
|
|
367
334
|
report(node)
|
|
368
335
|
}
|
|
369
|
-
// export var camelCase
|
|
370
336
|
} else {
|
|
337
|
+
// export var camelCase
|
|
371
338
|
defer(node)
|
|
372
339
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
if ("WhileStatement" == type) {
|
|
340
|
+
break
|
|
341
|
+
case "WhileStatement":
|
|
342
|
+
// while (camelCase) {}
|
|
377
343
|
defer(node)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if ("WithStatement" == type) {
|
|
344
|
+
break
|
|
345
|
+
case "WithStatement":
|
|
346
|
+
// with (camelCase) {}
|
|
382
347
|
defer(node)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if ("YieldExpression" == type) {
|
|
348
|
+
break
|
|
349
|
+
case "YieldExpression":
|
|
350
|
+
// function* func() { yield camelCase }
|
|
387
351
|
defer(node)
|
|
388
|
-
|
|
352
|
+
break
|
|
389
353
|
}
|
|
390
354
|
}
|
|
391
355
|
}
|
|
@@ -37,13 +37,13 @@ exports.module = (valid, invalid) => {
|
|
|
37
37
|
`,
|
|
38
38
|
errors: [
|
|
39
39
|
{
|
|
40
|
-
messageId: "
|
|
40
|
+
messageId: "exports",
|
|
41
41
|
type: "ExportNamedDeclaration",
|
|
42
42
|
line: 3,
|
|
43
43
|
column: 4
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
|
-
messageId: "
|
|
46
|
+
messageId: "exports",
|
|
47
47
|
type: "ExportNamedDeclaration",
|
|
48
48
|
line: 4,
|
|
49
49
|
column: 7
|
|
@@ -79,13 +79,13 @@ exports.module = (valid, invalid) => {
|
|
|
79
79
|
`,
|
|
80
80
|
errors: [
|
|
81
81
|
{
|
|
82
|
-
messageId: "
|
|
82
|
+
messageId: "exports",
|
|
83
83
|
type: "ExportNamedDeclaration",
|
|
84
84
|
line: 3,
|
|
85
85
|
column: 4
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
messageId: "
|
|
88
|
+
messageId: "exports",
|
|
89
89
|
type: "ExportNamedDeclaration",
|
|
90
90
|
line: 4,
|
|
91
91
|
column: 7
|
|
@@ -39,13 +39,13 @@ import {
|
|
|
39
39
|
`,
|
|
40
40
|
errors: [
|
|
41
41
|
{
|
|
42
|
-
messageId: "
|
|
42
|
+
messageId: "imports",
|
|
43
43
|
type: "ImportDeclaration",
|
|
44
44
|
line: 3,
|
|
45
45
|
column: 4
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
messageId: "
|
|
48
|
+
messageId: "imports",
|
|
49
49
|
type: "ImportDeclaration",
|
|
50
50
|
line: 4,
|
|
51
51
|
column: 7
|
|
@@ -81,13 +81,13 @@ import {
|
|
|
81
81
|
`,
|
|
82
82
|
errors: [
|
|
83
83
|
{
|
|
84
|
-
messageId: "
|
|
84
|
+
messageId: "imports",
|
|
85
85
|
type: "ImportDeclaration",
|
|
86
86
|
line: 3,
|
|
87
87
|
column: 4
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
messageId: "
|
|
90
|
+
messageId: "imports",
|
|
91
91
|
type: "ImportDeclaration",
|
|
92
92
|
line: 4,
|
|
93
93
|
column: 7
|
package/test/pretty-imports.js
CHANGED
|
@@ -6,8 +6,8 @@ const valid = []
|
|
|
6
6
|
/** @type {RuleTester.InvalidTestCase[]} */
|
|
7
7
|
const invalid = []
|
|
8
8
|
|
|
9
|
-
require("./pretty-imports/
|
|
10
|
-
require("./pretty-imports/
|
|
9
|
+
require("./pretty-imports/ExportNamedDeclaration").module(valid, invalid)
|
|
10
|
+
require("./pretty-imports/ImportDeclaration").module(valid, invalid)
|
|
11
11
|
|
|
12
12
|
new RuleTester().run(
|
|
13
13
|
"pretty-imports",
|