eslint 9.15.0 → 9.17.0
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/linter/source-code-fixer.js +1 -1
- package/lib/rules/accessor-pairs.js +5 -4
- package/lib/rules/default-case-last.js +2 -2
- package/lib/rules/for-direction.js +2 -2
- package/lib/rules/getter-return.js +3 -1
- package/lib/rules/id-length.js +2 -1
- package/lib/rules/id-match.js +6 -1
- package/lib/rules/new-cap.js +1 -1
- package/lib/rules/no-bitwise.js +4 -1
- package/lib/rules/no-compare-neg-zero.js +1 -1
- package/lib/rules/no-duplicate-imports.js +3 -1
- package/lib/rules/no-empty-pattern.js +3 -1
- package/lib/rules/no-eval.js +3 -1
- package/lib/rules/no-implicit-globals.js +3 -1
- package/lib/rules/no-inner-declarations.js +2 -2
- package/lib/rules/no-multi-assign.js +3 -1
- package/lib/rules/no-param-reassign.js +2 -2
- package/lib/rules/no-plusplus.js +3 -1
- package/lib/rules/no-promise-executor-return.js +3 -1
- package/lib/rules/no-script-url.js +3 -3
- package/lib/rules/no-shadow.js +4 -2
- package/lib/rules/no-undef.js +3 -1
- package/lib/rules/no-underscore-dangle.js +1 -0
- package/lib/rules/no-unsafe-negation.js +3 -1
- package/lib/rules/no-unsafe-optional-chaining.js +3 -1
- package/lib/rules/no-unused-vars.js +613 -2
- package/lib/rules/no-use-before-define.js +2 -1
- package/lib/rules/no-useless-assignment.js +9 -0
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-useless-rename.js +5 -1
- package/lib/rules/no-void.js +3 -1
- package/lib/rules/prefer-const.js +6 -4
- package/lib/rules/prefer-object-spread.js +2 -2
- package/lib/rules/prefer-promise-reject-errors.js +3 -1
- package/lib/rules/prefer-regex-literals.js +3 -1
- package/lib/rules/require-atomic-updates.js +3 -1
- package/lib/rules/require-unicode-regexp.js +2 -2
- package/lib/rules/sort-keys.js +10 -1
- package/lib/rules/sort-vars.js +4 -3
- package/lib/rules/use-isnan.js +1 -2
- package/lib/rules/valid-typeof.js +4 -3
- package/lib/shared/flags.js +1 -1
- package/lib/types/rules/stylistic-issues.d.ts +4 -0
- package/package.json +6 -6
@@ -20,7 +20,11 @@ module.exports = {
|
|
20
20
|
meta: {
|
21
21
|
type: "suggestion",
|
22
22
|
|
23
|
-
defaultOptions: [{
|
23
|
+
defaultOptions: [{
|
24
|
+
ignoreDestructuring: false,
|
25
|
+
ignoreImport: false,
|
26
|
+
ignoreExport: false
|
27
|
+
}],
|
24
28
|
|
25
29
|
docs: {
|
26
30
|
description: "Disallow renaming import, export, and destructured assignments to the same name",
|
package/lib/rules/no-void.js
CHANGED
@@ -331,7 +331,10 @@ module.exports = {
|
|
331
331
|
meta: {
|
332
332
|
type: "suggestion",
|
333
333
|
|
334
|
-
defaultOptions: [{
|
334
|
+
defaultOptions: [{
|
335
|
+
destructuring: "any",
|
336
|
+
ignoreReadBeforeAssign: false
|
337
|
+
}],
|
335
338
|
|
336
339
|
docs: {
|
337
340
|
description: "Require `const` declarations for variables that are never reassigned after declared",
|
@@ -357,10 +360,9 @@ module.exports = {
|
|
357
360
|
},
|
358
361
|
|
359
362
|
create(context) {
|
360
|
-
const [
|
363
|
+
const [{ destructuring, ignoreReadBeforeAssign }] = context.options;
|
364
|
+
const shouldMatchAnyDestructuredVariable = destructuring !== "all";
|
361
365
|
const sourceCode = context.sourceCode;
|
362
|
-
const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";
|
363
|
-
const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;
|
364
366
|
const variables = [];
|
365
367
|
let reportCount = 0;
|
366
368
|
let checkedId = null;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview
|
2
|
+
* @fileoverview Rule to disallow using `Object.assign` with an object literal as the first argument and prefer the use of object spread instead
|
3
3
|
* @author Sharmila Jesupaul
|
4
4
|
*/
|
5
5
|
|
@@ -246,7 +246,7 @@ module.exports = {
|
|
246
246
|
|
247
247
|
docs: {
|
248
248
|
description:
|
249
|
-
"Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead",
|
249
|
+
"Disallow using `Object.assign` with an object literal as the first argument and prefer the use of object spread instead",
|
250
250
|
recommended: false,
|
251
251
|
url: "https://eslint.org/docs/latest/rules/prefer-object-spread"
|
252
252
|
},
|
@@ -112,7 +112,9 @@ module.exports = {
|
|
112
112
|
meta: {
|
113
113
|
type: "suggestion",
|
114
114
|
|
115
|
-
defaultOptions: [{
|
115
|
+
defaultOptions: [{
|
116
|
+
disallowRedundantWrapping: false
|
117
|
+
}],
|
116
118
|
|
117
119
|
docs: {
|
118
120
|
description: "Disallow use of the `RegExp` constructor in favor of regular expression literals",
|
@@ -170,7 +170,9 @@ module.exports = {
|
|
170
170
|
meta: {
|
171
171
|
type: "problem",
|
172
172
|
|
173
|
-
defaultOptions: [{
|
173
|
+
defaultOptions: [{
|
174
|
+
allowProperties: false
|
175
|
+
}],
|
174
176
|
|
175
177
|
docs: {
|
176
178
|
description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Rule to enforce the use of `u` flag on
|
2
|
+
* @fileoverview Rule to enforce the use of `u` or `v` flag on regular expressions.
|
3
3
|
* @author Toru Nagashima
|
4
4
|
*/
|
5
5
|
|
@@ -48,7 +48,7 @@ module.exports = {
|
|
48
48
|
type: "suggestion",
|
49
49
|
|
50
50
|
docs: {
|
51
|
-
description: "Enforce the use of `u` or `v` flag on
|
51
|
+
description: "Enforce the use of `u` or `v` flag on regular expressions",
|
52
52
|
recommended: false,
|
53
53
|
url: "https://eslint.org/docs/latest/rules/require-unicode-regexp"
|
54
54
|
},
|
package/lib/rules/sort-keys.js
CHANGED
@@ -83,6 +83,7 @@ module.exports = {
|
|
83
83
|
defaultOptions: ["asc", {
|
84
84
|
allowLineSeparatedGroups: false,
|
85
85
|
caseSensitive: true,
|
86
|
+
ignoreComputedKeys: false,
|
86
87
|
minKeys: 2,
|
87
88
|
natural: false
|
88
89
|
}],
|
@@ -112,6 +113,9 @@ module.exports = {
|
|
112
113
|
},
|
113
114
|
allowLineSeparatedGroups: {
|
114
115
|
type: "boolean"
|
116
|
+
},
|
117
|
+
ignoreComputedKeys: {
|
118
|
+
type: "boolean"
|
115
119
|
}
|
116
120
|
},
|
117
121
|
additionalProperties: false
|
@@ -124,7 +128,7 @@ module.exports = {
|
|
124
128
|
},
|
125
129
|
|
126
130
|
create(context) {
|
127
|
-
const [order, { caseSensitive, natural, minKeys, allowLineSeparatedGroups }] = context.options;
|
131
|
+
const [order, { caseSensitive, natural, minKeys, allowLineSeparatedGroups, ignoreComputedKeys }] = context.options;
|
128
132
|
const insensitive = !caseSensitive;
|
129
133
|
const isValidOrder = isValidOrders[
|
130
134
|
order + (insensitive ? "I" : "") + (natural ? "N" : "")
|
@@ -160,6 +164,11 @@ module.exports = {
|
|
160
164
|
return;
|
161
165
|
}
|
162
166
|
|
167
|
+
if (ignoreComputedKeys && node.computed) {
|
168
|
+
stack.prevName = null; // reset sort
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
|
163
172
|
const prevName = stack.prevName;
|
164
173
|
const numKeys = stack.numKeys;
|
165
174
|
const thisName = getPropertyName(node);
|
package/lib/rules/sort-vars.js
CHANGED
@@ -14,7 +14,9 @@ module.exports = {
|
|
14
14
|
meta: {
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
|
-
defaultOptions: [{
|
17
|
+
defaultOptions: [{
|
18
|
+
ignoreCase: false
|
19
|
+
}],
|
18
20
|
|
19
21
|
docs: {
|
20
22
|
description: "Require variables within the same declaration block to be sorted",
|
@@ -27,8 +29,7 @@ module.exports = {
|
|
27
29
|
type: "object",
|
28
30
|
properties: {
|
29
31
|
ignoreCase: {
|
30
|
-
type: "boolean"
|
31
|
-
default: false
|
32
|
+
type: "boolean"
|
32
33
|
}
|
33
34
|
},
|
34
35
|
additionalProperties: false
|
package/lib/rules/use-isnan.js
CHANGED
@@ -84,8 +84,7 @@ module.exports = {
|
|
84
84
|
|
85
85
|
create(context) {
|
86
86
|
|
87
|
-
const enforceForSwitchCase
|
88
|
-
const enforceForIndexOf = context.options[0] && context.options[0].enforceForIndexOf;
|
87
|
+
const [{ enforceForIndexOf, enforceForSwitchCase }] = context.options;
|
89
88
|
const sourceCode = context.sourceCode;
|
90
89
|
|
91
90
|
const fixableOperators = new Set(["==", "===", "!=", "!=="]);
|
@@ -19,7 +19,9 @@ module.exports = {
|
|
19
19
|
meta: {
|
20
20
|
type: "problem",
|
21
21
|
|
22
|
-
defaultOptions: [{
|
22
|
+
defaultOptions: [{
|
23
|
+
requireStringLiterals: false
|
24
|
+
}],
|
23
25
|
|
24
26
|
docs: {
|
25
27
|
description: "Enforce comparing `typeof` expressions against valid strings",
|
@@ -34,8 +36,7 @@ module.exports = {
|
|
34
36
|
type: "object",
|
35
37
|
properties: {
|
36
38
|
requireStringLiterals: {
|
37
|
-
type: "boolean"
|
38
|
-
default: false
|
39
|
+
type: "boolean"
|
39
40
|
}
|
40
41
|
},
|
41
42
|
additionalProperties: false
|
package/lib/shared/flags.js
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
*/
|
11
11
|
const activeFlags = new Map([
|
12
12
|
["test_only", "Used only for testing."],
|
13
|
-
["unstable_config_lookup_from_file", "Look up eslint.config.js from the file being linted."],
|
13
|
+
["unstable_config_lookup_from_file", "Look up `eslint.config.js` from the file being linted."],
|
14
14
|
["unstable_ts_config", "Enable TypeScript configuration files."]
|
15
15
|
]);
|
16
16
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.17.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"type": "commonjs",
|
@@ -102,7 +102,7 @@
|
|
102
102
|
"@eslint/config-array": "^0.19.0",
|
103
103
|
"@eslint/core": "^0.9.0",
|
104
104
|
"@eslint/eslintrc": "^3.2.0",
|
105
|
-
"@eslint/js": "9.
|
105
|
+
"@eslint/js": "9.17.0",
|
106
106
|
"@eslint/plugin-kit": "^0.2.3",
|
107
107
|
"@humanfs/node": "^0.16.6",
|
108
108
|
"@humanwhocodes/module-importer": "^1.0.1",
|
@@ -111,7 +111,7 @@
|
|
111
111
|
"@types/json-schema": "^7.0.15",
|
112
112
|
"ajv": "^6.12.4",
|
113
113
|
"chalk": "^4.0.0",
|
114
|
-
"cross-spawn": "^7.0.
|
114
|
+
"cross-spawn": "^7.0.6",
|
115
115
|
"debug": "^4.3.2",
|
116
116
|
"escape-string-regexp": "^4.0.0",
|
117
117
|
"eslint-scope": "^8.2.0",
|
@@ -133,10 +133,10 @@
|
|
133
133
|
"optionator": "^0.9.3"
|
134
134
|
},
|
135
135
|
"devDependencies": {
|
136
|
-
"@arethetypeswrong/cli": "^0.
|
136
|
+
"@arethetypeswrong/cli": "^0.17.0",
|
137
137
|
"@babel/core": "^7.4.3",
|
138
138
|
"@babel/preset-env": "^7.4.3",
|
139
|
-
"@eslint/json": "^0.
|
139
|
+
"@eslint/json": "^0.8.0",
|
140
140
|
"@trunkio/launcher": "^1.3.0",
|
141
141
|
"@types/node": "^20.11.5",
|
142
142
|
"@typescript-eslint/parser": "^8.4.0",
|
@@ -154,7 +154,7 @@
|
|
154
154
|
"eslint": "file:.",
|
155
155
|
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
156
156
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
157
|
-
"eslint-plugin-expect-type": "^0.
|
157
|
+
"eslint-plugin-expect-type": "^0.6.0",
|
158
158
|
"eslint-plugin-yml": "^1.14.0",
|
159
159
|
"eslint-release": "^3.3.0",
|
160
160
|
"eslint-rule-composer": "^0.3.0",
|