eslint 9.39.1 → 10.0.0-alpha.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.
Files changed (64) hide show
  1. package/README.md +3 -3
  2. package/bin/eslint.js +1 -2
  3. package/lib/api.js +4 -15
  4. package/lib/cli.js +14 -56
  5. package/lib/config/config-loader.js +6 -154
  6. package/lib/eslint/eslint-helpers.js +5 -8
  7. package/lib/eslint/eslint.js +1 -1
  8. package/lib/eslint/index.js +0 -2
  9. package/lib/languages/js/source-code/source-code.js +66 -252
  10. package/lib/languages/js/source-code/token-store/index.js +0 -26
  11. package/lib/languages/js/source-code/token-store/utils.js +29 -8
  12. package/lib/linter/apply-disable-directives.js +0 -1
  13. package/lib/linter/file-context.js +0 -56
  14. package/lib/linter/file-report.js +0 -4
  15. package/lib/linter/linter.js +45 -1086
  16. package/lib/linter/rule-fixer.js +30 -0
  17. package/lib/options.js +62 -182
  18. package/lib/rule-tester/rule-tester.js +265 -194
  19. package/lib/rules/array-bracket-spacing.js +4 -4
  20. package/lib/rules/block-spacing.js +1 -1
  21. package/lib/rules/comma-spacing.js +2 -5
  22. package/lib/rules/computed-property-spacing.js +4 -4
  23. package/lib/rules/dot-notation.js +2 -2
  24. package/lib/rules/func-names.js +2 -0
  25. package/lib/rules/keyword-spacing.js +4 -4
  26. package/lib/rules/no-eval.js +1 -1
  27. package/lib/rules/no-extra-parens.js +1 -1
  28. package/lib/rules/no-invalid-regexp.js +1 -0
  29. package/lib/rules/no-shadow-restricted-names.js +1 -1
  30. package/lib/rules/no-spaced-func.js +1 -1
  31. package/lib/rules/no-unassigned-vars.js +1 -1
  32. package/lib/rules/no-useless-assignment.js +1 -1
  33. package/lib/rules/no-useless-constructor.js +13 -3
  34. package/lib/rules/no-whitespace-before-property.js +1 -1
  35. package/lib/rules/object-curly-spacing.js +2 -8
  36. package/lib/rules/preserve-caught-error.js +1 -1
  37. package/lib/rules/radix.js +25 -48
  38. package/lib/rules/require-yield.js +11 -1
  39. package/lib/rules/rest-spread-spacing.js +1 -4
  40. package/lib/rules/semi-spacing.js +2 -2
  41. package/lib/rules/space-before-blocks.js +1 -1
  42. package/lib/rules/space-before-function-paren.js +1 -4
  43. package/lib/rules/space-in-parens.js +4 -4
  44. package/lib/rules/space-infix-ops.js +4 -7
  45. package/lib/rules/switch-colon-spacing.js +1 -1
  46. package/lib/rules/template-tag-spacing.js +1 -1
  47. package/lib/rules/utils/ast-utils.js +114 -22
  48. package/lib/rules/yield-star-spacing.js +1 -2
  49. package/lib/services/parser-service.js +0 -1
  50. package/lib/services/processor-service.js +0 -1
  51. package/lib/services/warning-service.js +0 -11
  52. package/lib/shared/flags.js +0 -19
  53. package/lib/shared/translate-cli-options.js +106 -164
  54. package/lib/types/index.d.ts +7 -81
  55. package/lib/types/rules.d.ts +11 -2
  56. package/lib/types/use-at-your-own-risk.d.ts +1 -54
  57. package/lib/unsupported-api.js +3 -6
  58. package/package.json +15 -20
  59. package/conf/default-cli-options.js +0 -32
  60. package/lib/cli-engine/cli-engine.js +0 -1109
  61. package/lib/cli-engine/file-enumerator.js +0 -541
  62. package/lib/cli-engine/index.js +0 -7
  63. package/lib/cli-engine/load-rules.js +0 -46
  64. package/lib/eslint/legacy-eslint.js +0 -786
@@ -8,8 +8,7 @@
8
8
  // Requirements
9
9
  //------------------------------------------------------------------------------
10
10
 
