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
package/README.md CHANGED
@@ -286,6 +286,11 @@ Josh Goldberg ✨
286
286
  <img src="https://github.com/Tanujkanti4441.png?s=75" width="75" height="75" alt="Tanuj Kanti's Avatar"><br />
287
287
  Tanuj Kanti
288
288
  </a>
289
+ </td><td align="center" valign="top" width="11%">
290
+ <a href="https://github.com/lumirlumir">
291
+ <img src="https://github.com/lumirlumir.png?s=75" width="75" height="75" alt="루밀LuMir's Avatar"><br />
292
+ 루밀LuMir
293
+ </a>
289
294
  </td></tr></tbody></table>
290
295
 
291
296
  ### Website Team
@@ -320,11 +325,11 @@ The following companies, organizations, and individuals support ESLint's ongoing
320
325
  to get your logo on our READMEs and [website](https://eslint.org/sponsors).
321
326
 
322
327
  <h3>Diamond Sponsors</h3>
323
- <p><a href="https://www.ag-grid.com/"><img src="https://images.opencollective.com/ag-grid/2c8d545/logo.png" alt="AG Grid" height="128"></a></p><h3>Platinum Sponsors</h3>
328
+ <p><a href="https://www.ag-grid.com/"><img src="https://images.opencollective.com/ag-grid/bec0580/logo.png" alt="AG Grid" height="128"></a></p><h3>Platinum Sponsors</h3>
324
329
  <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
325
330
  <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://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" 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>
326
331
  <p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" 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>
327
- <p><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://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" 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="LambdaTest" height="32"></a></p>
332
+ <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://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" 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="LambdaTest" height="32"></a></p>
328
333
  <h3>Technology Sponsors</h3>
329
334
  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.
330
335
  <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
package/bin/eslint.js CHANGED
@@ -157,19 +157,15 @@ ${getErrorMessage(error)}`;
157
157
 
158
158
  // start the MCP server if `--mcp` is present
159
159
  if (process.argv.includes("--mcp")) {
160
- const { mcpServer } = require("../lib/mcp/mcp-server");
161
- const {
162
- StdioServerTransport,
163
- } = require("@modelcontextprotocol/sdk/server/stdio.js");
164
-
165
- await mcpServer.connect(new StdioServerTransport());
160
+ console.warn(
161
+ "You can also run this command directly using 'npx @eslint/mcp@latest'.",
162
+ );
166
163
 
167
- // Note: do not use console.log() because stdout is part of the server transport
168
- console.error(`ESLint MCP server is running. cwd: ${process.cwd()}`);
164
+ const spawn = require("cross-spawn");
169
165
 
170
- process.on("SIGINT", () => {
171
- mcpServer.close();
172
- process.exitCode = 0;
166
+ spawn.sync("npx", ["@eslint/mcp@latest"], {
167
+ encoding: "utf8",
168
+ stdio: "inherit",
173
169
  });
174
170
  return;
175
171
  }
@@ -69,7 +69,8 @@
69
69
  "removed": "space-in-brackets",
70
70
  "replacedBy": [
71
71
  { "rule": { "name": "object-curly-spacing" } },
72
- { "rule": { "name": "array-bracket-spacing" } }
72
+ { "rule": { "name": "array-bracket-spacing" } },
73
+ { "rule": { "name": "computed-property-spacing" } }
73
74
  ]
74
75
  },
75
76
  {
@@ -58,15 +58,15 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
58
58
  //------------------------------------------------------------------------------
59
59
 
60
60
  // For VSCode IntelliSense
61
- /** @typedef {import("../shared/types").ConfigData} ConfigData */
62
- /** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
63
- /** @typedef {import("../shared/types").LintMessage} LintMessage */
64
- /** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */
65
- /** @typedef {import("../shared/types").ParserOptions} ParserOptions */
66
- /** @typedef {import("../shared/types").RuleConf} RuleConf */
67
- /** @typedef {import("../types").Rule.RuleModule} Rule */
61
+ /** @typedef {import("../types").ESLint.ConfigData} ConfigData */
62
+ /** @typedef {import("../types").ESLint.DeprecatedRuleUse} DeprecatedRuleInfo */
68
63
  /** @typedef {import("../types").ESLint.FormatterFunction} FormatterFunction */
64
+ /** @typedef {import("../types").Linter.LintMessage} LintMessage */
65
+ /** @typedef {import("../types").Linter.ParserOptions} ParserOptions */
69
66
  /** @typedef {import("../types").ESLint.Plugin} Plugin */
67
+ /** @typedef {import("../types").Rule.RuleModule} Rule */
68
+ /** @typedef {import("../types").Linter.RuleEntry} RuleConf */
69
+ /** @typedef {import("../types").Linter.SuppressedLintMessage} SuppressedLintMessage */
70
70
  /** @typedef {ReturnType<CascadingConfigArrayFactory.getConfigArrayForFile>} ConfigArray */
71
71
  /** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
72
72
 
package/lib/cli.js CHANGED
@@ -40,12 +40,13 @@ const debug = require("debug")("eslint:cli");
40
40
  // Types
41
41
  //------------------------------------------------------------------------------
42
42
 
43
- /** @typedef {import("./eslint/eslint").ESLintOptions} ESLintOptions */
44
- /** @typedef {import("./eslint/eslint").LintMessage} LintMessage */
45
- /** @typedef {import("./eslint/eslint").LintResult} LintResult */
43
+ /** @import { ESLintOptions } from "./eslint/eslint.js" */
44
+
46
45
  /** @typedef {import("./options").ParsedCLIOptions} ParsedCLIOptions */
47
- /** @typedef {import("./shared/types").ResultsMeta} ResultsMeta */
46
+ /** @typedef {import("./types").Linter.LintMessage} LintMessage */
47
+ /** @typedef {import("./types").ESLint.LintResult} LintResult */
48
48
  /** @typedef {import("./types").ESLint.Plugin} Plugin */
49
+ /** @typedef {import("./types").ESLint.ResultsMeta} ResultsMeta */
49
50
 
50
51
  //------------------------------------------------------------------------------
51
52
  // Helpers
@@ -438,10 +439,8 @@ const cli = {
438
439
  debug("Using flat config?", usingFlatConfig);
439
440
 
440
441
  if (allowFlatConfig && !usingFlatConfig) {
441
- process.emitWarning(
442
- "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.",
443
- "ESLintRCWarning",
444
- );
442
+ const { WarningService } = require("./services/warning-service");
443
+ new WarningService().emitESLintRCWarning();
445
444
  }
446
445
 
447
446
  const CLIOptions = createCLIOptions(usingFlatConfig);
@@ -735,17 +734,21 @@ const cli = {
735
734
  );
736
735
  }
737
736
 
738
- const unusedSuppressionsCount =
739
- Object.keys(unusedSuppressions).length;
737
+ if (!options.passOnUnprunedSuppressions) {
738
+ const unusedSuppressionsCount =
739
+ Object.keys(unusedSuppressions).length;
740
740
 
741
- if (unusedSuppressionsCount > 0) {
742
- log.error(
743
- "There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.",
744
- );
745
- debug(JSON.stringify(unusedSuppressions, null, 2));
741
+ if (unusedSuppressionsCount > 0) {
742
+ log.error(
743
+ "There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.",
744
+ );
745
+ debug(JSON.stringify(unusedSuppressions, null, 2));
746
+
747
+ return 2;
748
+ }
746
749
  }
747
750
 
748
- if (shouldExitForFatalErrors || unusedSuppressionsCount > 0) {
751
+ if (shouldExitForFatalErrors) {
749
752
  return 2;
750
753
  }
751
754
 
@@ -15,25 +15,25 @@ const findUp = require("find-up");
15
15
  const { pathToFileURL } = require("node:url");
16
16
  const debug = require("debug")("eslint:config-loader");
17
17
  const { FlatConfigArray } = require("./flat-config-array");
18
+ const { WarningService } = require("../services/warning-service");
18
19
 
19
20
  //-----------------------------------------------------------------------------
20
21
  // Types
21
22
  //-----------------------------------------------------------------------------
22
23
 
23
- /**
24
- * @import { ConfigData, ConfigData as FlatConfigObject } from "../shared/types.js";
25
- */
24
+ /** @typedef {import("../types").Linter.Config} Config */
26
25
 
27
26
  /**
28
27
  * @typedef {Object} ConfigLoaderOptions
29
28
  * @property {string|false|undefined} configFile The path to the config file to use.
30
29
  * @property {string} cwd The current working directory.
31
30
  * @property {boolean} ignoreEnabled Indicates if ignore patterns should be honored.
32
- * @property {FlatConfigArray} [baseConfig] The base config to use.
33
- * @property {Array<FlatConfigObject>} [defaultConfigs] The default configs to use.
31
+ * @property {Config|Array<Config>} [baseConfig] The base config to use.
32
+ * @property {Array<Config>} [defaultConfigs] The default configs to use.
34
33
  * @property {Array<string>} [ignorePatterns] The ignore patterns to use.
35
- * @property {FlatConfigObject|Array<FlatConfigObject>} [overrideConfig] The override config to use.
34
+ * @property {Config|Array<Config>} [overrideConfig] The override config to use.
36
35
  * @property {boolean} [hasUnstableNativeNodeJsTSConfigFlag] The flag to indicate whether the `unstable_native_nodejs_ts_config` flag is enabled.
36
+ * @property {WarningService} [warningService] The warning service to use.
37
37
  */
38
38
 
39
39
  //------------------------------------------------------------------------------
@@ -139,12 +139,13 @@ function isNativeTypeScriptSupportEnabled() {
139
139
  * @since 9.24.0
140
140
  */
141
141
  async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
142
- // eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing
143
- const { createJiti } = await ConfigLoader.loadJiti().catch(() => {
144
- throw new Error(
145
- "The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.",
146
- );
147
- });
142
+ const { createJiti, version: jitiVersion } =
143
+ // eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing
144
+ await ConfigLoader.loadJiti().catch(() => {
145
+ throw new Error(
146
+ "The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.",
147
+ );
148
+ });
148
149
 
149
150
  // `createJiti` was added in jiti v2.
150
151
  if (typeof createJiti !== "function") {
@@ -157,11 +158,15 @@ async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
157
158
  * Disabling `moduleCache` allows us to reload a
158
159
  * config file when the last modified timestamp changes.
159
160
  */
160
-
161
- const jiti = createJiti(__filename, {
161
+ const jitiOptions = {
162
162
  moduleCache: false,
163
- interopDefault: false,
164
- });
163
+ };
164
+
165
+ if (jitiVersion.startsWith("2.1.")) {
166
+ jitiOptions.interopDefault = false;
167
+ }
168
+
169
+ const jiti = createJiti(__filename, jitiOptions);
165
170
  const config = await jiti.import(fileURL.href);
166
171
 
167
172
  importedConfigFileModificationTime.set(filePath, mtime);
@@ -303,7 +308,9 @@ class ConfigLoader {
303
308
  * @param {ConfigLoaderOptions} options The options to use when loading configuration files.
304
309
  */
305
310
  constructor(options) {
306
- this.#options = options;
311
+ this.#options = options.warningService
312
+ ? options
313
+ : { ...options, warningService: new WarningService() };
307
314
  }
308
315
 
309
316
  /**
@@ -394,8 +401,7 @@ class ConfigLoader {
394
401
  * This is the same logic used by the ESLint CLI executable to determine
395
402
  * configuration for each file it processes.
396
403
  * @param {string} filePath The path of the file or directory to retrieve config for.
397
- * @returns {Promise<ConfigData|undefined>} A configuration object for the file
398
- * or `undefined` if there is no configuration data for the file.
404
+ * @returns {Promise<FlatConfigArray>} A configuration object for the file.
399
405
  * @throws {Error} If no configuration for `filePath` exists.
400
406
  */
401
407
  async loadConfigArrayForFile(filePath) {
@@ -415,8 +421,7 @@ class ConfigLoader {
415
421
  * This is the same logic used by the ESLint CLI executable to determine
416
422
  * configuration for each file it processes.
417
423
  * @param {string} dirPath The path of the directory to retrieve config for.
418
- * @returns {Promise<ConfigData|undefined>} A configuration object for the directory
419
- * or `undefined` if there is no configuration data for the directory.
424
+ * @returns {Promise<FlatConfigArray>} A configuration object for the directory.
420
425
  */
421
426
  async loadConfigArrayForDirectory(dirPath) {
422
427
  assertValidFilePath(dirPath);
@@ -440,8 +445,7 @@ class ConfigLoader {
440
445
  * intended to be used in locations where we know the config file has already
441
446
  * been loaded and we just need to get the configuration for a file.
442
447
  * @param {string} filePath The path of the file to retrieve a config object for.
443
- * @returns {ConfigData|undefined} A configuration object for the file
444
- * or `undefined` if there is no configuration data for the file.
448
+ * @returns {FlatConfigArray} A configuration object for the file.
445
449
  * @throws {Error} If `filePath` is not a non-empty string.
446
450
  * @throws {Error} If `filePath` is not an absolute path.
447
451
  * @throws {Error} If the config file was not already loaded.
@@ -460,8 +464,7 @@ class ConfigLoader {
460
464
  * intended to be used in locations where we know the config file has already
461
465
  * been loaded and we just need to get the configuration for a file.
462
466
  * @param {string} fileOrDirPath The path of the directory to retrieve a config object for.
463
- * @returns {ConfigData|undefined} A configuration object for the directory
464
- * or `undefined` if there is no configuration data for the directory.
467
+ * @returns {FlatConfigArray} A configuration object for the directory.
465
468
  * @throws {Error} If `dirPath` is not a non-empty string.
466
469
  * @throws {Error} If `dirPath` is not an absolute path.
467
470
  * @throws {Error} If the config file was not already loaded.
@@ -500,11 +503,12 @@ class ConfigLoader {
500
503
 
501
504
  /**
502
505
  * Used to import the jiti dependency. This method is exposed internally for testing purposes.
503
- * @returns {Promise<Record<string, unknown>>} A promise that fulfills with a module object
504
- * or rejects with an error if jiti is not found.
506
+ * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
505
507
  */
506
- static loadJiti() {
507
- return import("jiti");
508
+ static async loadJiti() {
509
+ const { createJiti } = await import("jiti");
510
+ const version = require("jiti/package.json").version;
511
+ return { createJiti, version };
508
512
  }
509
513
 
510
514
  /**
@@ -567,6 +571,7 @@ class ConfigLoader {
567
571
  overrideConfig,
568
572
  hasUnstableNativeNodeJsTSConfigFlag = false,
569
573
  defaultConfigs = [],
574
+ warningService,
570
575
  } = options;
571
576
 
572
577
  debug(
@@ -628,10 +633,7 @@ class ConfigLoader {
628
633
  }
629
634
 
630
635
  if (emptyConfig) {
631
- globalThis.process?.emitWarning?.(
632
- `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.`,
633
- "ESLintEmptyConfigWarning",
634
- );
636
+ warningService.emitEmptyConfigWarning(configFilePath);
635
637
  }
636
638
  }
637
639
 
@@ -719,8 +721,11 @@ class LegacyConfigLoader extends ConfigLoader {
719
721
  * @param {ConfigLoaderOptions} options The options to use when loading configuration files.
720
722
  */
721
723
  constructor(options) {
722
- super(options);
723
- this.#options = options;
724
+ const normalizedOptions = options.warningService
725
+ ? options
726
+ : { ...options, warningService: new WarningService() };
727
+ super(normalizedOptions);
728
+ this.#options = normalizedOptions;
724
729
  }
725
730
 
726
731
  /**
@@ -789,8 +794,7 @@ class LegacyConfigLoader extends ConfigLoader {
789
794
  * This is the same logic used by the ESLint CLI executable to determine
790
795
  * configuration for each file it processes.
791
796
  * @param {string} dirPath The path of the directory to retrieve config for.
792
- * @returns {Promise<ConfigData|undefined>} A configuration object for the file
793
- * or `undefined` if there is no configuration data for the file.
797
+ * @returns {Promise<FlatConfigArray>} A configuration object for the file.
794
798
  */
795
799
  async loadConfigArrayForDirectory(dirPath) {
796
800
  assertValidFilePath(dirPath);
@@ -812,8 +816,7 @@ class LegacyConfigLoader extends ConfigLoader {
812
816
  * intended to be used in locations where we know the config file has already
813
817
  * been loaded and we just need to get the configuration for a file.
814
818
  * @param {string} dirPath The path of the directory to retrieve a config object for.
815
- * @returns {ConfigData|undefined} A configuration object for the file
816
- * or `undefined` if there is no configuration data for the file.
819
+ * @returns {FlatConfigArray} A configuration object for the file.
817
820
  * @throws {Error} If `dirPath` is not a non-empty string.
818
821
  * @throws {Error} If `dirPath` is not an absolute path.
819
822
  * @throws {Error} If the config file was not already loaded.