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.
- package/README.md +7 -2
- package/bin/eslint.js +7 -11
- package/conf/rule-type-list.json +2 -1
- package/lib/cli-engine/cli-engine.js +7 -7
- package/lib/cli.js +19 -16
- package/lib/config/config-loader.js +42 -39
- package/lib/config/config.js +362 -16
- package/lib/eslint/eslint-helpers.js +3 -1
- package/lib/eslint/eslint.js +31 -13
- package/lib/eslint/legacy-eslint.js +6 -6
- package/lib/languages/js/source-code/source-code.js +40 -6
- package/lib/linter/apply-disable-directives.js +1 -1
- package/lib/linter/file-context.js +11 -0
- package/lib/linter/linter.js +102 -140
- package/lib/linter/report-translator.js +2 -1
- package/lib/linter/{node-event-generator.js → source-code-traverser.js} +143 -87
- package/lib/options.js +7 -0
- package/lib/rule-tester/rule-tester.js +3 -3
- package/lib/rules/func-style.js +57 -7
- package/lib/rules/index.js +1 -0
- package/lib/rules/max-params.js +32 -7
- package/lib/rules/no-array-constructor.js +51 -1
- package/lib/rules/no-implicit-globals.js +31 -15
- package/lib/rules/no-magic-numbers.js +98 -5
- package/lib/rules/no-shadow.js +262 -6
- package/lib/rules/no-unassigned-vars.js +80 -0
- package/lib/rules/no-use-before-define.js +97 -1
- package/lib/rules/no-useless-escape.js +24 -2
- package/lib/rules/prefer-arrow-callback.js +9 -0
- package/lib/rules/prefer-named-capture-group.js +7 -1
- package/lib/services/processor-service.js +1 -1
- package/lib/services/suppressions-service.js +5 -3
- package/lib/services/warning-service.js +85 -0
- package/lib/shared/flags.js +1 -0
- package/lib/types/index.d.ts +132 -9
- package/lib/types/rules.d.ts +66 -3
- package/package.json +11 -11
- package/lib/config/flat-config-helpers.js +0 -128
- package/lib/config/rule-validator.js +0 -199
- package/lib/mcp/mcp-server.js +0 -66
- 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/
|
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
|
-
|
161
|
-
|
162
|
-
|
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
|
-
|
168
|
-
console.error(`ESLint MCP server is running. cwd: ${process.cwd()}`);
|
164
|
+
const spawn = require("cross-spawn");
|
169
165
|
|
170
|
-
|
171
|
-
|
172
|
-
|
166
|
+
spawn.sync("npx", ["@eslint/mcp@latest"], {
|
167
|
+
encoding: "utf8",
|
168
|
+
stdio: "inherit",
|
173
169
|
});
|
174
170
|
return;
|
175
171
|
}
|
package/conf/rule-type-list.json
CHANGED
@@ -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("../
|
62
|
-
/** @typedef {import("../
|
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
|
-
/** @
|
44
|
-
|
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("./
|
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
|
-
|
442
|
-
|
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
|
-
|
739
|
-
|
737
|
+
if (!options.passOnUnprunedSuppressions) {
|
738
|
+
const unusedSuppressionsCount =
|
739
|
+
Object.keys(unusedSuppressions).length;
|
740
740
|
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
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
|
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 {
|
33
|
-
* @property {Array<
|
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 {
|
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
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
-
|
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<
|
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<
|
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 {
|
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 {
|
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<
|
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
|
-
|
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
|
-
|
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
|
-
|
723
|
-
|
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<
|
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 {
|
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.
|