11
- const { isCommentToken } = require("@eslint-community/eslint-utils"),
12
- TokenStore = require("./token-store"),
11
+ const TokenStore = require("./token-store"),
13
12
  astUtils = require("../../../shared/ast-utils"),
14
13
  Traverser = require("../../../shared/traverser"),
15
14
  globals = require("../../../../conf/globals"),
@@ -20,8 +19,7 @@ const { isCommentToken } = require("@eslint-community/eslint-utils"),
20
19
  VisitNodeStep,
21
20
  CallMethodStep,
22
21
  Directive,
23
- } = require("@eslint/plugin-kit"),
24
- eslintScope = require("eslint-scope");
22
+ } = require("@eslint/plugin-kit");
25
23
 
26
24
  //------------------------------------------------------------------------------
27
25
  // Type Definitions
@@ -29,6 +27,7 @@ const { isCommentToken } = require("@eslint-community/eslint-utils"),
29
27
 
30
28
  /** @typedef {import("eslint-scope").Variable} Variable */
31
29
  /** @typedef {import("eslint-scope").Scope} Scope */
30
+ /** @typedef {import("eslint-scope").ScopeManager} ScopeManager */
32
31
  /** @typedef {import("@eslint/core").SourceCode} ISourceCode */
33
32
  /** @typedef {import("@eslint/core").Directive} IDirective */
34
33
  /** @typedef {import("@eslint/core").TraversalStep} ITraversalStep */
@@ -90,21 +89,6 @@ function getGlobalsForEcmaVersion(ecmaVersion) {
90
89
  }
91
90
  }
92
91
 
93
- /**
94
- * Check to see if its a ES6 export declaration.
95
- * @param {ASTNode} astNode An AST node.
96
- * @returns {boolean} whether the given node represents an export declaration.
97
- * @private
98
- */
99
- function looksLikeExport(astNode) {
100
- return (
101
- astNode.type === "ExportDefaultDeclaration" ||
102
- astNode.type === "ExportNamedDeclaration" ||
103
- astNode.type === "ExportAllDeclaration" ||
104
- astNode.type === "ExportSpecifier"
105
- );
106
- }
107
-
108
92
  /**
109
93
  * Merges two sorted lists into a larger sorted list in O(n) time.
110
94
  * @param {Token[]} tokens The list of tokens.
@@ -179,56 +163,6 @@ function nodesOrTokensOverlap(first, second) {
179
163
  );
180
164
  }
181
165
 
182
- /**
183
- * Determines if two nodes or tokens have at least one whitespace character
184
- * between them. Order does not matter. Returns false if the given nodes or
185
- * tokens overlap.
186
- * @param {SourceCode} sourceCode The source code object.
187
- * @param {ASTNode|Token} first The first node or token to check between.
188
- * @param {ASTNode|Token} second The second node or token to check between.
189
- * @param {boolean} checkInsideOfJSXText If `true` is present, check inside of JSXText tokens for backward compatibility.
190
- * @returns {boolean} True if there is a whitespace character between
191
- * any of the tokens found between the two given nodes or tokens.
192
- * @public
193
- */
194
- function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) {
195
- if (nodesOrTokensOverlap(first, second)) {
196
- return false;
197
- }
198
-
199
- const [startingNodeOrToken, endingNodeOrToken] =
200
- first.range[1] <= second.range[0] ? [first, second] : [second, first];
201
- const firstToken =
202
- sourceCode.getLastToken(startingNodeOrToken) || startingNodeOrToken;
203
- const finalToken =
204
- sourceCode.getFirstToken(endingNodeOrToken) || endingNodeOrToken;
205
- let currentToken = firstToken;
206
-
207
- while (currentToken !== finalToken) {
208
- const nextToken = sourceCode.getTokenAfter(currentToken, {
209
- includeComments: true,
210
- });
211
-
212
- if (
213
- currentToken.range[1] !== nextToken.range[0] ||
214
- /*
215
- * For backward compatibility, check spaces in JSXText.
216
- * https://github.com/eslint/eslint/issues/12614
217
- */
218
- (checkInsideOfJSXText &&
219
- nextToken !== finalToken &&
220
- nextToken.type === "JSXText" &&
221
- /\s/u.test(nextToken.value))
222
- ) {
223
- return true;
224
- }
225
-
226
- currentToken = nextToken;
227
- }
228
-
229
- return false;
230
- }
231
-
232
166
  /**
233
167
  * Performs binary search to find the line number containing a given character index.
234
168
  * Returns the lower bound - the index of the first element greater than the target.
@@ -264,103 +198,37 @@ function findLineNumberBinarySearch(lineStartIndices, target) {
264
198
  * Ensures that variables representing built-in properties of the Global Object,
265
199
  * and any globals declared by special block comments, are present in the global
266
200
  * scope.
267
- * @param {Scope} globalScope The global scope.
201
+ * @param {ScopeManager} scopeManager Scope manager.
268
202
  * @param {Object|undefined} configGlobals The globals declared in configuration
269
203
  * @param {Object|undefined} inlineGlobals The globals declared in the source code
270
204
  * @returns {void}
271
205
  */
