eslint 9.26.0 → 9.28.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.
Files changed (41) hide show
  1. package/README.md +7 -2
  2. package/bin/eslint.js +7 -11
  3. package/conf/rule-type-list.json +2 -1
  4. package/lib/cli-engine/cli-engine.js +7 -7
  5. package/lib/cli.js +19 -16
  6. package/lib/config/config-loader.js +42 -39
  7. package/lib/config/config.js +362 -16
  8. package/lib/eslint/eslint-helpers.js +3 -1
  9. package/lib/eslint/eslint.js +31 -13
  10. package/lib/eslint/legacy-eslint.js +6 -6
  11. package/lib/languages/js/source-code/source-code.js +40 -6
  12. package/lib/linter/apply-disable-directives.js +1 -1
  13. package/lib/linter/file-context.js +11 -0
  14. package/lib/linter/linter.js +102 -140
  15. package/lib/linter/report-translator.js +2 -1
  16. package/lib/linter/{node-event-generator.js → source-code-traverser.js} +143 -87
  17. package/lib/options.js +7 -0
  18. package/lib/rule-tester/rule-tester.js +3 -3
  19. package/lib/rules/func-style.js +57 -7
  20. package/lib/rules/index.js +1 -0
  21. package/lib/rules/max-params.js +32 -7
  22. package/lib/rules/no-array-constructor.js +51 -1
  23. package/lib/rules/no-implicit-globals.js +31 -15
  24. package/lib/rules/no-magic-numbers.js +98 -5
  25. package/lib/rules/no-shadow.js +262 -6
  26. package/lib/rules/no-unassigned-vars.js +80 -0
  27. package/lib/rules/no-use-before-define.js +97 -1
  28. package/lib/rules/no-useless-escape.js +24 -2
  29. package/lib/rules/prefer-arrow-callback.js +9 -0
  30. package/lib/rules/prefer-named-capture-group.js +7 -1
  31. package/lib/services/processor-service.js +1 -1
  32. package/lib/services/suppressions-service.js +5 -3
  33. package/lib/services/warning-service.js +85 -0
  34. package/lib/shared/flags.js +1 -0
  35. package/lib/types/index.d.ts +132 -9
  36. package/lib/types/rules.d.ts +66 -3
  37. package/package.json +11 -11
  38. package/lib/config/flat-config-helpers.js +0 -128
  39. package/lib/config/rule-validator.js +0 -199
  40. package/lib/mcp/mcp-server.js +0 -66
  41. package/lib/shared/types.js +0 -229
@@ -30,6 +30,9 @@ function parseOptions(options) {
30
30
  classes: true,
31
31
  variables: true,
32
32
  allowNamedExports: false,
33
+ enums: true,
34
+ typedefs: true,
35
+ ignoreTypeReferences: true,
33
36
  };
34
37
  }
35
38
 
@@ -208,6 +211,57 @@ function isEvaluatedDuringInitialization(reference) {
208
211
  return false;
209
212
  }
210
213
 
