eslint 9.15.0 → 9.16.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/lib/rules/accessor-pairs.js +5 -4
- 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-plusplus.js +3 -1
- package/lib/rules/no-promise-executor-return.js +3 -1
- 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-use-before-define.js +2 -1
- 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-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/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/types/rules/stylistic-issues.d.ts +4 -0
- package/package.json +4 -4
@@ -177,10 +177,11 @@ module.exports = {
|
|
177
177
|
}
|
178
178
|
},
|
179
179
|
create(context) {
|
180
|
-
const [
|
181
|
-
|
182
|
-
|
183
|
-
|
180
|
+
const [{
|
181
|
+
getWithoutSet: checkGetWithoutSet,
|
182
|
+
setWithoutGet: checkSetWithoutGet,
|
183
|
+
enforceForClassMembers
|
184
|
+
}] = context.options;
|
184
185
|
const sourceCode = context.sourceCode;
|
185
186
|
|
186
187
|
/**
|
package/lib/rules/id-length.js
CHANGED
package/lib/rules/id-match.js
CHANGED
@@ -20,7 +20,12 @@ module.exports = {
|
|
20
20
|
meta: {
|
21
21
|
type: "suggestion",
|
22
22
|
|
23
|
-
defaultOptions: ["^.+$", {
|
23
|
+
defaultOptions: ["^.+$", {
|
24
|
+
classFields: false,
|
25
|
+
ignoreDestructuring: false,
|
26
|
+
onlyDeclarations: false,
|
27
|
+
properties: false
|
28
|
+
}],
|
24
29
|
|
25
30
|
docs: {
|
26
31
|
description: "Require identifiers to match a specified regular expression",
|
package/lib/rules/new-cap.js
CHANGED
@@ -118,7 +118,7 @@ module.exports = {
|
|
118
118
|
|
119
119
|
create(context) {
|
120
120
|
const [config] = context.options;
|
121
|
-
const skipProperties = config.properties
|
121
|
+
const skipProperties = !config.properties;
|
122
122
|
|
123
123
|
const newIsCapExceptions = config.newIsCapExceptions.reduce(invert, {});
|
124
124
|
const newIsCapExceptionPattern = config.newIsCapExceptionPattern ? new RegExp(config.newIsCapExceptionPattern, "u") : null;
|
package/lib/rules/no-bitwise.js
CHANGED
package/lib/rules/no-eval.js
CHANGED
@@ -47,7 +47,7 @@ module.exports = {
|
|
47
47
|
meta: {
|
48
48
|
type: "problem",
|
49
49
|
|
50
|
-
defaultOptions: ["functions"],
|
50
|
+
defaultOptions: ["functions", { blockScopedFunctions: "allow" }],
|
51
51
|
|
52
52
|
docs: {
|
53
53
|
description: "Disallow variable or `function` declarations in nested blocks",
|
@@ -77,10 +77,10 @@ module.exports = {
|
|
77
77
|
|
78
78
|
create(context) {
|
79
79
|
const both = context.options[0] === "both";
|
80
|
+
const { blockScopedFunctions } = context.options[1];
|
80
81
|
|
81
82
|
const sourceCode = context.sourceCode;
|
82
83
|
const ecmaVersion = context.languageOptions.ecmaVersion;
|
83
|
-
const blockScopedFunctions = context.options[1]?.blockScopedFunctions ?? "allow";
|
84
84
|
|
85
85
|
/**
|
86
86
|
* Ensure that a given node is at a program or function body's root.
|
package/lib/rules/no-plusplus.js
CHANGED
package/lib/rules/no-shadow.js
CHANGED
@@ -31,7 +31,9 @@ module.exports = {
|
|
31
31
|
|
32
32
|
defaultOptions: [{
|
33
33
|
allow: [],
|
34
|
-
|
34
|
+
builtinGlobals: false,
|
35
|
+
hoist: "functions",
|
36
|
+
ignoreOnInitialization: false
|
35
37
|
}],
|
36
38
|
|
37
39
|
docs: {
|
@@ -45,7 +47,7 @@ module.exports = {
|
|
45
47
|
type: "object",
|
46
48
|
properties: {
|
47
49
|
builtinGlobals: { type: "boolean" },
|
48
|
-
hoist: { enum: ["all", "functions", "never"]
|
50
|
+
hoist: { enum: ["all", "functions", "never"] },
|
49
51
|
allow: {
|
50
52
|
type: "array",
|
51
53
|
items: {
|
package/lib/rules/no-undef.js
CHANGED
@@ -23,7 +23,9 @@ module.exports = {
|
|
23
23
|
meta: {
|
24
24
|
type: "problem",
|
25
25
|
|
26
|
-
defaultOptions: [{
|
26
|
+
defaultOptions: [{
|
27
|
+
disallowArithmeticOperators: false
|
28
|
+
}],
|
27
29
|
|
28
30
|
docs: {
|
29
31
|
description: "Disallow use of optional chaining in contexts where the `undefined` value is not allowed",
|
@@ -120,7 +120,7 @@ module.exports = {
|
|
120
120
|
},
|
121
121
|
create(context) {
|
122
122
|
const sourceCode = context.sourceCode;
|
123
|
-
const enforceForClassMembers = context.options
|
123
|
+
const [{ enforceForClassMembers }] = context.options;
|
124
124
|
|
125
125
|
/**
|
126
126
|
* Reports a given node if it violated this rule.
|
@@ -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;
|
@@ -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`",
|
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.16.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.16.0",
|
106
106
|
"@eslint/plugin-kit": "^0.2.3",
|
107
107
|
"@humanfs/node": "^0.16.6",
|
108
108
|
"@humanwhocodes/module-importer": "^1.0.1",
|
@@ -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",
|