eslint 10.4.0 → 10.4.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
CHANGED
|
@@ -360,7 +360,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
|
|
360
360
|
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a></p><h3>Gold Sponsors</h3>
|
|
361
361
|
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a></p><h3>Silver Sponsors</h3>
|
|
362
362
|
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/d472863/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/2d6c3b6/logo.png" alt="Liftoff" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
|
363
|
-
<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://opensource.sap.com"><img src="https://avatars.githubusercontent.com/u/2531208" alt="SAP" height="32"></a> <a href="https://www.crawljobs.com/"><img src="https://images.opencollective.com/crawljobs-poland/fa43a17/logo.png" alt="CrawlJobs" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://depot.dev"><img src="https://images.opencollective.com/depot/39125a1/logo.png" alt="Depot" 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" alt="GitBook" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://citadel.co.jp"><img src="https://avatars.githubusercontent.com/u/75781367" alt="Citadel AI" height="32"></a
|
|
363
|
+
<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://opensource.sap.com"><img src="https://avatars.githubusercontent.com/u/2531208" alt="SAP" height="32"></a> <a href="https://www.crawljobs.com/"><img src="https://images.opencollective.com/crawljobs-poland/fa43a17/logo.png" alt="CrawlJobs" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://depot.dev"><img src="https://images.opencollective.com/depot/39125a1/logo.png" alt="Depot" 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" alt="GitBook" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://citadel.co.jp"><img src="https://avatars.githubusercontent.com/u/75781367" alt="Citadel AI" height="32"></a></p>
|
|
364
364
|
<h3>Technology Sponsors</h3>
|
|
365
365
|
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.
|
|
366
366
|
<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>
|
package/bin/eslint.js
CHANGED
|
@@ -61,6 +61,32 @@ function readStdin() {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Spawns an external command and propagates its exit status.
|
|
66
|
+
* @param {string} command The command to run.
|
|
67
|
+
* @param {string[]} args The command arguments.
|
|
68
|
+
* @throws {Error} If the command cannot be spawned.
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
function spawnExternalCommand(command, args) {
|
|
72
|
+
const spawn = require("cross-spawn");
|
|
73
|
+
const result = spawn.sync(command, args, {
|
|
74
|
+
encoding: "utf8",
|
|
75
|
+
stdio: "inherit",
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (result.error) {
|
|
79
|
+
throw result.error;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (result.signal) {
|
|
83
|
+
process.kill(process.pid, result.signal);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
process.exitCode = result.status ?? 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
64
90
|
/**
|
|
65
91
|
* Get the error message of a given value.
|
|
66
92
|
* @param {any} error The value to get.
|
|
@@ -146,12 +172,7 @@ ${getErrorMessage(error)}`;
|
|
|
146
172
|
"You can also run this command directly using 'npm init @eslint/config@latest'.",
|
|
147
173
|
);
|
|
148
174
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
spawn.sync("npm", ["init", "@eslint/config@latest"], {
|
|
152
|
-
encoding: "utf8",
|
|
153
|
-
stdio: "inherit",
|
|
154
|
-
});
|
|
175
|
+
spawnExternalCommand("npm", ["init", "@eslint/config@latest"]);
|
|
155
176
|
return;
|
|
156
177
|
}
|
|
157
178
|
|
|
@@ -161,12 +182,7 @@ ${getErrorMessage(error)}`;
|
|
|
161
182
|
"You can also run this command directly using 'npx @eslint/mcp@latest'.",
|
|
162
183
|
);
|
|
163
184
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
spawn.sync("npx", ["@eslint/mcp@latest"], {
|
|
167
|
-
encoding: "utf8",
|
|
168
|
-
stdio: "inherit",
|
|
169
|
-
});
|
|
185
|
+
spawnExternalCommand("npx", ["@eslint/mcp@latest"]);
|
|
170
186
|
return;
|
|
171
187
|
}
|
|
172
188
|
|
|
@@ -617,7 +617,7 @@ function processCodePathToExit(analyzer, node) {
|
|
|
617
617
|
|
|
618
618
|
case "Identifier":
|
|
619
619
|
if (isIdentifierReference(node)) {
|
|
620
|
-
state.
|
|
620
|
+
state.makeFirstThrowablePathInTryOrCatchBlock();
|
|
621
621
|
dontForward = true;
|
|
622
622
|
}
|
|
623
623
|
break;
|
|
@@ -626,7 +626,7 @@ function processCodePathToExit(analyzer, node) {
|
|
|
626
626
|
case "ImportExpression":
|
|
627
627
|
case "MemberExpression":
|
|
628
628
|
case "NewExpression":
|
|
629
|
-
state.
|
|
629
|
+
state.makeFirstThrowablePathInTryOrCatchBlock();
|
|
630
630
|
break;
|
|
631
631
|
|
|
632
632
|
case "YieldExpression":
|
|
@@ -1772,11 +1772,12 @@ class CodePathState {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
|
|
1774
1774
|
/**
|
|
1775
|
-
* Makes a code path segment from the first throwable node to the `catch`
|
|
1776
|
-
* block or the `finally` block
|
|
1775
|
+
* Makes a code path segment from the first throwable node in a `try` block to the `catch`
|
|
1776
|
+
* block or the `finally` block or from the first throwable node in a `catch` block
|
|
1777
|
+
* to the `finally` block.
|
|
1777
1778
|
* @returns {void}
|
|
1778
1779
|
*/
|
|
1779
|
-
|
|
1780
|
+
makeFirstThrowablePathInTryOrCatchBlock() {
|
|
1780
1781
|
const forkContext = this.forkContext;
|
|
1781
1782
|
|
|
1782
1783
|
if (!forkContext.reachable) {
|
|
@@ -1785,10 +1786,13 @@ class CodePathState {
|
|
|
1785
1786
|
|
|
1786
1787
|
const context = getThrowContext(this);
|
|
1787
1788
|
|
|
1789
|
+
if (context === this || !context.thrownForkContext.empty) {
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1788
1793
|
if (
|
|
1789
|
-
context
|
|
1790
|
-
context.position !== "
|
|
1791
|
-
!context.thrownForkContext.empty
|
|
1794
|
+
context.position !== "try" &&
|
|
1795
|
+
(context.position !== "catch" || !context.hasFinalizer)
|
|
1792
1796
|
) {
|
|
1793
1797
|
return;
|
|
1794
1798
|
}
|
|
@@ -323,6 +323,24 @@ module.exports = {
|
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
const functionToken = sourceCode.getFirstToken(
|
|
327
|
+
node,
|
|
328
|
+
node.async ? 1 : 0,
|
|
329
|
+
);
|
|
330
|
+
const leftParenToken = sourceCode.getTokenAfter(
|
|
331
|
+
functionToken,
|
|
332
|
+
astUtils.isOpeningParenToken,
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
if (node.async) {
|
|
336
|
+
if (
|
|
337
|
+
functionToken.loc.end.line <
|
|
338
|
+
leftParenToken.loc.start.line
|
|
339
|
+
) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
326
344
|
// Remove `.bind(this)` if exists.
|
|
327
345
|
if (callbackInfo.isLexicalThis) {
|
|
328
346
|
const memberNode = node.parent;
|
|
@@ -375,14 +393,6 @@ module.exports = {
|
|
|
375
393
|
}
|
|
376
394
|
|
|
377
395
|
// Convert the function expression to an arrow function.
|
|
378
|
-
const functionToken = sourceCode.getFirstToken(
|
|
379
|
-
node,
|
|
380
|
-
node.async ? 1 : 0,
|
|
381
|
-
);
|
|
382
|
-
const leftParenToken = sourceCode.getTokenAfter(
|
|
383
|
-
functionToken,
|
|
384
|
-
astUtils.isOpeningParenToken,
|
|
385
|
-
);
|
|
386
396
|
const tokenBeforeBody = sourceCode.getTokenBefore(
|
|
387
397
|
node.body,
|
|
388
398
|
);
|
package/lib/types/index.d.ts
CHANGED
|
@@ -723,6 +723,22 @@ export namespace Rule {
|
|
|
723
723
|
| "class-field-initializer"
|
|
724
724
|
| "class-static-block";
|
|
725
725
|
|
|
726
|
+
interface CodePathSegmentTraversalController {
|
|
727
|
+
skip(): void;
|
|
728
|
+
break(): void;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
type CodePathSegmentTraversalCallback = (
|
|
732
|
+
this: CodePath,
|
|
733
|
+
segment: CodePathSegment,
|
|
734
|
+
controller: CodePathSegmentTraversalController,
|
|
735
|
+
) => void;
|
|
736
|
+
|
|
737
|
+
interface CodePathTraversalOptions {
|
|
738
|
+
first?: CodePathSegment | undefined;
|
|
739
|
+
last?: CodePathSegment | undefined;
|
|
740
|
+
}
|
|
741
|
+
|
|
726
742
|
interface CodePath {
|
|
727
743
|
id: string;
|
|
728
744
|
origin: CodePathOrigin;
|
|
@@ -732,12 +748,19 @@ export namespace Rule {
|
|
|
732
748
|
thrownSegments: CodePathSegment[];
|
|
733
749
|
upper: CodePath | null;
|
|
734
750
|
childCodePaths: CodePath[];
|
|
751
|
+
traverseSegments(callback: CodePathSegmentTraversalCallback): void;
|
|
752
|
+
traverseSegments(
|
|
753
|
+
options: CodePathTraversalOptions,
|
|
754
|
+
callback: CodePathSegmentTraversalCallback,
|
|
755
|
+
): void;
|
|
735
756
|
}
|
|
736
757
|
|
|
737
758
|
interface CodePathSegment {
|
|
738
759
|
id: string;
|
|
739
760
|
nextSegments: CodePathSegment[];
|
|
740
761
|
prevSegments: CodePathSegment[];
|
|
762
|
+
allNextSegments: CodePathSegment[];
|
|
763
|
+
allPrevSegments: CodePathSegment[];
|
|
741
764
|
reachable: boolean;
|
|
742
765
|
}
|
|
743
766
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"@eslint/config-array": "^0.23.5",
|
|
125
125
|
"@eslint/config-helpers": "^0.6.0",
|
|
126
126
|
"@eslint/core": "^1.2.1",
|
|
127
|
-
"@eslint/plugin-kit": "^0.7.
|
|
127
|
+
"@eslint/plugin-kit": "^0.7.2",
|
|
128
128
|
"@humanfs/node": "^0.16.6",
|
|
129
129
|
"@humanwhocodes/module-importer": "^1.0.1",
|
|
130
130
|
"@humanwhocodes/retry": "^0.4.2",
|
|
@@ -228,5 +228,10 @@
|
|
|
228
228
|
"license": "MIT",
|
|
229
229
|
"engines": {
|
|
230
230
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
|
231
|
+
},
|
|
232
|
+
"overrides": {
|
|
233
|
+
"@arethetypeswrong/core": {
|
|
234
|
+
"fflate": "0.8.2"
|
|
235
|
+
}
|
|
231
236
|
}
|
|
232
237
|
}
|