214
+ /**
215
+ * check whether the reference contains a type query.
216
+ * @param {ASTNode} node Identifier node to check.
217
+ * @returns {boolean} true if reference contains type query.
218
+ */
219
+ function referenceContainsTypeQuery(node) {
220
+ switch (node.type) {
221
+ case "TSTypeQuery":
222
+ return true;
223
+
224
+ case "TSQualifiedName":
225
+ case "Identifier":
226
+ return referenceContainsTypeQuery(node.parent);
227
+
228
+ default:
229
+ // if we find a different node, there's no chance that we're in a TSTypeQuery
230
+ return false;
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Decorators are transpiled such that the decorator is placed after the class declaration
236
+ * So it is considered safe
237
+ * @param {Variable} variable The variable to check.
238
+ * @param {Reference} reference The reference to check.
239
+ * @returns {boolean} `true` if the reference is in a class decorator.
240
+ */
241
+ function isClassRefInClassDecorator(variable, reference) {
242
+ if (variable.defs[0].type !== "ClassName") {
243
+ return false;
244
+ }
245
+
246
+ if (
247
+ !variable.defs[0].node.decorators ||
248
+ variable.defs[0].node.decorators.length === 0
249
+ ) {
250
+ return false;
251
+ }
252
+
253
+ for (const deco of variable.defs[0].node.decorators) {
254
+ if (
255
+ reference.identifier.range[0] >= deco.range[0] &&
256
+ reference.identifier.range[1] <= deco.range[1]
257
+ ) {
258
+ return true;
259
+ }
260
+ }
261
+
262
+ return false;
263
+ }
264
+
211
265
  //------------------------------------------------------------------------------
212
266
  // Rule Definition
213
267
  //------------------------------------------------------------------------------
@@ -237,6 +291,9 @@ module.exports = {
237
291
  classes: { type: "boolean" },
238
292
  variables: { type: "boolean" },
239
293
  allowNamedExports: { type: "boolean" },
294
+ enums: { type: "boolean" },
295
+ typedefs: { type: "boolean" },
296
+ ignoreTypeReferences: { type: "boolean" },
240
297
  },
241
298
  additionalProperties: false,
242
299
  },
@@ -250,6 +307,9 @@ module.exports = {
250
307
  functions: true,
251
308
  variables: true,
252
309
  allowNamedExports: false,
310
+ enums: true,
311
+ typedefs: true,
312
+ ignoreTypeReferences: true,
253
313
  },
254
314
  ],
255
315
 
@@ -310,6 +370,41 @@ module.exports = {
310
370
  return false;
311
371
  }
312
372
 
373
+ if (!options.enums && definitionType === "TSEnumName") {
374
+ return false;
375
+ }
376
+
377
+ if (!options.typedefs && definitionType === "Type") {
378
+ return false;
379
+ }
380
+
381
+ if (
382
+ options.ignoreTypeReferences &&
383
+ (referenceContainsTypeQuery(identifier) ||
384
+ identifier.parent.type === "TSTypeReference")
385
+ ) {
386
+ return false;
387
+ }
388
+
389
+ // skip nested namespace aliases as variable references
390
+ if (identifier.parent.type === "TSQualifiedName") {
391
+ let currentNode = identifier.parent;
392
+
393
+ while (currentNode.type === "TSQualifiedName") {
394
+ currentNode = currentNode.left;
395
+ }
396
+
397
+ if (currentNode === identifier) {
398
+ return true;
399
+ }
400
+
401
+ return false;
402
+ }
403
+
404
+ if (isClassRefInClassDecorator(variable, reference)) {
405
+ return false;
406
+ }
407
+
313
408
  return true;
314
409
  }
315
410
 