272
206
  function addDeclaredGlobals(
273
- globalScope,
274
- configGlobals = {},
275
- inlineGlobals = {},
207
+ scopeManager,
208
+ configGlobals = Object.create(null),
209
+ inlineGlobals = Object.create(null),
276
210
  ) {
277
- // Define configured global variables.
278
- for (const id of new Set([
279
- ...Object.keys(configGlobals),
280
- ...Object.keys(inlineGlobals),
281
- ])) {
282
- /*
283
- * `normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would
284
- * typically be caught when validating a config anyway (validity for inline global comments is checked separately).
285
- */
286
- const configValue =
287
- configGlobals[id] === void 0
288
- ? void 0
289
- : normalizeConfigGlobal(configGlobals[id]);
290
- const commentValue = inlineGlobals[id] && inlineGlobals[id].value;
291
- const value = commentValue || configValue;
292
- const sourceComments = inlineGlobals[id] && inlineGlobals[id].comments;
293
-
294
- if (value === "off") {
295
- continue;
296
- }
297
-
298
- let variable = globalScope.set.get(id);
211
+ const finalGlobals = { __proto__: null, ...configGlobals };
299
212
 
300
- if (!variable) {
301
- variable = new eslintScope.Variable(id, globalScope);
302
-
303
- globalScope.variables.push(variable);
304
- globalScope.set.set(id, variable);
305
- }
306
-
307
- variable.eslintImplicitGlobalSetting = configValue;
308
- variable.eslintExplicitGlobal = sourceComments !== void 0;
309
- variable.eslintExplicitGlobalComments = sourceComments;
310
- variable.writeable = value === "writable";
213
+ for (const [name, data] of Object.entries(inlineGlobals)) {
214
+ finalGlobals[name] = data.value;
311
215
  }
312
216
 
313
- /*
314
- * "through" contains all references which definitions cannot be found.
315
- * Since we augment the global scope using configuration, we need to update
316
- * references and remove the ones that were added by configuration.
317
- */
318
- globalScope.through = globalScope.through.filter(reference => {
319
- const name = reference.identifier.name;
320
- const variable = globalScope.set.get(name);
321
-
322
- if (variable) {
323
- /*
324
- * Links the variable and the reference.
325
- * And this reference is removed from `Scope#through`.
326
- */
327
- reference.resolved = variable;
328
- variable.references.push(reference);
217
+ const names = Object.keys(finalGlobals).filter(
218
+ name => finalGlobals[name] !== "off",
219
+ );
329
220
 
330
- return false;
331
- }
221
+ scopeManager.addGlobals(names);
332
222
 
333
- return true;
334
- });
223
+ const globalScope = scopeManager.scopes[0];
335
224
 
336
- /*
337
- * "implicit" contains information about implicit global variables (those created
338
- * implicitly by assigning values to undeclared variables in non-strict code).
339
- * Since we augment the global scope using configuration, we need to remove
340
- * the ones that were added by configuration, as they are either built-in
341
- * or declared elsewhere, therefore not implicit.
342
- * Since the "implicit" property was not documented, first we'll check if it exists
343
- * because it's possible that not all custom scope managers create this property.
344
- * If it exists, we assume it has properties `variables` and `set`. Property
345
- * `left` is considered optional (for example, typescript-eslint's scope manage
346
- * has this property named `leftToBeResolved`).
347
- */
348
- const { implicit } = globalScope;
349
- if (typeof implicit === "object" && implicit !== null) {
350
- implicit.variables = implicit.variables.filter(variable => {
351
- const name = variable.name;
352
- if (globalScope.set.has(name)) {
353
- implicit.set.delete(name);
354
- return false;
355
- }
356
- return true;
357
- });
225
+ for (const name of names) {
226
+ const variable = globalScope.set.get(name);
358
227
 
359
- if (implicit.left) {
360
- implicit.left = implicit.left.filter(
361
- reference => !globalScope.set.has(reference.identifier.name),
362
- );
363
- }
228
+ variable.eslintImplicitGlobalSetting = configGlobals[name];
229
+ variable.eslintExplicitGlobal = !!inlineGlobals[name];
230
+ variable.eslintExplicitGlobalComments = inlineGlobals[name]?.comments;
231
+ variable.writeable = finalGlobals[name] === "writable";
364
232
  }
365
233
  }
366
234
 
@@ -595,87 +463,6 @@ class SourceCode extends TokenStore {
595
463
  return this.ast.comments;
596
464
  }
597
465
 
598
- /**
599
- * Retrieves the JSDoc comment for a given node.
600
- * @param {ASTNode} node The AST node to get the comment for.
601
- * @returns {Token|null} The Block comment token containing the JSDoc comment
602
- * for the given node or null if not found.
603
- * @public
604
- * @deprecated
605
- */
606
- getJSDocComment(node) {
607
- /**
608
- * Checks for the presence of a JSDoc comment for the given node and returns it.
609
- * @param {ASTNode} astNode The AST node to get the comment for.
610
- * @returns {Token|null} The Block comment token containing the JSDoc comment
611
- * for the given node or null if not found.
612
- * @private
613
- */
614
- const findJSDocComment = astNode => {
615
- const tokenBefore = this.getTokenBefore(astNode, {
616
- includeComments: true,
617
- });
618
-
619
- if (
620
- tokenBefore &&
621
- isCommentToken(tokenBefore) &&
622
- tokenBefore.type === "Block" &&
623
- tokenBefore.value.charAt(0) === "*" &&
624
- astNode.loc.start.line - tokenBefore.loc.end.line <= 1
625
- ) {
626
- return tokenBefore;
627
- }
628
-
629
- return null;
630
- };
631
- let parent = node.parent;
632
-
633
- switch (node.type) {
634
- case "ClassDeclaration":
635
- case "FunctionDeclaration":
636
- return findJSDocComment(
637
- looksLikeExport(parent) ? parent : node,
638
- );
639
-
640
- case "ClassExpression":
641
- return findJSDocComment(parent.parent);
642
-
643
- case "ArrowFunctionExpression":
644
- case "FunctionExpression":
645
- if (
646
- parent.type !== "CallExpression" &&
647
- parent.type !== "NewExpression"
648
- ) {
649
- while (
650
- !this.getCommentsBefore(parent).length &&
651
- !/Function/u.test(parent.type) &&
652
- parent.type !== "MethodDefinition" &&
653
- parent.type !== "Property"
654
- ) {
655
- parent = parent.parent;
656
-
657
- if (!parent) {
658
- break;
659
- }
660
- }
661
-
662
- if (
663
- parent &&
664
- parent.type !== "FunctionDeclaration" &&
665
- parent.type !== "Program"
666
- ) {
667
- return findJSDocComment(parent);
668
- }
669
- }
670
-
671
- return findJSDocComment(node);
672
-
673
- // falls through
674
- default:
675
- return null;
676
- }
677
- }
678
-
679
466
  /**
680
467
  * Gets the deepest node containing a range index.
681
468
  * @param {number} index Range index of the desired node.
@@ -715,24 +502,33 @@ class SourceCode extends TokenStore {
715
502
  * @public
716
503
  */
717
504
  isSpaceBetween(first, second) {
718
- return isSpaceBetween(this, first, second, false);
719
- }
505
+ if (nodesOrTokensOverlap(first, second)) {
506
+ return false;
507
+ }
720
508
 
721
- /**
722
- * Determines if two nodes or tokens have at least one whitespace character
723
- * between them. Order does not matter. Returns false if the given nodes or
724
- * tokens overlap.
725
- * For backward compatibility, this method returns true if there are
726
- * `JSXText` tokens that contain whitespaces between the two.
727
- * @param {ASTNode|Token} first The first node or token to check between.
728
- * @param {ASTNode|Token} second The second node or token to check between.
729
- * @returns {boolean} True if there is a whitespace character between
730
- * any of the tokens found between the two given nodes or tokens.
731
- * @deprecated in favor of isSpaceBetween().
732
- * @public
733
- */
734
- isSpaceBetweenTokens(first, second) {
735
- return isSpaceBetween(this, first, second, true);
509
+ const [startingNodeOrToken, endingNodeOrToken] =
510
+ first.range[1] <= second.range[0]
511
+ ? [first, second]
512
+ : [second, first];
513
+ const firstToken =
514
+ this.getLastToken(startingNodeOrToken) || startingNodeOrToken;
515
+ const finalToken =
516
+ this.getFirstToken(endingNodeOrToken) || endingNodeOrToken;
517
+ let currentToken = firstToken;
518
+
519
+ while (currentToken !== finalToken) {
520
+ const nextToken = this.getTokenAfter(currentToken, {
521
+ includeComments: true,
522
+ });
523
+
524
+ if (currentToken.range[1] !== nextToken.range[0]) {
525
+ return true;
526
+ }
527
+
528
+ currentToken = nextToken;
529
+ }
530
+
531
+ return false;
736
532
  }
737
533
 
738
534
  /**
@@ -1162,6 +958,15 @@ class SourceCode extends TokenStore {
1162
958
  : void 0,
1163
959
  languageOptions.globals,
1164
960
  );
961
+
962
+ /*
963
+ * `normalizeConfigGlobal` will throw an error if a configured global value is invalid. However, these errors would
964
+ * typically be caught when validating a config anyway (validity for inline global comments is checked separately).
965
+ */
966
+ for (const [name, value] of Object.entries(configGlobals)) {
967
+ configGlobals[name] = normalizeConfigGlobal(value);
968
+ }
969
+
1165
970
  const varsCache = this[caches].get("vars");
1166
971
 
1167
972
  varsCache.set("configGlobals", configGlobals);
@@ -1243,6 +1048,15 @@ class SourceCode extends TokenStore {
1243
1048
 
1244
1049
  break;
1245
1050
  }
1051
+ case "eslint-env": {
1052
+ problems.push({
1053
+ ruleId: null,
1054
+ loc: comment.loc,
1055
+ message:
1056
+ "/* eslint-env */ comments are no longer supported.",
1057
+ });
1058
+ break;
1059
+ }
1246
1060
 
1247
1061
  // no default
1248
1062
  }
@@ -1273,7 +1087,7 @@ class SourceCode extends TokenStore {
1273
1087
  const exportedVariables = varsCache.get("exportedVariables");
1274
1088
  const globalScope = this.scopeManager.scopes[0];
1275
1089
 
1276
- addDeclaredGlobals(globalScope, configGlobals, inlineGlobals);
1090
+ addDeclaredGlobals(this.scopeManager, configGlobals, inlineGlobals);
1277
1091
 
1278
1092
  if (exportedVariables) {
1279
1093
  markExportedVariables(globalScope, exportedVariables);
@@ -444,32 +444,6 @@ module.exports = class TokenStore {
444
444
  ).getOneToken();
445
445
  }
446
446
 
447
- /**
448
- * Gets the token that precedes a given node or token in the token stream.
449
- * This is defined for backward compatibility. Use `includeComments` option instead.
450
- * TODO: We have a plan to remove this in a future major version.
451
- * @param {ASTNode|Token|Comment} node The AST node or token.
452
- * @param {number} [skip=0] A number of tokens to skip.
453
- * @returns {Token|null} An object representing the token.
454
- * @deprecated
455
- */
456
- getTokenOrCommentBefore(node, skip) {
457
- return this.getTokenBefore(node, { includeComments: true, skip });
458
- }
459
-
460
- /**
461
- * Gets the token that follows a given node or token in the token stream.
462
- * This is defined for backward compatibility. Use `includeComments` option instead.
463
- * TODO: We have a plan to remove this in a future major version.
464
- * @param {ASTNode|Token|Comment} node The AST node or token.
465
- * @param {number} [skip=0] A number of tokens to skip.
466
- * @returns {Token|null} An object representing the token.
467
- * @deprecated
468
- */
469
- getTokenOrCommentAfter(node, skip) {
470
- return this.getTokenAfter(node, { includeComments: true, skip });
471
- }
472
-
473
447
  //--------------------------------------------------------------------------
474
448
  // Gets multiple tokens.
475
449
  //--------------------------------------------------------------------------
@@ -5,7 +5,7 @@
5
5
  "use strict";
6
6
 
7
7
  //------------------------------------------------------------------------------
8
- // Exports
8
+ // Helpers
9
9
  //------------------------------------------------------------------------------
10
10
 
11
11
  /**
@@ -15,7 +15,7 @@
15
15
  * @param {number} location The location to search.
16
16
  * @returns {number} The found index or `tokens.length`.
17
17
  */
18
- exports.search = function search(tokens, location) {
18
+ function search(tokens, location) {
19
19
  for (
20
20
  let minIndex = 0, maxIndex = tokens.length - 1;
21
21
  minIndex <= maxIndex;
@@ -41,7 +41,7 @@ exports.search = function search(tokens, location) {
41
41
  }
42
42
  }
43
43
  return tokens.length;
44
- };
44
+ }
45
45
 
46
46
  /**
47
47
  * Gets the index of the `startLoc` in `tokens`.
@@ -51,7 +51,10 @@ exports.search = function search(tokens, location) {
51
51
  * @param {number} startLoc The location to get an index.
52
52
  * @returns {number} The index.
53
53
  */
54
- exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) {
54
+ function getFirstIndex(tokens, indexMap, startLoc) {
55
+ if (startLoc === -1) {
56
+ return 0;
57
+ }
55
58
  if (startLoc in indexMap) {
56
59
  return indexMap[startLoc];
57
60
  }
@@ -73,9 +76,13 @@ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) {
73
76
  }
74
77
  return index + 1;
75
78
  }
76
- return 0;
77
- };
78
79
 
