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
package/README.md
CHANGED
@@ -300,7 +300,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
|
300
300
|
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
301
301
|
<p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
302
302
|
<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
303
|
-
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
303
|
+
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465?v=4" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
304
304
|
<h3>Technology Sponsors</h3>
|
305
305
|
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
306
306
|
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
@@ -107,7 +107,7 @@ SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) {
|
|
107
107
|
}
|
108
108
|
|
109
109
|
messages.forEach(problem => {
|
110
|
-
if (Object.hasOwn(problem, "fix")) {
|
110
|
+
if (Object.hasOwn(problem, "fix") && problem.fix) {
|
111
111
|
fixes.push(problem);
|
112
112
|
} else {
|
113
113
|
remainingMessages.push(problem);
|
@@ -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
|
/**
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Rule to enforce default clauses in switch statements to be last
|
2
|
+
* @fileoverview Rule to enforce `default` clauses in switch statements to be last
|
3
3
|
* @author Milos Djermanovic
|
4
4
|
*/
|
5
5
|
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "Enforce default clauses in switch statements to be last",
|
18
|
+
description: "Enforce `default` clauses in switch statements to be last",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/latest/rules/default-case-last"
|
21
21
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview enforce
|
2
|
+
* @fileoverview enforce `for` loop update clause moving the counter in the right direction.(for-direction)
|
3
3
|
* @author Aladdin-ADD<hh_2013@foxmail.com>
|
4
4
|
*/
|
5
5
|
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "problem",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "Enforce
|
24
|
+
description: "Enforce `for` loop update clause moving the counter in the right direction",
|
25
25
|
recommended: true,
|
26
26
|
url: "https://eslint.org/docs/latest/rules/for-direction"
|
27
27
|
},
|
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.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Disallow
|
2
|
+
* @fileoverview Disallow reassigning function parameters.
|
3
3
|
* @author Nat Burns
|
4
4
|
*/
|
5
5
|
"use strict";
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "suggestion",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "Disallow reassigning
|
19
|
+
description: "Disallow reassigning function parameters",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/latest/rules/no-param-reassign"
|
22
22
|
},
|
package/lib/rules/no-plusplus.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @fileoverview Rule to
|
2
|
+
* @fileoverview Rule to disallow `javascript:` URLs
|
3
3
|
* @author Ilya Volodin
|
4
4
|
*/
|
5
5
|
/* eslint no-script-url: 0 -- Code is checking to report such URLs */
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
type: "suggestion",
|
19
19
|
|
20
20
|
docs: {
|
21
|
-
description: "Disallow `javascript:`
|
21
|
+
description: "Disallow `javascript:` URLs",
|
22
22
|
recommended: false,
|
23
23
|
url: "https://eslint.org/docs/latest/rules/no-script-url"
|
24
24
|
},
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
33
33
|
create(context) {
|
34
34
|
|
35
35
|
/**
|
36
|
-
* Check whether a node's static value starts with
|
36
|
+
* Check whether a node's static value starts with `javascript:` or not.
|
37
37
|
* And report an error for unexpected script URL.
|
38
38
|
* @param {ASTNode} node node to check
|
39
39
|
* @returns {void}
|
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",
|