eslint 10.0.0 → 10.0.3

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
@@ -43,7 +43,13 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
43
43
 
44
44
  ## Installation and Usage
45
45
 
46
- Prerequisites: [Node.js](https://nodejs.org/) (`^20.19.0`, `^22.13.0`, or `>=24`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
46
+ ### Prerequisites
47
+
48
+ To use ESLint, you must have [Node.js](https://nodejs.org/) (`^20.19.0`, `^22.13.0`, or `>=24`) installed and built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
49
+
50
+ If you use ESLint's TypeScript type definitions, TypeScript 5.3 or later is required.
51
+
52
+ ### npm Installation
47
53
 
48
54
  You can install and configure ESLint using this command:
49
55
 
@@ -350,8 +356,8 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).
350
356
 
351
357
  <h3>Platinum Sponsors</h3>
352
358
  <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>
353
- <p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
354
- <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://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" 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>
359
+ <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>
360
+ <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>
355
361
  <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://depot.dev"><img src="https://images.opencollective.com/depot/39125a1/logo.png" alt="Depot" height="32"></a> <a href="https://www.n-ix.com/"><img src="https://images.opencollective.com/n-ix-ltd/575a7a5/logo.png" alt="N-iX Ltd" 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://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="TestMu AI Open Source Office (Formerly LambdaTest)" height="32"></a></p>
356
362
  <h3>Technology Sponsors</h3>
357
363
  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.
package/lib/cli.js CHANGED
@@ -499,7 +499,7 @@ const cli = {
499
499
 
500
500
  if (unusedSuppressionsCount > 0) {
501
501
  log.error(
502
- "There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.",
502
+ "There are suppressions left that do not occur anymore. To resolve this, re-run the command with `--prune-suppressions` to remove unused suppressions. To ignore unused suppressions, use `--pass-on-unpruned-suppressions`.",
503
503
  );
504
504
  debug(JSON.stringify(unusedSuppressions, null, 2));
505
505
 
@@ -4,6 +4,13 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
+ //------------------------------------------------------------------------------
8
+ // Types
9
+ //------------------------------------------------------------------------------
10
+
11
+ /** @typedef {import("eslint-scope").Definition} Definition */
12
+ /** @typedef {import("eslint-scope").Reference} Reference */
13
+
7
14
  //------------------------------------------------------------------------------
8
15
  // Rule Definition
9
16
  //------------------------------------------------------------------------------
@@ -51,8 +58,8 @@ module.exports = {
51
58
 
52
59
  /**
53
60
  * Reports a given reference.
54
- * @param {eslint-scope.Reference} reference A reference to report.
55
- * @param {eslint-scope.Definition} definition A definition for which to report reference.
61
+ * @param {Reference} reference A reference to report.
62
+ * @param {Definition} definition A definition for which to report reference.
56
63
  * @returns {void}
57
64
  */
58
65
  function report(reference, definition) {
@@ -11,9 +11,19 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Variable} Variable */
19
+
20
+ //------------------------------------------------------------------------------
21
+ // Helpers
22
+ //------------------------------------------------------------------------------
23
+
14
24
  /**
15
25
  * Checks whether or not a given variable is a function name.
16
- * @param {eslint-scope.Variable} variable A variable to check.
26
+ * @param {Variable} variable A variable to check.
17
27
  * @returns {boolean} `true` if the variable is a function name.
18
28
  */
19
29
  function isFunctionName(variable) {
@@ -11,6 +11,12 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Reference} Reference */
19
+
14
20
  //------------------------------------------------------------------------------
15
21
  // Rule Definition
16
22
  //------------------------------------------------------------------------------
@@ -62,7 +68,7 @@ module.exports = {
62
68
 
63
69
  /**
64
70
  * Checks whether the given reference is 'console' or not.
65
- * @param {eslint-scope.Reference} reference The reference to check.
71
+ * @param {Reference} reference The reference to check.
66
72
  * @returns {boolean} `true` if the reference is 'console'.
67
73
  */
68
74
  function isConsole(reference) {
@@ -86,7 +92,7 @@ module.exports = {
86
92
  /**
87
93
  * Checks whether the given reference is a member access which is not
88
94
  * allowed by options or not.
89
- * @param {eslint-scope.Reference} reference The reference to check.
95
+ * @param {Reference} reference The reference to check.
90
96
  * @returns {boolean} `true` if the reference is a member access which
91
97
  * is not allowed by options.
92
98
  */
@@ -163,7 +169,7 @@ module.exports = {
163
169
 
164
170
  /**
165
171
  * Reports the given reference as a violation.
166
- * @param {eslint-scope.Reference} reference The reference to report.
172
+ * @param {Reference} reference The reference to report.
167
173
  * @returns {void}
168
174
  */
169
175
  function report(reference) {
@@ -11,6 +11,12 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Definition} Definition */
19
+
14
20
  //------------------------------------------------------------------------------
15
21
  // Rule Definition
16
22
  //------------------------------------------------------------------------------
@@ -43,7 +49,7 @@ module.exports = {
43
49
 
44
50
  /**
45
51
  * Checks whether or not a given definition is a parameter's.
46
- * @param {eslint-scope.DefEntry} def A definition to check.
52
+ * @param {Definition} def A definition to check.
47
53
  * @returns {boolean} `true` if the definition is a parameter's.
48
54
  */
49
55
  function isParameter(def) {
@@ -12,6 +12,12 @@
12
12
  const astUtils = require("./utils/ast-utils");
13
13
  const FixTracker = require("./utils/fix-tracker");
14
14
 
15
+ //------------------------------------------------------------------------------
16
+ // Types
17
+ //------------------------------------------------------------------------------
18
+
19
+ /** @typedef {import("eslint-scope").Scope} Scope */
20
+
15
21
  //------------------------------------------------------------------------------
16
22
  // Rule Definition
17
23
  //------------------------------------------------------------------------------
@@ -66,7 +72,7 @@ module.exports = {
66
72
  * This is not a generic function. In particular, it is assumed that the scope is a function scope or
67
73
  * a function's inner scope, and that the names can be valid identifiers in the given scope.
68
74
  * @param {string[]} names Array of variable names.
69
- * @param {eslint-scope.Scope} scope Function scope or a function's inner scope.
75
+ * @param {Scope} scope Function scope or a function's inner scope.
70
76
  * @returns {boolean} True if all names can be safely declared, false otherwise.
71
77
  */
72
78
  function isSafeToDeclare(names, scope) {
@@ -158,7 +164,7 @@ module.exports = {
158
164
  /**
159
165
  * Checks whether the removal of `else` and its braces is safe from variable name collisions.
160
166
  * @param {Node} node The 'else' node.
161
- * @param {eslint-scope.Scope} scope The scope in which the node and the whole 'if' statement is.
167
+ * @param {Scope} scope The scope in which the node and the whole 'if' statement is.
162
168
  * @returns {boolean} True if it is safe, false otherwise.
163
169
  */
164
170
  function isSafeFromNameCollisions(node, scope) {
@@ -11,6 +11,12 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Scope} Scope */
19
+
14
20
  //------------------------------------------------------------------------------
15
21
  // Helpers
16
22
  //------------------------------------------------------------------------------
@@ -138,7 +144,7 @@ module.exports = {
138
144
 
139
145
  /**
140
146
  * Reports accesses of `eval` via the global object.
141
- * @param {eslint-scope.Scope} globalScope The global scope.
147
+ * @param {Scope} globalScope The global scope.
142
148
  * @returns {void}
143
149
  */
144
150
  function reportAccessingEvalViaGlobalObject(globalScope) {
@@ -171,7 +177,7 @@ module.exports = {
171
177
 
172
178
  /**
173
179
  * Reports all accesses of `eval` (excludes direct calls to eval).
174
- * @param {eslint-scope.Scope} globalScope The global scope.
180
+ * @param {Scope} globalScope The global scope.
175
181
  * @returns {void}
176
182
  */
177
183
  function reportAccessingEval(globalScope) {
@@ -5,6 +5,12 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ //------------------------------------------------------------------------------
9
+ // Types
10
+ //------------------------------------------------------------------------------
11
+
12
+ /** @typedef {import("eslint-scope").Reference} Reference */
13
+
8
14
  //------------------------------------------------------------------------------
9
15
  // Helpers
10
16
  //------------------------------------------------------------------------------
@@ -138,7 +144,7 @@ module.exports = {
138
144
  * Checks whether a given reference which refers to an upper scope's variable is
139
145
  * safe or not.
140
146
  * @param {ASTNode} loopNode A containing loop node.
141
- * @param {eslint-scope.Reference} reference A reference to check.
147
+ * @param {Reference} reference A reference to check.
142
148
  * @returns {boolean} `true` if the reference is safe or not.
143
149
  */
144
150
  function isSafe(loopNode, reference) {
@@ -184,7 +190,7 @@ module.exports = {
184
190
  * It's safe if the reference matches one of the following condition.
185
191
  * - is readonly.
186
192
  * - doesn't exist inside a local function and after the border.
187
- * @param {eslint-scope.Reference} upperRef A reference to check.
193
+ * @param {Reference} upperRef A reference to check.
188
194
  * @returns {boolean} `true` if the reference is safe.
189
195
  */
190
196
  function isSafeReference(upperRef) {
@@ -11,6 +11,12 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Variable} Variable */
19
+
14
20
  //------------------------------------------------------------------------------
15
21
  // Helpers
16
22
  //------------------------------------------------------------------------------
@@ -452,7 +458,7 @@ module.exports = {
452
458
 
453
459
  /**
454
460
  * Get declared line and column of a variable.
455
- * @param {eslint-scope.Variable} variable The variable to get.
461
+ * @param {Variable} variable The variable to get.
456
462
  * @returns {Object} The declared line and column of the variable.
457
463
  */
458
464
  function getDeclaredLocation(variable) {
@@ -4,6 +4,12 @@
4
4
  */
5
5
  "use strict";
6
6
 
7
+ //------------------------------------------------------------------------------
8
+ // Types
9
+ //------------------------------------------------------------------------------
10
+
11
+ /** @typedef {import("eslint-scope").Scope} Scope */
12
+
7
13
  //------------------------------------------------------------------------------
8
14
  // Rule Definition
9
15
  //------------------------------------------------------------------------------
@@ -45,7 +51,7 @@ module.exports = {
45
51
  /**
46
52
  * Checks the given scope for references to `undefined` and reports
47
53
  * all references found.
48
- * @param {eslint-scope.Scope} scope The scope to check.
54
+ * @param {Scope} scope The scope to check.
49
55
  * @returns {void}
50
56
  */
51
57
  function checkScope(scope) {
@@ -12,6 +12,13 @@
12
12
  const Traverser = require("../shared/traverser"),
13
13
  astUtils = require("./utils/ast-utils");
14
14
 
15
+ //------------------------------------------------------------------------------
16
+ // Types
17
+ //------------------------------------------------------------------------------
18
+
19
+ /** @typedef {import("eslint-scope").Variable} Variable */
20
+ /** @typedef {import("eslint-scope").Reference} Reference */
21
+
15
22
  //------------------------------------------------------------------------------
16
23
  // Helpers
17
24
  //------------------------------------------------------------------------------
@@ -25,7 +32,7 @@ const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u;
25
32
 
26
33
  /**
27
34
  * @typedef {Object} LoopConditionInfo
28
- * @property {eslint-scope.Reference} reference - The reference.
35
+ * @property {Reference} reference - The reference.
29
36
  * @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes
30
37
  * that the reference is belonging to.
31
38
  * @property {Function} isInLoop - The predicate which checks a given reference
@@ -36,7 +43,7 @@ const DYNAMIC_PATTERN = /^(?:Call|Member|New|TaggedTemplate|Yield)Expression$/u;
36
43
 
37
44
  /**
38
45
  * Checks whether or not a given reference is a write reference.
39
- * @param {eslint-scope.Reference} reference A reference to check.
46
+ * @param {Reference} reference A reference to check.
40
47
  * @returns {boolean} `true` if the reference is a write reference.
41
48
  */
42
49
  function isWriteReference(reference) {
@@ -73,7 +80,7 @@ function isUnmodifiedAndNotBelongToGroup(condition) {
73
80
  /**
74
81
  * Checks whether or not a given reference is inside of a given node.
75
82
  * @param {ASTNode} node A node to check.
76
- * @param {eslint-scope.Reference} reference A reference to check.
83
+ * @param {Reference} reference A reference to check.
77
84
  * @returns {boolean} `true` if the reference is inside of the node.
78
85
  */
79
86
  function isInRange(node, reference) {
@@ -86,7 +93,7 @@ function isInRange(node, reference) {
86
93
  /**
87
94
  * Checks whether or not a given reference is inside of a loop node's condition.
88
95
  * @param {ASTNode} node A node to check.
89
- * @param {eslint-scope.Reference} reference A reference to check.
96
+ * @param {Reference} reference A reference to check.
90
97
  * @returns {boolean} `true` if the reference is inside of the loop node's
91
98
  * condition.
92
99
  */
@@ -104,7 +111,7 @@ const isInLoop = {
104
111
  /**
105
112
  * Gets the function which encloses a given reference.
106
113
  * This supports only FunctionDeclaration.
107
- * @param {eslint-scope.Reference} reference A reference to get.
114
+ * @param {Reference} reference A reference to get.
108
115
  * @returns {ASTNode|null} The function node or null.
109
116
  */
110
117
  function getEncloseFunctionDeclaration(reference) {
@@ -124,7 +131,7 @@ function getEncloseFunctionDeclaration(reference) {
124
131
  /**
125
132
  * Updates the "modified" flags of given loop conditions with given modifiers.
126
133
  * @param {LoopConditionInfo[]} conditions The loop conditions to be updated.
127
- * @param {eslint-scope.Reference[]} modifiers The references to update.
134
+ * @param {Reference[]} modifiers The references to update.
128
135
  * @returns {void}
129
136
  */
130
137
  function updateModifiedFlag(conditions, modifiers) {
@@ -258,7 +265,7 @@ module.exports = {
258
265
 
259
266
  /**
260
267
  * Creates the loop condition information from a given reference.
261
- * @param {eslint-scope.Reference} reference A reference to create.
268
+ * @param {Reference} reference A reference to create.
262
269
  * @returns {LoopConditionInfo|null} Created loop condition info, or null.
263
270
  */
264
271
  function toLoopCondition(reference) {
@@ -309,7 +316,7 @@ module.exports = {
309
316
  /**
310
317
  * Finds unmodified references which are inside of a loop condition.
311
318
  * Then reports the references which are outside of groups.
312
- * @param {eslint-scope.Variable} variable A variable to report.
319
+ * @param {Variable} variable A variable to report.
313
320
  * @returns {void}
314
321
  */
315
322
  function checkReferences(variable) {
@@ -11,6 +11,13 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Variable} Variable */
19
+ /** @typedef {import("eslint-scope").Reference} Reference */
20
+
14
21
  //------------------------------------------------------------------------------
15
22
  // Typedefs
16
23
  //------------------------------------------------------------------------------
@@ -524,7 +531,7 @@ module.exports = {
524
531
  * - The reference is inside of a loop.
525
532
  * - The reference is inside of a function scope which is different from
526
533
  * the declaration.
527
- * @param {eslint-scope.Reference} ref A reference to check.
534
+ * @param {Reference} ref A reference to check.
528
535
  * @param {ASTNode} prevRhsNode The previous RHS node.
529
536
  * @returns {ASTNode|null} The RHS node or null.
530
537
  * @private
@@ -631,7 +638,7 @@ module.exports = {
631
638
 
632
639
  /**
633
640
  * Checks whether a given reference is a read to update itself or not.
634
- * @param {eslint-scope.Reference} ref A reference to check.
641
+ * @param {Reference} ref A reference to check.
635
642
  * @param {ASTNode} rhsNode The RHS node of the previous assignment.
636
643
  * @returns {boolean} The reference is a read to update itself.
637
644
  * @private
@@ -732,7 +739,7 @@ module.exports = {
732
739
 
733
740
  /**
734
741
  * Checks whether the given variable is after the last used parameter.
735
- * @param {eslint-scope.Variable} variable The variable to check.
742
+ * @param {Variable} variable The variable to check.
736
743
  * @returns {boolean} `true` if the variable is defined after the last
737
744
  * used parameter.
738
745
  */
@@ -5,6 +5,13 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ //------------------------------------------------------------------------------
9
+ // Types
10
+ //------------------------------------------------------------------------------
11
+
12
+ /** @typedef {import("eslint-scope").Scope} Scope */
13
+ /** @typedef {import("eslint-scope").Reference} Reference */
14
+
8
15
  //------------------------------------------------------------------------------
9
16
  // Helpers
10
17
  //------------------------------------------------------------------------------
@@ -68,7 +75,7 @@ function isInClassStaticInitializerRange(node, location) {
68
75
  /**
69
76
  * Checks whether a given scope is the scope of a class static initializer.
70
77
  * Static initializers are static blocks and initializers of static fields.
71
- * @param {eslint-scope.Scope} scope A scope to check.
78
+ * @param {Scope} scope A scope to check.
72
79
  * @returns {boolean} `true` if the scope is a class static initializer scope.
73
80
  */
74
81
  function isClassStaticInitializerScope(scope) {
@@ -119,7 +126,7 @@ function isClassStaticInitializerScope(scope) {
119
126
  * x; // returns `false`
120
127
  * }
121
128
  * }
122
- * @param {eslint-scope.Reference} reference A reference to check.
129
+ * @param {Reference} reference A reference to check.
123
130
  * @returns {boolean} `true` if the reference is from a separate execution context.
124
131
  */
125
132
  function isFromSeparateExecutionContext(reference) {
@@ -333,7 +340,7 @@ module.exports = {
333
340
  * - referring to a variable that is defined, but not in the given source code
334
341
  * (e.g., global environment variable or `arguments` in functions).
335
342
  * - allowed by options.
336
- * @param {eslint-scope.Reference} reference The reference
343
+ * @param {Reference} reference The reference
337
344
  * @returns {boolean} `true` if the reference should be checked
338
345
  */
339
346
  function shouldCheck(reference) {
@@ -412,7 +419,7 @@ module.exports = {
412
419
 
413
420
  /**
414
421
  * Finds and validates all references in a given scope and its child scopes.
415
- * @param {eslint-scope.Scope} scope The scope object.
422
+ * @param {Scope} scope The scope object.
416
423
  * @returns {void}
417
424
  */
418
425
  function checkReferencesInScope(scope) {
@@ -138,7 +138,7 @@ module.exports = {
138
138
 
139
139
  messages: {
140
140
  unnecessaryAssignment:
141
- "This assigned value is not used in subsequent statements.",
141
+ "The value assigned to '{{name}}' is not used in subsequent statements.",
142
142
  },
143
143
  },
144
144
 
@@ -486,6 +486,7 @@ module.exports = {
486
486
  context.report({
487
487
  node: targetAssignment.identifier,
488
488
  messageId: "unnecessaryAssignment",
489
+ data: { name: targetAssignment.identifier.name },
489
490
  });
490
491
  }
491
492
 
@@ -11,13 +11,21 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Scope} Scope */
19
+ /** @typedef {import("eslint-scope").Variable} Variable */
20
+ /** @typedef {import("eslint-scope").Reference} Reference */
21
+
14
22
  //------------------------------------------------------------------------------
15
23
  // Helpers
16
24
  //------------------------------------------------------------------------------
17
25
 
18
26
  /**
19
27
  * Check whether a given variable is a global variable or not.
20
- * @param {eslint-scope.Variable} variable The variable to check.
28
+ * @param {Variable} variable The variable to check.
21
29
  * @returns {boolean} `true` if the variable is a global variable.
22
30
  */
23
31
  function isGlobal(variable) {
@@ -27,8 +35,8 @@ function isGlobal(variable) {
27
35
  /**
28
36
  * Finds the nearest function scope or global scope walking up the scope
29
37
  * hierarchy.
30
- * @param {eslint-scope.Scope} scope The scope to traverse.
31
- * @returns {eslint-scope.Scope} a function scope or global scope containing the given
38
+ * @param {Scope} scope The scope to traverse.
39
+ * @returns {Scope} a function scope or global scope containing the given
32
40
  * scope.
33
41
  */
34
42
  function getEnclosingFunctionScope(scope) {
@@ -43,7 +51,7 @@ function getEnclosingFunctionScope(scope) {
43
51
  /**
44
52
  * Checks whether the given variable has any references from a more specific
45
53
  * function expression (i.e. a closure).
46
- * @param {eslint-scope.Variable} variable A variable to check.
54
+ * @param {Variable} variable A variable to check.
47
55
  * @returns {boolean} `true` if the variable is used from a closure.
48
56
  */
49
57
  function isReferencedInClosure(variable) {
@@ -107,7 +115,7 @@ function getScopeNode(node) {
107
115
 
108
116
  /**
109
117
  * Checks whether a given variable is redeclared or not.
110
- * @param {eslint-scope.Variable} variable A variable to check.
118
+ * @param {Variable} variable A variable to check.
111
119
  * @returns {boolean} `true` if the variable is redeclared.
112
120
  */
113
121
  function isRedeclared(variable) {
@@ -123,7 +131,7 @@ function isRedeclared(variable) {
123
131
  function isUsedFromOutsideOf(scopeNode) {
124
132
  /**
125
133
  * Checks whether a given reference is inside of the specified scope or not.
126
- * @param {eslint-scope.Reference} reference A reference to check.
134
+ * @param {Reference} reference A reference to check.
127
135
  * @returns {boolean} `true` if the reference is inside of the specified
128
136
  * scope.
129
137
  */
@@ -184,7 +192,7 @@ function hasReferenceInTDZ(node) {
184
192
  /**
185
193
  * Checks whether a given variable has name that is allowed for 'var' declarations,
186
194
  * but disallowed for `let` declarations.
187
- * @param {eslint-scope.Variable} variable The variable to check.
195
+ * @param {Variable} variable The variable to check.
188
196
  * @returns {boolean} `true` if the variable has a disallowed name.
189
197
  */
190
198
  function hasNameDisallowedForLetDeclarations(variable) {
@@ -7,13 +7,20 @@
7
7
 
8
8
  const astUtils = require("./utils/ast-utils");
9
9
 
10
+ //------------------------------------------------------------------------------
11
+ // Types
12
+ //------------------------------------------------------------------------------
13
+
14
+ /** @typedef {import("eslint-scope").Scope} Scope */
15
+ /** @typedef {import("eslint-scope").Variable} Variable */
16
+
10
17
  //------------------------------------------------------------------------------
11
18
  // Helpers
12
19
  //------------------------------------------------------------------------------
13
20
 
14
21
  /**
15
22
  * Checks whether or not a given variable is a function name.
16
- * @param {eslint-scope.Variable} variable A variable to check.
23
+ * @param {Variable} variable A variable to check.
17
24
  * @returns {boolean} `true` if the variable is a function name.
18
25
  */
19
26
  function isFunctionName(variable) {
@@ -33,8 +40,8 @@ function checkMetaProperty(node, metaName, propertyName) {
33
40
 
34
41
  /**
35
42
  * Gets the variable object of `arguments` which is defined implicitly.
36
- * @param {eslint-scope.Scope} scope A scope to get.
37
- * @returns {eslint-scope.Variable} The found variable object.
43
+ * @param {Scope} scope A scope to get.
44
+ * @returns {Variable} The found variable object.
38
45
  */
39
46
  function getVariableOfArguments(scope) {
40
47
  const variables = scope.variables;
@@ -12,6 +12,14 @@
12
12
  const FixTracker = require("./utils/fix-tracker");
13
13
  const astUtils = require("./utils/ast-utils");
14
14
 
15
+ //------------------------------------------------------------------------------
16
+ // Types
17
+ //------------------------------------------------------------------------------
18
+
19
+ /** @typedef {import("eslint-scope").Scope} Scope */
20
+ /** @typedef {import("eslint-scope").Variable} Variable */
21
+ /** @typedef {import("eslint-scope").Reference} Reference */
22
+
15
23
  //------------------------------------------------------------------------------
16
24
  // Helpers
17
25
  //------------------------------------------------------------------------------
@@ -56,7 +64,7 @@ function canBecomeVariableDeclaration(identifier) {
56
64
  * Checks if an property or element is from outer scope or function parameters
57
65
  * in destructing pattern.
58
66
  * @param {string} name A variable name to be checked.
59
- * @param {eslint-scope.Scope} initScope A scope to start find.
67
+ * @param {Scope} initScope A scope to start find.
60
68
  * @returns {boolean} Indicates if the variable is from outer scope or function parameters.
61
69
  */
62
70
  function isOuterVariableInDestructing(name, initScope) {
@@ -82,7 +90,7 @@ function isOuterVariableInDestructing(name, initScope) {
82
90
  * belongs to.
83
91
  * This is used to detect a mix of reassigned and never reassigned in a
84
92
  * destructuring.
85
- * @param {eslint-scope.Reference} reference A reference to get.
93
+ * @param {Reference} reference A reference to get.
86
94
  * @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
87
95
  * null.
88
96
  */
@@ -168,7 +176,7 @@ function hasMemberExpressionAssignment(node) {
168
176
  * `/*exported foo` directive comment makes such variables. This rule does not
169
177
  * warn such variables because this rule cannot distinguish whether the
170
178
  * exported variables are reassigned or not.
171
- * @param {eslint-scope.Variable} variable A variable to get.
179
+ * @param {Variable} variable A variable to get.
172
180
  * @param {boolean} ignoreReadBeforeAssign
173
181
  * The value of `ignoreReadBeforeAssign` option.
174
182
  * @returns {ASTNode|null}
@@ -268,7 +276,7 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
268
276
  * reference of given variables belongs to.
269
277
  * This is used to detect a mix of reassigned and never reassigned in a
270
278
  * destructuring.
271
- * @param {eslint-scope.Variable[]} variables Variables to group by destructuring.
279
+ * @param {Variable[]} variables Variables to group by destructuring.
272
280
  * @param {boolean} ignoreReadBeforeAssign
273
281
  * The value of `ignoreReadBeforeAssign` option.
274
282
  * @returns {Map<ASTNode, ASTNode[]>} Grouped identifier nodes.
@@ -389,7 +397,7 @@ module.exports = {
389
397
  * nullable. In simple declaration or assignment cases, the length of
390
398
  * the array is 1. In destructuring cases, the length of the array can
391
399
  * be 2 or more.
392
- * @param {(eslint-scope.Reference|null)[]} nodes
400
+ * @param {(Reference|null)[]} nodes
393
401
  * References which are grouped by destructuring to report.
394
402
  * @returns {void}
395
403
  */
@@ -5,14 +5,22 @@
5
5
 
6
6
  "use strict";
7
7
 
8
+ //------------------------------------------------------------------------------
9
+ // Types
10
+ //------------------------------------------------------------------------------
11
+
12
+ /** @typedef {import("eslint-scope").Scope} Scope */
13
+ /** @typedef {import("eslint-scope").Variable} Variable */
14
+ /** @typedef {import("eslint-scope").Reference} Reference */
15
+
8
16
  //------------------------------------------------------------------------------
9
17
  // Helpers
10
18
  //------------------------------------------------------------------------------
11
19
 
12
20
  /**
13
21
  * Gets the variable object of `arguments` which is defined implicitly.
14
- * @param {eslint-scope.Scope} scope A scope to get.
15
- * @returns {eslint-scope.Variable} The found variable object.
22
+ * @param {Scope} scope A scope to get.
23
+ * @returns {Variable} The found variable object.
16
24
  */
17
25
  function getVariableOfArguments(scope) {
18
26
  const variables = scope.variables;
@@ -40,7 +48,7 @@ function getVariableOfArguments(scope) {
40
48
  * - arguments[i] .... true // computed member access
41
49
  * - arguments[0] .... true // computed member access
42
50
  * - arguments.length .... false // normal member access
43
- * @param {eslint-scope.Reference} reference The reference to check.
51
+ * @param {Reference} reference The reference to check.
44
52
  * @returns {boolean} `true` if the reference is not normal member access.
45
53
  */
46
54
  function isNotNormalMemberAccess(reference) {
@@ -81,7 +89,7 @@ module.exports = {
81
89
 
82
90
  /**
83
91
  * Reports a given reference.
84
- * @param {eslint-scope.Reference} reference A reference to report.
92
+ * @param {Reference} reference A reference to report.
85
93
  * @returns {void}
86
94
  */
87
95
  function report(reference) {
@@ -11,6 +11,12 @@
11
11
 
12
12
  const astUtils = require("./utils/ast-utils");
13
13
 
14
+ //------------------------------------------------------------------------------
15
+ // Types
16
+ //------------------------------------------------------------------------------
17
+
18
+ /** @typedef {import("eslint-scope").Variable} Variable */
19
+
14
20
  //------------------------------------------------------------------------------
15
21
  // Helpers
16
22
  //------------------------------------------------------------------------------
@@ -21,7 +27,7 @@ const validRadixValues = new Set(
21
27
 
22
28
  /**
23
29
  * Checks whether a given variable is shadowed or not.
24
- * @param {eslint-scope.Variable} variable A variable to check.
30
+ * @param {Variable} variable A variable to check.
25
31
  * @returns {boolean} `true` if the variable is shadowed.
26
32
  */
27
33
  function isShadowed(variable) {
@@ -22,6 +22,13 @@ const {
22
22
  const globals = require("../../../conf/globals");
23
23
  const { LATEST_ECMA_VERSION } = require("../../../conf/ecma-version");
24
24
 
25
+ //------------------------------------------------------------------------------
26
+ // Types
27
+ //------------------------------------------------------------------------------
28
+
29
+ /** @typedef {import("eslint-scope").Scope} Scope */
30
+ /** @typedef {import("eslint-scope").Variable} Variable */
31
+
25
32
  //------------------------------------------------------------------------------
26
33
  // Helpers
27
34
  //------------------------------------------------------------------------------
@@ -1581,9 +1588,9 @@ module.exports = {
1581
1588
 
1582
1589
  /**
1583
1590
  * Finds the variable by a given name in a given scope and its upper scopes.
1584
- * @param {eslint-scope.Scope} initScope A scope to start find.
1591
+ * @param {Scope} initScope A scope to start find.
1585
1592
  * @param {string} name A variable name to find.
1586
- * @returns {eslint-scope.Variable|null} A found variable or `null`.
1593
+ * @returns {Variable|null} A found variable or `null`.
1587
1594
  */
1588
1595
  getVariableByName(initScope, name) {
1589
1596
  let scope = initScope;
@@ -1610,7 +1617,7 @@ module.exports = {
1610
1617
  * - The given node is not `StaticBlock`.
1611
1618
  * - The function name does not start with uppercase. It's a convention to capitalize the names
1612
1619
  * of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
1613
- * - The function does not have a JSDoc comment that has a @this tag.
1620
+ * - The function does not have a JSDoc comment that has a `@this` tag.
1614
1621
  *
1615
1622
  * Next, this checks the location of the node.
1616
1623
  * If the location is below, this judges `this` is valid.
@@ -6,8 +6,8 @@
6
6
  /**
7
7
  * Check whether a given character is a combining mark or not.
8
8
  * @param {number} codePoint The character code to check.
9
- * @returns {boolean} `true` if the character belongs to the category, any of `Mc`, `Me`, and `Mn`.
9
+ * @returns {boolean} `true` if the character has the General Category of Combining Mark (M), consisting of `Mc`, `Me`, and `Mn`.
10
10
  */
11
11
  module.exports = function isCombiningCharacter(codePoint) {
12
- return /^[\p{Mc}\p{Me}\p{Mn}]$/u.test(String.fromCodePoint(codePoint));
12
+ return /^\p{M}$/u.test(String.fromCodePoint(codePoint));
13
13
  };
@@ -42,7 +42,7 @@ function normalizePackageName(name, prefix) {
42
42
  `$1/${prefix}`,
43
43
  );
44
44
  } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
45
- /**
45
+ /*
46
46
  * for scoped packages, insert the prefix after the first / unless
47
47
  * the path is already @scope/eslint or @scope/eslint-xxx-yyy
48
48
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "10.0.0",
3
+ "version": "10.0.3",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "type": "commonjs",
@@ -108,21 +108,21 @@
108
108
  "dependencies": {
109
109
  "@eslint-community/eslint-utils": "^4.8.0",
110
110
  "@eslint-community/regexpp": "^4.12.2",
111
- "@eslint/config-array": "^0.23.0",
111
+ "@eslint/config-array": "^0.23.3",
112
112
  "@eslint/config-helpers": "^0.5.2",
113
- "@eslint/core": "^1.1.0",
114
- "@eslint/plugin-kit": "^0.6.0",
113
+ "@eslint/core": "^1.1.1",
114
+ "@eslint/plugin-kit": "^0.6.1",
115
115
  "@humanfs/node": "^0.16.6",
116
116
  "@humanwhocodes/module-importer": "^1.0.1",
117
117
  "@humanwhocodes/retry": "^0.4.2",
118
118
  "@types/estree": "^1.0.6",
119
- "ajv": "^6.12.4",
119
+ "ajv": "^6.14.0",
120
120
  "cross-spawn": "^7.0.6",
121
121
  "debug": "^4.3.2",
122
122
  "escape-string-regexp": "^4.0.0",
123
- "eslint-scope": "^9.1.0",
124
- "eslint-visitor-keys": "^5.0.0",
125
- "espree": "^11.1.0",
123
+ "eslint-scope": "^9.1.2",
124
+ "eslint-visitor-keys": "^5.0.1",
125
+ "espree": "^11.1.1",
126
126
  "esquery": "^1.7.0",
127
127
  "esutils": "^2.0.2",
128
128
  "fast-deep-equal": "^3.1.3",
@@ -133,7 +133,7 @@
133
133
  "imurmurhash": "^0.1.4",
134
134
  "is-glob": "^4.0.0",
135
135
  "json-stable-stringify-without-jsonify": "^1.0.1",
136
- "minimatch": "^10.1.1",
136
+ "minimatch": "^10.2.4",
137
137
  "natural-compare": "^1.4.0",
138
138
  "optionator": "^0.9.3"
139
139
  },
@@ -143,11 +143,11 @@
143
143
  "@babel/preset-env": "^7.4.3",
144
144
  "@cypress/webpack-preprocessor": "^6.0.2",
145
145
  "@eslint/json": "^0.14.0",
146
- "@eslint/eslintrc": "^3.3.3",
146
+ "@eslint/eslintrc": "^3.3.5",
147
147
  "@trunkio/launcher": "^1.3.4",
148
148
  "@types/esquery": "^1.5.4",
149
149
  "@types/node": "^22.13.14",
150
- "@typescript-eslint/parser": "^8.54.0",
150
+ "@typescript-eslint/parser": "^8.56.0",
151
151
  "babel-loader": "^8.0.5",
152
152
  "c8": "^7.12.0",
153
153
  "chai": "^4.0.1",
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (it) {
4
- const { pattern } = it;
5
-
6
- return `
7
- You are linting "${pattern}", but all of the files matching the glob pattern "${pattern}" are ignored.
8
-
9
- If you don't want to lint these files, remove the pattern "${pattern}" from the list of arguments passed to ESLint.
10
-
11
- If you do want to lint these files, try the following solutions:
12
-
13
- * Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
14
- * Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
15
- `.trimStart();
16
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function () {
4
- return `
5
- The '--print-config' CLI option requires a path to a source code file rather than a directory.
6
- See also: https://eslint.org/docs/latest/use/command-line-interface#--print-config
7
- `.trimStart();
8
- };