@@ -326,7 +421,8 @@ module.exports = {
326
421
  if (
327
422
  reference.identifier.range[1] <
328
423
  definitionIdentifier.range[1] ||
329
- isEvaluatedDuringInitialization(reference)
424
+ (isEvaluatedDuringInitialization(reference) &&
425
+ reference.identifier.parent.type !== "TSTypeReference")
330
426
  ) {
331
427
  context.report({
332
428
  node: reference.identifier,
@@ -60,6 +60,12 @@ module.exports = {
60
60
  meta: {
61
61
  type: "suggestion",
62
62
 
63
+ defaultOptions: [
64
+ {
65
+ allowRegexCharacters: [],
66
+ },
67
+ ],
68
+
63
69
  docs: {
64
70
  description: "Disallow unnecessary escape characters",
65
71
  recommended: true,
@@ -78,11 +84,26 @@ module.exports = {
78
84
  "Replace the `\\` with `\\\\` to include the actual backslash character.",
79
85
  },
80
86
 
81
- schema: [],
87
+ schema: [
88
+ {
89
+ type: "object",
90
+ properties: {
91
+ allowRegexCharacters: {
92
+ type: "array",
93
+ items: {
94
+ type: "string",
95
+ },
96
+ uniqueItems: true,
97
+ },
98
+ },
99
+ additionalProperties: false,
100
+ },
101
+ ],
82
102
  },
83
103
 
84
104
  create(context) {
85
105
  const sourceCode = context.sourceCode;
106
+ const [{ allowRegexCharacters }] = context.options;
86
107
  const parser = new RegExpParser();
87
108
 
88
109
  /**
@@ -217,7 +238,8 @@ module.exports = {
217
238
 
218
239
  if (
219
240
  escapedChar !==
220
- String.fromCodePoint(characterNode.value)
241
+ String.fromCodePoint(characterNode.value) ||
242
+ allowRegexCharacters.includes(escapedChar)
221
243
  ) {
222
244
  // It's a valid escape.
223
245
  return;
@@ -151,6 +151,8 @@ function hasDuplicateParams(paramsList) {
151
151
  module.exports = {
152
152
  meta: {
153
153
  type: "suggestion",
154
+ dialects: ["javascript", "typescript"],
155
+ language: "javascript",
154
156
 
155
157
  defaultOptions: [
156
158
  { allowNamedFunctions: false, allowUnboundThis: true },
@@ -308,6 +310,13 @@ module.exports = {
308
310
  return;
309
311
  }
310
312
 
313
+ if (
314
+ node.params.length &&
315
+ node.params[0].name === "this"
316
+ ) {
317
+ return;
318
+ }
319
+
311
320
  // Remove `.bind(this)` if exists.
312
321
  if (callbackInfo.isLexicalThis) {
313
322
  const memberNode = node.parent;
@@ -17,6 +17,12 @@ const {
17
17
  } = require("@eslint-community/eslint-utils");
18
18
  const regexpp = require("@eslint-community/regexpp");
19
19
 
20
+ //------------------------------------------------------------------------------
21
+ // Typedefs
22
+ //------------------------------------------------------------------------------
23
+
24
+ /** @import { SuggestedEdit } from "@eslint/core"; */
25
+
20
26
  //------------------------------------------------------------------------------
21
27
  // Helpers
22
28
  //------------------------------------------------------------------------------
@@ -29,7 +35,7 @@ const parser = new regexpp.RegExpParser();
29
35
  * @param {string} pattern The regular expression pattern to be checked.
30
36
  * @param {string} rawText Source text of the regexNode.
31
37
  * @param {ASTNode} regexNode AST node which contains the regular expression.
32
- * @returns {Array<SuggestionResult>} Fixer suggestions for the regex, if statically determinable.
38
+ * @returns {Array<SuggestedEdit>} Fixer suggestions for the regex, if statically determinable.
33
39
  */
34
40
  function suggestIfPossible(groupStart, pattern, rawText, regexNode) {
35
41
  switch (regexNode.type) {
@@ -17,7 +17,7 @@ const { VFile } = require("../linter/vfile.js");
17
17
  // Types
18
18
  //-----------------------------------------------------------------------------
19
19
 
20
- /** @typedef {import("../shared/types.js").LintMessage} LintMessage */
20
+ /** @typedef {import("../types").Linter.LintMessage} LintMessage */
21
21
  /** @typedef {import("../linter/vfile.js").VFile} VFile */
22
22
  /** @typedef {import("@eslint/core").Language} Language */
23
23
  /** @typedef {import("eslint").Linter.Processor} Processor */
@@ -12,14 +12,16 @@
12
12
  const fs = require("node:fs");
13
13
  const path = require("node:path");
14
14
  const { calculateStatsPerFile } = require("../eslint/eslint-helpers");
15
+ const stringify = require("json-stable-stringify-without-jsonify");
15
16
 
16
17
  //------------------------------------------------------------------------------
17
18
  // Typedefs
18
19
  //------------------------------------------------------------------------------
19
20
 
20
21
  // For VSCode IntelliSense
21
- /** @typedef {import("../shared/types").LintResult} LintResult */
22
- /** @typedef {import("../shared/types").SuppressedViolations} SuppressedViolations */
22
+ /** @typedef {import("../types").Linter.LintMessage} LintMessage */
23
+ /** @typedef {import("../types").ESLint.LintResult} LintResult */
24
+ /** @typedef {Record<string, Record<string, { count: number; }>>} SuppressedViolations */
23
25
 
24
26
  //-----------------------------------------------------------------------------
25
27
  // Exports
@@ -224,7 +226,7 @@ class SuppressionsService {
224
226
  save(suppressions) {
225
227
  return fs.promises.writeFile(
226
228
  this.filePath,
227
- JSON.stringify(suppressions, null, 2),
229
+ stringify(suppressions, { space: 2 }),
228
230
  );
229
231
  }
230
232
 
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @fileoverview Emits warnings for ESLint.
3
+ * @author Francesco Trotta
4
+ */
5
+
6
+ "use strict";
7
+
8
+ //-----------------------------------------------------------------------------
9
+ // Exports
10
+ //-----------------------------------------------------------------------------
11
+
12
+ /**
13
+ * A service that emits warnings for ESLint.
14
+ */
15
+ class WarningService {
16
+ /**
17
+ * Creates a new instance of the service.
18
+ * @param {{ emitWarning?: ((warning: string, type: string) => void) | undefined }} [options] A function called internally to emit warnings using API provided by the runtime.
19
+ */
20
+ constructor({
21
+ emitWarning = globalThis.process?.emitWarning ?? (() => {}),
22
+ } = {}) {
23
+ this.emitWarning = emitWarning;
24
+ }
25
+
26
+ /**
27
+ * Emits a warning when circular fixes are detected while fixing a file.
28
+ * This method is used by the Linter and is safe to call outside Node.js.
29
+ * @param {string} filename The name of the file being fixed.
30
+ * @returns {void}
31
+ */
32
+ emitCircularFixesWarning(filename) {
33
+ this.emitWarning(
34
+ `Circular fixes detected while fixing ${filename}. It is likely that you have conflicting rules in your configuration.`,
35
+ "ESLintCircularFixesWarning",
36
+ );
37
+ }
38
+
39
+ /**
40
+ * Emits a warning when an empty config file has been loaded.
41
+ * @param {string} configFilePath The path to the config file.
42
+ * @returns {void}
43
+ */
44
+ emitEmptyConfigWarning(configFilePath) {
45
+ this.emitWarning(
46
+ `Running ESLint with an empty config (from ${configFilePath}). Please double-check that this is what you want. If you want to run ESLint with an empty config, export [{}] to remove this warning.`,
47
+ "ESLintEmptyConfigWarning",
48
+ );
49
+ }
50
+
51
+ /**
52
+ * Emits a warning when an ".eslintignore" file is found.
53
+ * @returns {void}
54
+ */
55
+ emitESLintIgnoreWarning() {
56
+ this.emitWarning(
57
+ 'The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files',
58
+ "ESLintIgnoreWarning",
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Emits a warning when the ESLINT_USE_FLAT_CONFIG environment variable is set to "false".
64
+ * @returns {void}
65
+ */
66
+ emitESLintRCWarning() {
67
+ this.emitWarning(
68
+ "You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.",
69
+ "ESLintRCWarning",
70
+ );
71
+ }
72
+
73
+ /**
74
+ * Emits a warning when an inactive flag is used.
75
+ * This method is used by the Linter and is safe to call outside Node.js.
76
+ * @param {string} flag The name of the flag.
77
+ * @param {string} message The warning message.
78
+ * @returns {void}
79
+ */
80
+ emitInactiveFlagWarning(flag, message) {
81
+ this.emitWarning(message, `ESLintInactiveFlag_${flag}`);
82
+ }
83
+ }
84
+
85
+ module.exports = { WarningService };
@@ -27,6 +27,7 @@
27
27
  */
28
28
  const activeFlags = new Map([
29
29
  ["test_only", "Used only for testing."],
30
+ ["test_only_2", "Used only for testing."],
30
31
  [
31
32
  "unstable_config_lookup_from_file",
32
33
  "Look up `eslint.config.js` from the file being linted.",
@@ -584,6 +584,11 @@ export namespace SourceCode {
584
584
 
585
585
  // #endregion
586
586
 
587
+ export type JSSyntaxElement = {
588
+ type: string;
589
+ loc?: ESTree.SourceLocation | null | undefined;
590
+ };
591
+
587
592
  export namespace Rule {
588
593
  interface RuleModule
589
594
  extends RuleDefinition<{
@@ -591,7 +596,7 @@ export namespace Rule {
591
596
  Code: SourceCode;
592
597
  RuleOptions: any[];
593
598
  Visitor: NodeListener;
594
- Node: ESTree.Node;
599
+ Node: JSSyntaxElement;
595
600
  MessageIds: string;
596
601
  ExtRuleDocs: {};
597
602
  }> {
@@ -1159,10 +1164,10 @@ export namespace Rule {
1159
1164
  /**
1160
1165
  * Indicates the type of rule:
1161
1166
  * - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
1162
- * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isnt changed.
1167
+ * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn't changed.
1163
1168
  * - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses,
1164
1169
  * all the parts of the program that determine how the code looks rather than how it executes.
1165
- * These rules work on parts of the code that arent specified in the AST.
1170
+ * These rules work on parts of the code that aren't specified in the AST.
1166
1171
  */
1167
1172
  type?: "problem" | "suggestion" | "layout" | undefined;
1168
1173
  /**
@@ -1177,7 +1182,7 @@ export namespace Rule {
1177
1182
  LangOptions: Linter.LanguageOptions;
1178
1183
  Code: SourceCode;
1179
1184
  RuleOptions: any[];
1180
- Node: ESTree.Node;
1185
+ Node: JSSyntaxElement;
1181
1186
  MessageIds: string;
1182
1187
  }> {
1183
1188
  /*
@@ -1275,7 +1280,7 @@ export type JSRuleDefinition<
1275
1280
  LangOptions: Linter.LanguageOptions;
1276
1281
  Code: SourceCode;
1277
1282
  Visitor: Rule.NodeListener;
1278
- Node: ESTree.Node;
1283
+ Node: JSSyntaxElement;
1279
1284
  } & Required<
1280
1285
  // Rule specific type options (custom)
1281
1286
  Options &
@@ -1560,9 +1565,16 @@ export namespace Linter {
1560
1565
  /**
1561
1566
  * Parser options.
1562
1567
  *
1563
- * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options)
1568
+ * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
1564
1569
  */
1565
1570
  interface ParserOptions {
1571
+ /**
1572
+ * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
1573
+ *
1574
+ * @default false
1575
+ */
1576
+ allowReserved?: boolean | undefined;
1577
+
1566
1578
  /**
1567
1579
  * Accepts any valid ECMAScript version number or `'latest'`:
1568
1580
  *
@@ -1619,26 +1631,54 @@ export namespace Linter {
1619
1631
  }
1620
1632
 
1621
1633
  interface LintSuggestion {
1634
+ /** A short description. */
1622
1635
  desc: string;
1636
+
1637
+ /** Fix result info. */
1623
1638
  fix: Rule.Fix;
1639
+
1640
+ /** Id referencing a message for the description. */
1624
1641
  messageId?: string | undefined;
1625
1642
  }
1626
1643
 
1627
1644
  interface LintMessage {
1645
+ /** The 1-based column number. */
1628
1646
  column: number;
1647
+
1648
+ /** The 1-based line number. */
1629
1649
  line: number;
1650
+
1651
+ /** The 1-based column number of the end location. */
1630
1652
  endColumn?: number | undefined;
1653
+
1654
+ /** The 1-based line number of the end location. */
1631
1655
  endLine?: number | undefined;
1656
+
1657
+ /** The ID of the rule which makes this message. */
1632
1658
  ruleId: string | null;
1659
+
1660
+ /** The reported message. */
1633
1661
  message: string;
1662
+
1663
+ /** The ID of the message in the rule's meta. */
1634
1664
  messageId?: string | undefined;
1665
+
1635
1666
  /**
1667
+ * Type of node.
1636
1668
  * @deprecated `nodeType` is deprecated and will be removed in the next major version.
1637
1669
  */
1638
1670
  nodeType?: string | undefined;
1671
+
1672
+ /** If `true` then this is a fatal error. */
1639
1673
  fatal?: true | undefined;
1674
+
1675
+ /** The severity of this message. */
1640
1676
  severity: Exclude<Severity, 0>;
1677
+
1678
+ /** Information for autofix. */
1641
1679
  fix?: Rule.Fix | undefined;
1680
+
1681
+ /** Information for suggestions. */
1642
1682
  suggestions?: LintSuggestion[] | undefined;
1643
1683
  }
1644
1684
 
@@ -1648,6 +1688,7 @@ export namespace Linter {
1648
1688
  }
1649
1689
 
1650
1690
  interface SuppressedLintMessage extends LintMessage {
1691
+ /** The suppression info. */
1651
1692
  suppressions: LintSuppression[];
1652
1693
  }
1653
1694
 
@@ -1661,8 +1702,8 @@ export namespace Linter {
1661
1702
  messages: LintMessage[];
1662
1703
  }
1663
1704
 
1664
- // Temporarily loosen type for just flat config files (see #68232)
1665
- type NonESTreeParser = Omit<ESTreeParser, "parseForESLint"> &
1705
+ // Temporarily loosen type for just flat config files (see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/68232)
1706
+ type NonESTreeParser = ESLint.ObjectMetaProperties &
1666
1707
  (
1667
1708
  | {
1668
1709
  parse(text: string, options?: any): unknown;
@@ -1687,9 +1728,16 @@ export namespace Linter {
1687
1728
  type Parser = NonESTreeParser | ESTreeParser;
1688
1729
 
1689
1730
  interface ESLintParseResult {
1731
+ /** The AST object. */
1690
1732
  ast: AST.Program;
1691
- parserServices?: SourceCode.ParserServices | undefined;
1733
+
1734
+ /** The services that the parser provides. */
1735
+ services?: SourceCode.ParserServices | undefined;
1736
+
1737
+ /** The scope manager of the AST. */
1692
1738
  scopeManager?: Scope.ScopeManager | undefined;
1739
+
1740
+ /** The visitor keys of the AST. */
1693
1741
  visitorKeys?: SourceCode.VisitorKeys | undefined;
1694
1742
  }
1695
1743
 
@@ -1702,8 +1750,13 @@ export namespace Linter {
1702
1750
  interface Processor<
1703
1751
  T extends string | ProcessorFile = string | ProcessorFile,
1704
1752
  > extends ESLint.ObjectMetaProperties {
1753
+ /** If `true` then it means the processor supports autofix. */
1705
1754
  supportsAutofix?: boolean | undefined;
1755
+
1756
+ /** The function to extract code blocks. */
1706
1757
  preprocess?(text: string, filename: string): T[];
1758
+
1759
+ /** The function to merge messages. */
1707
1760
  postprocess?(
1708
1761
  messages: LintMessage[][],
1709
1762
  filename: string,
@@ -1844,6 +1897,9 @@ export namespace Linter {
1844
1897
  reportUnusedInlineConfigs?: Severity | StringSeverity;
1845
1898
  }
1846
1899
 
1900
+ /**
1901
+ * Performance statistics.
1902
+ */
1847
1903
  interface Stats {
1848
1904
  /**
1849
1905
  * The number of times ESLint has applied at least one fix after linting.
@@ -1857,9 +1913,24 @@ export namespace Linter {
1857
1913
  }
1858
1914
 
1859
1915
  interface TimePass {
1916
+ /**
1917
+ * The parse object containing all parse time information.
1918
+ */
1860
1919
  parse: { total: number };
1920
+
1921
+ /**
1922
+ * The rules object containing all lint time information for each rule.
1923
+ */
1861
1924
  rules?: Record<string, { total: number }>;
1925
+
1926
+ /**
1927
+ * The fix object containing all fix time information.
1928
+ */
1862
1929
  fix: { total: number };
1930
+
1931
+ /**
1932
+ * The total time that is spent on (parsing, fixing, linting) a file.
1933
+ */
1863
1934
  total: number;
1864
1935
  }
1865
1936
  }
@@ -1915,7 +1986,10 @@ export namespace ESLint {
1915
1986
  Omit<Linter.LegacyConfig<Rules>, "$schema">;
1916
1987
 
1917
1988
  interface Environment {
1989
+ /** The definition of global variables. */
1918
1990
  globals?: Linter.Globals | undefined;
1991
+
1992
+ /** The parser options that will be enabled under this environment. */
1919
1993
  parserOptions?: Linter.ParserOptions | undefined;
1920
1994
  }
1921
1995
 
@@ -2022,21 +2096,48 @@ export namespace ESLint {
2022
2096
  flags?: string[] | undefined;
2023
2097
  }
2024
2098
 
2099
+ /** A linting result. */
2025
2100
  interface LintResult {
2101
+ /** The path to the file that was linted. */
2026
2102
  filePath: string;
2103
+
2104
+ /** All of the messages for the result. */
2027
2105
  messages: Linter.LintMessage[];
2106
+
2107
+ /** All of the suppressed messages for the result. */
2028
2108
  suppressedMessages: Linter.SuppressedLintMessage[];
2109
+
2110
+ /** Number of errors for the result. */
2029
2111
  errorCount: number;
2112
+
2113
+ /** Number of fatal errors for the result. */
2030
2114
  fatalErrorCount: number;
2115
+
2116
+ /** Number of warnings for the result. */
2031
2117
  warningCount: number;
2118
+
2119
+ /** Number of fixable errors for the result. */
2032
2120
  fixableErrorCount: number;
2121
+
2122
+ /** Number of fixable warnings for the result. */
2033
2123
  fixableWarningCount: number;
2124
+
2125
+ /** The source code of the file that was linted, with as many fixes applied as possible. */
2034
2126
  output?: string | undefined;
2127
+
2128
+ /** The source code of the file that was linted. */
2035
2129
  source?: string | undefined;
2130
+
2131
+ /** The performance statistics collected with the `stats` flag. */
2036
2132
  stats?: Linter.Stats | undefined;
2133
+
2134
+ /** The list of used deprecated rules. */
2037
2135
  usedDeprecatedRules: DeprecatedRuleUse[];
2038
2136
  }
2039
2137
 
2138
+ /**
2139
+ * Information provided when the maximum warning threshold is exceeded.
2140
+ */
2040
2141
  interface MaxWarningsExceeded {
2041
2142
  /**
2042
2143
  * Number of warnings to trigger nonzero exit code.
@@ -2057,12 +2158,34 @@ export namespace ESLint {
2057
2158
  };
2058
2159
  }
2059
2160
 
2161
+ /**
2162
+ * Information about deprecated rules.
2163
+ */
2060
2164
  interface DeprecatedRuleUse {
2165
+ /**
2166
+ * The rule ID.
2167
+ */
2061
2168
  ruleId: string;
2169
+
2170
+ /**
2171
+ * The rule IDs that replace this deprecated rule.
2172
+ */
2062
2173
  replacedBy: string[];
2174
+
2175
+ /**
2176
+ * The raw deprecated info provided by the rule.
2177
+ * Unset if the rule's `meta.deprecated` property is a boolean.
2178
+ */
2179
+ info?: DeprecatedInfo;
2063
2180
  }
2064
2181
 
2182
+ /**
2183
+ * Metadata about results for formatters.
2184
+ */
2065
2185
  interface ResultsMeta {
2186
+ /**
2187
+ * Present if the maxWarnings threshold was exceeded.
2188
+ */
2066
2189
  maxWarningsExceeded?: MaxWarningsExceeded | undefined;
2067
2190
  }
2068
2191