80
+ // Program node that doesn't start/end with a token or comment
81
+ if (startLoc === 0) {
82
+ return 0;
83
+ }
84
+ return tokens.length;
85
+ }
79
86
  /**
80
87
  * Gets the index of the `endLoc` in `tokens`.
81
88
  * The information of end locations are recorded at `endLoc - 1` in `indexMap`, so this checks about `endLoc - 1` as well.
@@ -84,7 +91,10 @@ exports.getFirstIndex = function getFirstIndex(tokens, indexMap, startLoc) {
84
91
  * @param {number} endLoc The location to get an index.
85
92
  * @returns {number} The index.
86
93
  */
87
- exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) {
94
+ function getLastIndex(tokens, indexMap, endLoc) {
95
+ if (endLoc === -1) {
96
+ return tokens.length - 1;
97
+ }
88
98
  if (endLoc in indexMap) {
89
99
  return indexMap[endLoc] - 1;
90
100
  }
@@ -106,5 +116,16 @@ exports.getLastIndex = function getLastIndex(tokens, indexMap, endLoc) {
106
116
  }
107
117
  return index;
108
118
  }
119
+
120
+ // Program node that doesn't start/end with a token or comment
121
+ if (endLoc === 0) {
122
+ return -1;
123
+ }
109
124
  return tokens.length - 1;
110
- };
125
+ }
126
+
127
+ //------------------------------------------------------------------------------
128
+ // Exports
129
+ //------------------------------------------------------------------------------
130
+
131
+ module.exports = { search, getFirstIndex, getLastIndex };
@@ -428,7 +428,6 @@ function applyDirectives(options) {
428
428
  : column,
429
429
  severity:
430
430
  options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
431
- nodeType: null,
432
431
  ...(options.disableFixes ? {} : { fix }),
433
432
  };
