eslint 9.29.0 → 9.30.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 +1 -1
- package/lib/config/config-loader.js +2 -29
- package/lib/config/flat-config-array.js +1 -1
- package/lib/eslint/eslint.js +1 -1
- package/lib/languages/js/source-code/source-code.js +7 -0
- package/lib/rules/array-bracket-newline.js +3 -3
- package/lib/rules/array-bracket-spacing.js +3 -3
- package/lib/rules/array-element-newline.js +3 -3
- package/lib/rules/arrow-parens.js +3 -3
- package/lib/rules/arrow-spacing.js +3 -3
- package/lib/rules/block-spacing.js +3 -3
- package/lib/rules/brace-style.js +3 -3
- package/lib/rules/comma-dangle.js +3 -3
- package/lib/rules/comma-spacing.js +3 -3
- package/lib/rules/comma-style.js +3 -3
- package/lib/rules/computed-property-spacing.js +3 -3
- package/lib/rules/dot-location.js +3 -3
- package/lib/rules/eol-last.js +3 -3
- package/lib/rules/func-call-spacing.js +3 -3
- package/lib/rules/function-call-argument-newline.js +3 -3
- package/lib/rules/function-paren-newline.js +3 -3
- package/lib/rules/generator-star-spacing.js +3 -3
- package/lib/rules/implicit-arrow-linebreak.js +3 -3
- package/lib/rules/indent-legacy.js +3 -3
- package/lib/rules/indent.js +3 -3
- package/lib/rules/jsx-quotes.js +3 -3
- package/lib/rules/key-spacing.js +3 -3
- package/lib/rules/keyword-spacing.js +3 -3
- package/lib/rules/line-comment-position.js +3 -3
- package/lib/rules/linebreak-style.js +3 -3
- package/lib/rules/lines-around-comment.js +3 -3
- package/lib/rules/lines-around-directive.js +3 -3
- package/lib/rules/lines-between-class-members.js +3 -3
- package/lib/rules/max-len.js +3 -3
- package/lib/rules/max-statements-per-line.js +3 -3
- package/lib/rules/multiline-comment-style.js +3 -3
- package/lib/rules/multiline-ternary.js +3 -3
- package/lib/rules/new-parens.js +3 -3
- package/lib/rules/newline-after-var.js +3 -3
- package/lib/rules/newline-before-return.js +3 -3
- package/lib/rules/newline-per-chained-call.js +3 -3
- package/lib/rules/no-confusing-arrow.js +3 -3
- package/lib/rules/no-duplicate-imports.js +79 -7
- package/lib/rules/no-extra-parens.js +3 -3
- package/lib/rules/no-extra-semi.js +3 -3
- package/lib/rules/no-floating-decimal.js +3 -3
- package/lib/rules/no-mixed-operators.js +3 -3
- package/lib/rules/no-mixed-spaces-and-tabs.js +3 -3
- package/lib/rules/no-multi-spaces.js +3 -3
- package/lib/rules/no-multiple-empty-lines.js +3 -3
- package/lib/rules/no-restricted-properties.js +11 -2
- package/lib/rules/no-spaced-func.js +3 -3
- package/lib/rules/no-tabs.js +3 -3
- package/lib/rules/no-trailing-spaces.js +3 -3
- package/lib/rules/no-unused-vars.js +1 -1
- package/lib/rules/no-whitespace-before-property.js +3 -3
- package/lib/rules/nonblock-statement-body-position.js +3 -3
- package/lib/rules/object-curly-newline.js +3 -3
- package/lib/rules/object-curly-spacing.js +3 -3
- package/lib/rules/object-property-newline.js +3 -3
- package/lib/rules/one-var-declaration-per-line.js +3 -3
- package/lib/rules/operator-linebreak.js +3 -3
- package/lib/rules/padded-blocks.js +3 -3
- package/lib/rules/padding-line-between-statements.js +3 -3
- package/lib/rules/quote-props.js +3 -3
- package/lib/rules/quotes.js +3 -3
- package/lib/rules/rest-spread-spacing.js +3 -3
- package/lib/rules/semi-spacing.js +3 -3
- package/lib/rules/semi-style.js +3 -3
- package/lib/rules/semi.js +3 -3
- package/lib/rules/space-before-blocks.js +3 -3
- package/lib/rules/space-before-function-paren.js +3 -3
- package/lib/rules/space-in-parens.js +3 -3
- package/lib/rules/space-infix-ops.js +3 -3
- package/lib/rules/space-unary-ops.js +3 -3
- package/lib/rules/spaced-comment.js +3 -3
- package/lib/rules/switch-colon-spacing.js +3 -3
- package/lib/rules/template-curly-spacing.js +3 -3
- package/lib/rules/template-tag-spacing.js +3 -3
- package/lib/rules/utils/ast-utils.js +45 -0
- package/lib/rules/wrap-iife.js +3 -3
- package/lib/rules/wrap-regex.js +3 -3
- package/lib/rules/yield-star-spacing.js +3 -3
- package/lib/shared/flags.js +9 -1
- package/lib/shared/runtime-info.js +1 -1
- package/lib/types/index.d.ts +7 -0
- package/lib/types/rules.d.ts +78 -74
- package/package.json +4 -4
@@ -25,12 +25,12 @@ module.exports = {
|
|
25
25
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
26
26
|
url: "https://eslint.style/guide/migration",
|
27
27
|
plugin: {
|
28
|
-
name: "@stylistic/eslint-plugin
|
29
|
-
url: "https://eslint.style
|
28
|
+
name: "@stylistic/eslint-plugin",
|
29
|
+
url: "https://eslint.style",
|
30
30
|
},
|
31
31
|
rule: {
|
32
32
|
name: "multiline-comment-style",
|
33
|
-
url: "https://eslint.style/rules/
|
33
|
+
url: "https://eslint.style/rules/multiline-comment-style",
|
34
34
|
},
|
35
35
|
},
|
36
36
|
],
|
@@ -26,12 +26,12 @@ module.exports = {
|
|
26
26
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
27
27
|
url: "https://eslint.style/guide/migration",
|
28
28
|
plugin: {
|
29
|
-
name: "@stylistic/eslint-plugin
|
30
|
-
url: "https://eslint.style
|
29
|
+
name: "@stylistic/eslint-plugin",
|
30
|
+
url: "https://eslint.style",
|
31
31
|
},
|
32
32
|
rule: {
|
33
33
|
name: "multiline-ternary",
|
34
|
-
url: "https://eslint.style/rules/
|
34
|
+
url: "https://eslint.style/rules/multiline-ternary",
|
35
35
|
},
|
36
36
|
},
|
37
37
|
],
|
package/lib/rules/new-parens.js
CHANGED
@@ -34,12 +34,12 @@ module.exports = {
|
|
34
34
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
35
35
|
url: "https://eslint.style/guide/migration",
|
36
36
|
plugin: {
|
37
|
-
name: "@stylistic/eslint-plugin
|
38
|
-
url: "https://eslint.style
|
37
|
+
name: "@stylistic/eslint-plugin",
|
38
|
+
url: "https://eslint.style",
|
39
39
|
},
|
40
40
|
rule: {
|
41
41
|
name: "new-parens",
|
42
|
-
url: "https://eslint.style/rules/
|
42
|
+
url: "https://eslint.style/rules/new-parens",
|
43
43
|
},
|
44
44
|
},
|
45
45
|
],
|
@@ -48,12 +48,12 @@ module.exports = {
|
|
48
48
|
message: "The new rule moved to a plugin.",
|
49
49
|
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
|
50
50
|
plugin: {
|
51
|
-
name: "@stylistic/eslint-plugin
|
52
|
-
url: "https://eslint.style
|
51
|
+
name: "@stylistic/eslint-plugin",
|
52
|
+
url: "https://eslint.style",
|
53
53
|
},
|
54
54
|
rule: {
|
55
55
|
name: "padding-line-between-statements",
|
56
|
-
url: "https://eslint.style/rules/
|
56
|
+
url: "https://eslint.style/rules/padding-line-between-statements",
|
57
57
|
},
|
58
58
|
},
|
59
59
|
],
|
@@ -36,12 +36,12 @@ module.exports = {
|
|
36
36
|
message: "The new rule moved to a plugin.",
|
37
37
|
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
|
38
38
|
plugin: {
|
39
|
-
name: "@stylistic/eslint-plugin
|
40
|
-
url: "https://eslint.style
|
39
|
+
name: "@stylistic/eslint-plugin",
|
40
|
+
url: "https://eslint.style",
|
41
41
|
},
|
42
42
|
rule: {
|
43
43
|
name: "padding-line-between-statements",
|
44
|
-
url: "https://eslint.style/rules/
|
44
|
+
url: "https://eslint.style/rules/padding-line-between-statements",
|
45
45
|
},
|
46
46
|
},
|
47
47
|
],
|
@@ -27,12 +27,12 @@ module.exports = {
|
|
27
27
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
28
28
|
url: "https://eslint.style/guide/migration",
|
29
29
|
plugin: {
|
30
|
-
name: "@stylistic/eslint-plugin
|
31
|
-
url: "https://eslint.style
|
30
|
+
name: "@stylistic/eslint-plugin",
|
31
|
+
url: "https://eslint.style",
|
32
32
|
},
|
33
33
|
rule: {
|
34
34
|
name: "newline-per-chained-call",
|
35
|
-
url: "https://eslint.style/rules/
|
35
|
+
url: "https://eslint.style/rules/newline-per-chained-call",
|
36
36
|
},
|
37
37
|
},
|
38
38
|
],
|
@@ -40,12 +40,12 @@ module.exports = {
|
|
40
40
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
41
41
|
url: "https://eslint.style/guide/migration",
|
42
42
|
plugin: {
|
43
|
-
name: "@stylistic/eslint-plugin
|
44
|
-
url: "https://eslint.style
|
43
|
+
name: "@stylistic/eslint-plugin",
|
44
|
+
url: "https://eslint.style",
|
45
45
|
},
|
46
46
|
rule: {
|
47
47
|
name: "no-confusing-arrow",
|
48
|
-
url: "https://eslint.style/rules/
|
48
|
+
url: "https://eslint.style/rules/no-confusing-arrow",
|
49
49
|
},
|
50
50
|
},
|
51
51
|
],
|
@@ -66,6 +66,20 @@ function isImportExportCanBeMerged(node1, node2) {
|
|
66
66
|
const importExportType1 = getImportExportType(node1);
|
67
67
|
const importExportType2 = getImportExportType(node2);
|
68
68
|
|
69
|
+
if (
|
70
|
+
(node1.importKind === "type" || node1.exportKind === "type") &&
|
71
|
+
(node2.importKind === "type" || node2.exportKind === "type")
|
72
|
+
) {
|
73
|
+
const isDefault1 = importExportType1 === "ImportDefaultSpecifier";
|
74
|
+
const isDefault2 = importExportType2 === "ImportDefaultSpecifier";
|
75
|
+
const isNamed1 = isImportExportSpecifier(importExportType1, "named");
|
76
|
+
const isNamed2 = isImportExportSpecifier(importExportType2, "named");
|
77
|
+
|
78
|
+
if ((isDefault1 && isNamed2) || (isDefault2 && isNamed1)) {
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
69
83
|
if (
|
70
84
|
(importExportType1 === "ExportAll" &&
|
71
85
|
importExportType2 !== "ExportAll" &&
|
@@ -91,13 +105,33 @@ function isImportExportCanBeMerged(node1, node2) {
|
|
91
105
|
* Returns a boolean if we should report (import|export).
|
92
106
|
* @param {ASTNode} node A node to be reported or not.
|
93
107
|
* @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported.
|
108
|
+
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
|
94
109
|
* @returns {boolean} True if the (import|export) should be reported.
|
95
110
|
*/
|
96
|
-
function shouldReportImportExport(
|
111
|
+
function shouldReportImportExport(
|
112
|
+
node,
|
113
|
+
previousNodes,
|
114
|
+
allowSeparateTypeImports,
|
115
|
+
) {
|
97
116
|
let i = 0;
|
98
117
|
|
99
118
|
while (i < previousNodes.length) {
|
100
|
-
|
119
|
+
const previousNode = previousNodes[i];
|
120
|
+
|
121
|
+
if (allowSeparateTypeImports) {
|
122
|
+
const isTypeNode =
|
123
|
+
node.importKind === "type" || node.exportKind === "type";
|
124
|
+
const isTypePrevious =
|
125
|
+
previousNode.importKind === "type" ||
|
126
|
+
previousNode.exportKind === "type";
|
127
|
+
|
128
|
+
if (isTypeNode !== isTypePrevious) {
|
129
|
+
i++;
|
130
|
+
continue;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
if (isImportExportCanBeMerged(node, previousNode)) {
|
101
135
|
return true;
|
102
136
|
}
|
103
137
|
i++;
|
@@ -136,6 +170,7 @@ function getModule(node) {
|
|
136
170
|
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
|
137
171
|
* @param {string} declarationType A declaration type can be an import or export.
|
138
172
|
* @param {boolean} includeExports Whether or not to check for exports in addition to imports.
|
173
|
+
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
|
139
174
|
* @returns {void} No return value.
|
140
175
|
*/
|
141
176
|
function checkAndReport(
|
@@ -144,6 +179,7 @@ function checkAndReport(
|
|
144
179
|
modules,
|
145
180
|
declarationType,
|
146
181
|
includeExports,
|
182
|
+
allowSeparateTypeImports,
|
147
183
|
) {
|
148
184
|
const module = getModule(node);
|
149
185
|
|
@@ -157,19 +193,43 @@ function checkAndReport(
|
|
157
193
|
exportNodes = getNodesByDeclarationType(previousNodes, "export");
|
158
194
|
}
|
159
195
|
if (declarationType === "import") {
|
160
|
-
if (
|
196
|
+
if (
|
197
|
+
shouldReportImportExport(
|
198
|
+
node,
|
199
|
+
importNodes,
|
200
|
+
allowSeparateTypeImports,
|
201
|
+
)
|
202
|
+
) {
|
161
203
|
messagesIds.push("import");
|
162
204
|
}
|
163
205
|
if (includeExports) {
|
164
|
-
if (
|
206
|
+
if (
|
207
|
+
shouldReportImportExport(
|
208
|
+
node,
|
209
|
+
exportNodes,
|
210
|
+
allowSeparateTypeImports,
|
211
|
+
)
|
212
|
+
) {
|
165
213
|
messagesIds.push("importAs");
|
166
214
|
}
|
167
215
|
}
|
168
216
|
} else if (declarationType === "export") {
|
169
|
-
if (
|
217
|
+
if (
|
218
|
+
shouldReportImportExport(
|
219
|
+
node,
|
220
|
+
exportNodes,
|
221
|
+
allowSeparateTypeImports,
|
222
|
+
)
|
223
|
+
) {
|
170
224
|
messagesIds.push("export");
|
171
225
|
}
|
172
|
-
if (
|
226
|
+
if (
|
227
|
+
shouldReportImportExport(
|
228
|
+
node,
|
229
|
+
importNodes,
|
230
|
+
allowSeparateTypeImports,
|
231
|
+
)
|
232
|
+
) {
|
173
233
|
messagesIds.push("exportAs");
|
174
234
|
}
|
175
235
|
}
|
@@ -196,6 +256,7 @@ function checkAndReport(
|
|
196
256
|
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
|
197
257
|
* @param {string} declarationType A declaration type can be an import or export.
|
198
258
|
* @param {boolean} includeExports Whether or not to check for exports in addition to imports.
|
259
|
+
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
|
199
260
|
* @returns {nodeCallback} A function passed to ESLint to handle the statement.
|
200
261
|
*/
|
201
262
|
function handleImportsExports(
|
@@ -203,6 +264,7 @@ function handleImportsExports(
|
|
203
264
|
modules,
|
204
265
|
declarationType,
|
205
266
|
includeExports,
|
267
|
+
allowSeparateTypeImports,
|
206
268
|
) {
|
207
269
|
return function (node) {
|
208
270
|
const module = getModule(node);
|
@@ -214,6 +276,7 @@ function handleImportsExports(
|
|
214
276
|
modules,
|
215
277
|
declarationType,
|
216
278
|
includeExports,
|
279
|
+
allowSeparateTypeImports,
|
217
280
|
);
|
218
281
|
const currentNode = { node, declarationType };
|
219
282
|
let nodes = [currentNode];
|
@@ -231,11 +294,14 @@ function handleImportsExports(
|
|
231
294
|
/** @type {import('../types').Rule.RuleModule} */
|
232
295
|
module.exports = {
|
233
296
|
meta: {
|
297
|
+
dialects: ["javascript", "typescript"],
|
298
|
+
language: "javascript",
|
234
299
|
type: "problem",
|
235
300
|
|
236
301
|
defaultOptions: [
|
237
302
|
{
|
238
303
|
includeExports: false,
|
304
|
+
allowSeparateTypeImports: false,
|
239
305
|
},
|
240
306
|
],
|
241
307
|
|
@@ -252,6 +318,9 @@ module.exports = {
|
|
252
318
|
includeExports: {
|
253
319
|
type: "boolean",
|
254
320
|
},
|
321
|
+
allowSeparateTypeImports: {
|
322
|
+
type: "boolean",
|
323
|
+
},
|
255
324
|
},
|
256
325
|
additionalProperties: false,
|
257
326
|
},
|
@@ -266,7 +335,7 @@ module.exports = {
|
|
266
335
|
},
|
267
336
|
|
268
337
|
create(context) {
|
269
|
-
const [{ includeExports }] = context.options;
|
338
|
+
const [{ includeExports, allowSeparateTypeImports }] = context.options;
|
270
339
|
const modules = new Map();
|
271
340
|
const handlers = {
|
272
341
|
ImportDeclaration: handleImportsExports(
|
@@ -274,6 +343,7 @@ module.exports = {
|
|
274
343
|
modules,
|
275
344
|
"import",
|
276
345
|
includeExports,
|
346
|
+
allowSeparateTypeImports,
|
277
347
|
),
|
278
348
|
};
|
279
349
|
|
@@ -283,12 +353,14 @@ module.exports = {
|
|
283
353
|
modules,
|
284
354
|
"export",
|
285
355
|
includeExports,
|
356
|
+
allowSeparateTypeImports,
|
286
357
|
);
|
287
358
|
handlers.ExportAllDeclaration = handleImportsExports(
|
288
359
|
context,
|
289
360
|
modules,
|
290
361
|
"export",
|
291
362
|
includeExports,
|
363
|
+
allowSeparateTypeImports,
|
292
364
|
);
|
293
365
|
}
|
294
366
|
return handlers;
|
@@ -28,12 +28,12 @@ module.exports = {
|
|
28
28
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
29
29
|
url: "https://eslint.style/guide/migration",
|
30
30
|
plugin: {
|
31
|
-
name: "@stylistic/eslint-plugin
|
32
|
-
url: "https://eslint.style
|
31
|
+
name: "@stylistic/eslint-plugin",
|
32
|
+
url: "https://eslint.style",
|
33
33
|
},
|
34
34
|
rule: {
|
35
35
|
name: "no-extra-parens",
|
36
|
-
url: "https://eslint.style/rules/
|
36
|
+
url: "https://eslint.style/rules/no-extra-parens",
|
37
37
|
},
|
38
38
|
},
|
39
39
|
],
|
@@ -31,12 +31,12 @@ module.exports = {
|
|
31
31
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
32
32
|
url: "https://eslint.style/guide/migration",
|
33
33
|
plugin: {
|
34
|
-
name: "@stylistic/eslint-plugin
|
35
|
-
url: "https://eslint.style
|
34
|
+
name: "@stylistic/eslint-plugin",
|
35
|
+
url: "https://eslint.style",
|
36
36
|
},
|
37
37
|
rule: {
|
38
38
|
name: "no-extra-semi",
|
39
|
-
url: "https://eslint.style/rules/
|
39
|
+
url: "https://eslint.style/rules/no-extra-semi",
|
40
40
|
},
|
41
41
|
},
|
42
42
|
],
|
@@ -30,12 +30,12 @@ module.exports = {
|
|
30
30
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
31
31
|
url: "https://eslint.style/guide/migration",
|
32
32
|
plugin: {
|
33
|
-
name: "@stylistic/eslint-plugin
|
34
|
-
url: "https://eslint.style
|
33
|
+
name: "@stylistic/eslint-plugin",
|
34
|
+
url: "https://eslint.style",
|
35
35
|
},
|
36
36
|
rule: {
|
37
37
|
name: "no-floating-decimal",
|
38
|
-
url: "https://eslint.style/rules/
|
38
|
+
url: "https://eslint.style/rules/no-floating-decimal",
|
39
39
|
},
|
40
40
|
},
|
41
41
|
],
|
@@ -97,12 +97,12 @@ module.exports = {
|
|
97
97
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
98
98
|
url: "https://eslint.style/guide/migration",
|
99
99
|
plugin: {
|
100
|
-
name: "@stylistic/eslint-plugin
|
101
|
-
url: "https://eslint.style
|
100
|
+
name: "@stylistic/eslint-plugin",
|
101
|
+
url: "https://eslint.style",
|
102
102
|
},
|
103
103
|
rule: {
|
104
104
|
name: "no-mixed-operators",
|
105
|
-
url: "https://eslint.style/rules/
|
105
|
+
url: "https://eslint.style/rules/no-mixed-operators",
|
106
106
|
},
|
107
107
|
},
|
108
108
|
],
|
@@ -23,12 +23,12 @@ module.exports = {
|
|
23
23
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
24
24
|
url: "https://eslint.style/guide/migration",
|
25
25
|
plugin: {
|
26
|
-
name: "@stylistic/eslint-plugin
|
27
|
-
url: "https://eslint.style
|
26
|
+
name: "@stylistic/eslint-plugin",
|
27
|
+
url: "https://eslint.style",
|
28
28
|
},
|
29
29
|
rule: {
|
30
30
|
name: "no-mixed-spaces-and-tabs",
|
31
|
-
url: "https://eslint.style/rules/
|
31
|
+
url: "https://eslint.style/rules/no-mixed-spaces-and-tabs",
|
32
32
|
},
|
33
33
|
},
|
34
34
|
],
|
@@ -26,12 +26,12 @@ module.exports = {
|
|
26
26
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
27
27
|
url: "https://eslint.style/guide/migration",
|
28
28
|
plugin: {
|
29
|
-
name: "@stylistic/eslint-plugin
|
30
|
-
url: "https://eslint.style
|
29
|
+
name: "@stylistic/eslint-plugin",
|
30
|
+
url: "https://eslint.style",
|
31
31
|
},
|
32
32
|
rule: {
|
33
33
|
name: "no-multi-spaces",
|
34
|
-
url: "https://eslint.style/rules/
|
34
|
+
url: "https://eslint.style/rules/no-multi-spaces",
|
35
35
|
},
|
36
36
|
},
|
37
37
|
],
|
@@ -24,12 +24,12 @@ module.exports = {
|
|
24
24
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
25
25
|
url: "https://eslint.style/guide/migration",
|
26
26
|
plugin: {
|
27
|
-
name: "@stylistic/eslint-plugin
|
28
|
-
url: "https://eslint.style
|
27
|
+
name: "@stylistic/eslint-plugin",
|
28
|
+
url: "https://eslint.style",
|
29
29
|
},
|
30
30
|
rule: {
|
31
31
|
name: "no-multiple-empty-lines",
|
32
|
-
url: "https://eslint.style/rules/
|
32
|
+
url: "https://eslint.style/rules/no-multiple-empty-lines",
|
33
33
|
},
|
34
34
|
},
|
35
35
|
],
|
@@ -73,10 +73,10 @@ module.exports = {
|
|
73
73
|
messages: {
|
74
74
|
restrictedObjectProperty:
|
75
75
|
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
76
|
-
"'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}",
|
76
|
+
"'{{objectName}}.{{propertyName}}' is restricted from being used.{{allowedPropertiesMessage}}{{message}}",
|
77
77
|
restrictedProperty:
|
78
78
|
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
79
|
-
"'{{propertyName}}' is restricted from being used.{{message}}",
|
79
|
+
"'{{propertyName}}' is restricted from being used.{{allowedObjectsMessage}}{{message}}",
|
80
80
|
},
|
81
81
|
},
|
82
82
|
|
@@ -155,6 +155,10 @@ module.exports = {
|
|
155
155
|
const message = matchedObjectProperty.message
|
156
156
|
? ` ${matchedObjectProperty.message}`
|
157
157
|
: "";
|
158
|
+
const allowedPropertiesMessage =
|
159
|
+
matchedObjectProperty.allowProperties
|
160
|
+
? ` Only these properties are allowed: ${matchedObjectProperty.allowProperties.join(", ")}.`
|
161
|
+
: "";
|
158
162
|
|
159
163
|
context.report({
|
160
164
|
node,
|
@@ -163,6 +167,7 @@ module.exports = {
|
|
163
167
|
objectName,
|
164
168
|
propertyName,
|
165
169
|
message,
|
170
|
+
allowedPropertiesMessage,
|
166
171
|
},
|
167
172
|
});
|
168
173
|
} else if (
|
@@ -172,6 +177,9 @@ module.exports = {
|
|
172
177
|
const message = globalMatchedProperty.message
|
173
178
|
? ` ${globalMatchedProperty.message}`
|
174
179
|
: "";
|
180
|
+
const allowedObjectsMessage = globalMatchedProperty.allowObjects
|
181
|
+
? ` Property '${propertyName}' is only allowed on these objects: ${globalMatchedProperty.allowObjects.join(", ")}.`
|
182
|
+
: "";
|
175
183
|
|
176
184
|
context.report({
|
177
185
|
node,
|
@@ -179,6 +187,7 @@ module.exports = {
|
|
179
187
|
data: {
|
180
188
|
propertyName,
|
181
189
|
message,
|
190
|
+
allowedObjectsMessage,
|
182
191
|
},
|
183
192
|
});
|
184
193
|
}
|
@@ -33,12 +33,12 @@ module.exports = {
|
|
33
33
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
34
34
|
url: "https://eslint.style/guide/migration",
|
35
35
|
plugin: {
|
36
|
-
name: "@stylistic/eslint-plugin
|
37
|
-
url: "https://eslint.style
|
36
|
+
name: "@stylistic/eslint-plugin",
|
37
|
+
url: "https://eslint.style",
|
38
38
|
},
|
39
39
|
rule: {
|
40
40
|
name: "function-call-spacing",
|
41
|
-
url: "https://eslint.style/rules/
|
41
|
+
url: "https://eslint.style/rules/function-call-spacing",
|
42
42
|
},
|
43
43
|
},
|
44
44
|
],
|
package/lib/rules/no-tabs.js
CHANGED
@@ -31,12 +31,12 @@ module.exports = {
|
|
31
31
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
32
32
|
url: "https://eslint.style/guide/migration",
|
33
33
|
plugin: {
|
34
|
-
name: "@stylistic/eslint-plugin
|
35
|
-
url: "https://eslint.style
|
34
|
+
name: "@stylistic/eslint-plugin",
|
35
|
+
url: "https://eslint.style",
|
36
36
|
},
|
37
37
|
rule: {
|
38
38
|
name: "no-tabs",
|
39
|
-
url: "https://eslint.style/rules/
|
39
|
+
url: "https://eslint.style/rules/no-tabs",
|
40
40
|
},
|
41
41
|
},
|
42
42
|
],
|
@@ -37,12 +37,12 @@ module.exports = {
|
|
37
37
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
38
38
|
url: "https://eslint.style/guide/migration",
|
39
39
|
plugin: {
|
40
|
-
name: "@stylistic/eslint-plugin
|
41
|
-
url: "https://eslint.style
|
40
|
+
name: "@stylistic/eslint-plugin",
|
41
|
+
url: "https://eslint.style",
|
42
42
|
},
|
43
43
|
rule: {
|
44
44
|
name: "no-trailing-spaces",
|
45
|
-
url: "https://eslint.style/rules/
|
45
|
+
url: "https://eslint.style/rules/no-trailing-spaces",
|
46
46
|
},
|
47
47
|
},
|
48
48
|
],
|
@@ -1152,7 +1152,7 @@ module.exports = {
|
|
1152
1152
|
|
1153
1153
|
// fix for { a: { b } }
|
1154
1154
|
if (parentNode.parent.type === "ObjectPattern") {
|
1155
|
-
// fix for unused variables in
|
1155
|
+
// fix for unused variables in destructured object with single property in variable declaration and function parameter
|
1156
1156
|
if (parentNode.parent.properties.length === 1) {
|
1157
1157
|
return fixVariables(parentNode.parent);
|
1158
1158
|
}
|
@@ -29,12 +29,12 @@ module.exports = {
|
|
29
29
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
30
30
|
url: "https://eslint.style/guide/migration",
|
31
31
|
plugin: {
|
32
|
-
name: "@stylistic/eslint-plugin
|
33
|
-
url: "https://eslint.style
|
32
|
+
name: "@stylistic/eslint-plugin",
|
33
|
+
url: "https://eslint.style",
|
34
34
|
},
|
35
35
|
rule: {
|
36
36
|
name: "no-whitespace-before-property",
|
37
|
-
url: "https://eslint.style/rules/
|
37
|
+
url: "https://eslint.style/rules/no-whitespace-before-property",
|
38
38
|
},
|
39
39
|
},
|
40
40
|
],
|
@@ -25,12 +25,12 @@ module.exports = {
|
|
25
25
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
26
26
|
url: "https://eslint.style/guide/migration",
|
27
27
|
plugin: {
|
28
|
-
name: "@stylistic/eslint-plugin
|
29
|
-
url: "https://eslint.style
|
28
|
+
name: "@stylistic/eslint-plugin",
|
29
|
+
url: "https://eslint.style",
|
30
30
|
},
|
31
31
|
rule: {
|
32
32
|
name: "nonblock-statement-body-position",
|
33
|
-
url: "https://eslint.style/rules/
|
33
|
+
url: "https://eslint.style/rules/nonblock-statement-body-position",
|
34
34
|
},
|
35
35
|
},
|
36
36
|
],
|
@@ -169,12 +169,12 @@ module.exports = {
|
|
169
169
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
170
170
|
url: "https://eslint.style/guide/migration",
|
171
171
|
plugin: {
|
172
|
-
name: "@stylistic/eslint-plugin
|
173
|
-
url: "https://eslint.style
|
172
|
+
name: "@stylistic/eslint-plugin",
|
173
|
+
url: "https://eslint.style",
|
174
174
|
},
|
175
175
|
rule: {
|
176
176
|
name: "object-curly-newline",
|
177
|
-
url: "https://eslint.style/rules/
|
177
|
+
url: "https://eslint.style/rules/object-curly-newline",
|
178
178
|
},
|
179
179
|
},
|
180
180
|
],
|
@@ -25,12 +25,12 @@ module.exports = {
|
|
25
25
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
26
26
|
url: "https://eslint.style/guide/migration",
|
27
27
|
plugin: {
|
28
|
-
name: "@stylistic/eslint-plugin
|
29
|
-
url: "https://eslint.style
|
28
|
+
name: "@stylistic/eslint-plugin",
|
29
|
+
url: "https://eslint.style",
|
30
30
|
},
|
31
31
|
rule: {
|
32
32
|
name: "object-curly-spacing",
|
33
|
-
url: "https://eslint.style/rules/
|
33
|
+
url: "https://eslint.style/rules/object-curly-spacing",
|
34
34
|
},
|
35
35
|
},
|
36
36
|
],
|
@@ -24,12 +24,12 @@ module.exports = {
|
|
24
24
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
25
25
|
url: "https://eslint.style/guide/migration",
|
26
26
|
plugin: {
|
27
|
-
name: "@stylistic/eslint-plugin
|
28
|
-
url: "https://eslint.style
|
27
|
+
name: "@stylistic/eslint-plugin",
|
28
|
+
url: "https://eslint.style",
|
29
29
|
},
|
30
30
|
rule: {
|
31
31
|
name: "object-property-newline",
|
32
|
-
url: "https://eslint.style/rules/
|
32
|
+
url: "https://eslint.style/rules/object-property-newline",
|
33
33
|
},
|
34
34
|
},
|
35
35
|
],
|
@@ -23,12 +23,12 @@ module.exports = {
|
|
23
23
|
"ESLint Stylistic now maintains deprecated stylistic core rules.",
|
24
24
|
url: "https://eslint.style/guide/migration",
|
25
25
|
plugin: {
|
26
|
-
name: "@stylistic/eslint-plugin
|
27
|
-
url: "https://eslint.style
|
26
|
+
name: "@stylistic/eslint-plugin",
|
27
|
+
url: "https://eslint.style",
|
28
28
|
},
|
29
29
|
rule: {
|
30
30
|
name: "one-var-declaration-per-line",
|
31
|
-
url: "https://eslint.style/rules/
|
31
|
+
url: "https://eslint.style/rules/one-var-declaration-per-line",
|
32
32
|
},
|
33
33
|
},
|
34
34
|
],
|