434
433
  },
@@ -33,20 +33,6 @@ class FileContext {
33
33
  */
34
34
  sourceCode;
35
35
 
36
- /**
37
- * The parser options for the file being linted.
38
- * @type {Record<string, unknown>}
39
- * @deprecated Use `languageOptions` instead.
40
- */
41
- parserOptions;
42
-
43
- /**
44
- * The path to the parser used to parse this file.
45
- * @type {string}
46
- * @deprecated No longer supported.
47
- */
48
- parserPath;
49
-
50
36
  /**
51
37
  * The language options used when parsing this file.
52
38
  * @type {Record<string, unknown>}
@@ -66,8 +52,6 @@ class FileContext {
66
52
  * @param {string} config.filename The filename of the file being linted.
67
53
  * @param {string} config.physicalFilename The physical filename of the file being linted.
68
54
  * @param {SourceCode} config.sourceCode The source code of the file being linted.
69
- * @param {Record<string, unknown>} config.parserOptions The parser options for the file being linted.
70
- * @param {string} config.parserPath The path to the parser used to parse this file.
71
55
  * @param {Record<string, unknown>} config.languageOptions The language options used when parsing this file.
72
56
  * @param {Record<string, unknown>} config.settings The settings for the file being linted.
73
57
  */
@@ -76,8 +60,6 @@ class FileContext {
76
60
  filename,
77
61
  physicalFilename,
78
62
  sourceCode,
79
- parserOptions,
80
- parserPath,
81
63
  languageOptions,
82
64
  settings,
83
65
  }) {
@@ -85,50 +67,12 @@ class FileContext {
85
67
  this.filename = filename;
86
68
  this.physicalFilename = physicalFilename;
87
69
  this.sourceCode = sourceCode;
88
- this.parserOptions = parserOptions;
89
- this.parserPath = parserPath;
90
70
  this.languageOptions = languageOptions;
91
71
  this.settings = settings;
92
72
 
93
73
  Object.freeze(this);
94
74
  }
95
75
 
96
- /**
97
- * Gets the current working directory.
98
- * @returns {string} The current working directory.
99
- * @deprecated Use `cwd` instead.
100
- */
101
- getCwd() {
102
- return this.cwd;
103
- }
104
-
105
- /**
106
- * Gets the filename of the file being linted.
107
- * @returns {string} The filename of the file being linted.
108
- * @deprecated Use `filename` instead.
109
- */
110
- getFilename() {
111
- return this.filename;
112
- }
113
-
114
- /**
115
- * Gets the physical filename of the file being linted.
116
- * @returns {string} The physical filename of the file being linted.
117
- * @deprecated Use `physicalFilename` instead.
118
- */
119
- getPhysicalFilename() {
120
- return this.physicalFilename;
121
- }
122
-
123
- /**
124
- * Gets the source code of the file being linted.
125
- * @returns {SourceCode} The source code of the file being linted.
126
- * @deprecated Use `sourceCode` instead.
127
- */
128
- getSourceCode() {
129
- return this.sourceCode;
130
- }
131
-
132
76
  /**
133
77
  * Creates a new object with the current object as the prototype and
134
78
  * the specified properties as its own properties.
@@ -124,7 +124,6 @@ function createLintingProblem(options, severity, language) {
124
124
  language,
125
125
  ),
126
126
  severity,
127
- nodeType: null,
128
127
  };
129
128
  }
130
129
 
@@ -340,7 +339,6 @@ function mapSuggestions(descriptor, sourceCode, messages) {
340
339
  * @param {Object} options Information about the problem
341
340
  * @param {string} options.ruleId Rule ID
342
341
  * @param {(0|1|2)} options.severity Rule severity
343
- * @param {(ASTNode|null)} options.node Node
344
342
  * @param {string} options.message Error message
345
343
  * @param {string} [options.messageId] The error message ID.
346
344
  * @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location
@@ -362,7 +360,6 @@ function createProblem(options) {
362
360
  message: options.message,
363
361
  line: options.loc.start.line + lineOffset,
364
362
  column: options.loc.start.column + columnOffset,
365
- nodeType: (options.node && options.node.type) || null,
366
363
  };
367
364
 
368
365
  /*
@@ -548,7 +545,6 @@ class FileReport {
548
545
  createProblem({
549
546
  ruleId,
550
547
  severity,
551
- node: descriptor.node,
552
548
  message: interpolate(computedMessage, descriptor.data),
553
549
  messageId: descriptor.messageId,
554
550
  loc: descriptor.loc