eslint 9.11.1 → 9.13.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 +8 -9
- package/bin/eslint.js +5 -0
- package/lib/cli-engine/formatters/stylish.js +2 -2
- package/lib/cli.js +14 -18
- package/lib/config/config-loader.js +703 -0
- package/lib/config/config.js +13 -10
- package/lib/config/default-config.js +2 -8
- package/lib/eslint/eslint-helpers.js +128 -134
- package/lib/eslint/eslint.js +95 -294
- package/lib/languages/js/index.js +8 -0
- package/lib/linter/linter.js +16 -19
- package/lib/rule-tester/rule-tester.js +39 -18
- package/lib/rules/complexity.js +16 -6
- package/lib/shared/flags.js +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/rules/best-practices.d.ts +33 -2
- package/lib/types/rules/deprecated.d.ts +18 -77
- package/lib/types/rules/ecmascript-6.d.ts +22 -6
- package/lib/types/rules/possible-errors.d.ts +2 -0
- package/lib/types/rules/stylistic-issues.d.ts +68 -5
- package/lib/types/rules/variables.d.ts +9 -1
- package/lib/unsupported-api.js +2 -1
- package/package.json +28 -14
package/README.md
CHANGED
@@ -289,23 +289,22 @@ Percy Ma
|
|
289
289
|
|
290
290
|
<!--teamend-->
|
291
291
|
|
292
|
+
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
293
|
+
<!--sponsorsstart-->
|
292
294
|
## Sponsors
|
293
295
|
|
294
|
-
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
296
|
+
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
297
|
+
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
295
298
|
|
296
|
-
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
297
|
-
<!--sponsorsstart-->
|
298
299
|
<h3>Platinum Sponsors</h3>
|
299
300
|
<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>
|
300
301
|
<p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
301
302
|
<p><a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" 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?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
302
|
-
<p><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://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>
|
303
|
-
|
304
|
-
|
305
|
-
<!--techsponsorsstart-->
|
306
|
-
<h2>Technology Sponsors</h2>
|
303
|
+
<p><a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" 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?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p>
|
304
|
+
<h3>Technology Sponsors</h3>
|
305
|
+
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.
|
307
306
|
<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>
|
308
|
-
<!--
|
307
|
+
<!--sponsorsend-->
|
309
308
|
|
310
309
|
[tidelift]: https://tidelift.com/funding/github/npm/eslint
|
311
310
|
[herodevs]: https://www.herodevs.com/support/eslint-nes?utm_source=ESLintWebsite&utm_medium=ESLintWebsite&utm_campaign=ESLintNES&utm_id=ESLintNES
|
package/bin/eslint.js
CHANGED
@@ -9,6 +9,11 @@
|
|
9
9
|
|
10
10
|
"use strict";
|
11
11
|
|
12
|
+
const mod = require("node:module");
|
13
|
+
|
14
|
+
// to use V8's code cache to speed up instantiation time
|
15
|
+
mod.enableCompileCache?.();
|
16
|
+
|
12
17
|
// must do this initialization *before* other requires in order to work
|
13
18
|
if (process.argv.includes("--debug")) {
|
14
19
|
require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");
|
@@ -5,7 +5,7 @@
|
|
5
5
|
"use strict";
|
6
6
|
|
7
7
|
const chalk = require("chalk"),
|
8
|
-
|
8
|
+
util = require("node:util"),
|
9
9
|
table = require("text-table");
|
10
10
|
|
11
11
|
//------------------------------------------------------------------------------
|
@@ -72,7 +72,7 @@ module.exports = function(results) {
|
|
72
72
|
{
|
73
73
|
align: ["", "r", "l"],
|
74
74
|
stringLength(str) {
|
75
|
-
return
|
75
|
+
return util.stripVTControlCharacters(str).length;
|
76
76
|
}
|
77
77
|
}
|
78
78
|
).split("\n").map(el => el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) => chalk.dim(`${p1}:${p2}`))).join("\n")}\n\n`;
|
package/lib/cli.js
CHANGED
@@ -146,24 +146,29 @@ async function translateOptions({
|
|
146
146
|
overrideConfigFile = void 0;
|
147
147
|
}
|
148
148
|
|
149
|
-
|
149
|
+
const languageOptions = {};
|
150
150
|
|
151
151
|
if (global) {
|
152
|
-
globals = global.reduce((obj, name) => {
|
152
|
+
languageOptions.globals = global.reduce((obj, name) => {
|
153
153
|
if (name.endsWith(":true")) {
|
154
154
|
obj[name.slice(0, -5)] = "writable";
|
155
155
|
} else {
|
156
156
|
obj[name] = "readonly";
|
157
157
|
}
|
158
158
|
return obj;
|
159
|
-
},
|
159
|
+
}, {});
|
160
|
+
}
|
161
|
+
|
162
|
+
if (parserOptions) {
|
163
|
+
languageOptions.parserOptions = parserOptions;
|
164
|
+
}
|
165
|
+
|
166
|
+
if (parser) {
|
167
|
+
languageOptions.parser = await importer.import(parser);
|
160
168
|
}
|
161
169
|
|
162
170
|
overrideConfig = [{
|
163
|
-
languageOptions: {
|
164
|
-
globals,
|
165
|
-
parserOptions: parserOptions || {}
|
166
|
-
},
|
171
|
+
...Object.keys(languageOptions).length > 0 ? { languageOptions } : {},
|
167
172
|
rules: rule ? rule : {}
|
168
173
|
}];
|
169
174
|
|
@@ -175,10 +180,6 @@ async function translateOptions({
|
|
175
180
|
};
|
176
181
|
}
|
177
182
|
|
178
|
-
if (parser) {
|
179
|
-
overrideConfig[0].languageOptions.parser = await importer.import(parser);
|
180
|
-
}
|
181
|
-
|
182
183
|
if (plugin) {
|
183
184
|
overrideConfig[0].plugins = await loadPlugins(importer, plugin);
|
184
185
|
}
|
@@ -348,14 +349,9 @@ const cli = {
|
|
348
349
|
// find the config file
|
349
350
|
const {
|
350
351
|
configFilePath,
|
351
|
-
basePath
|
352
|
-
error
|
352
|
+
basePath
|
353
353
|
} = await locateConfigFileToUse({ cwd: process.cwd(), configFile }, hasUnstableTSConfigFlag);
|
354
354
|
|
355
|
-
if (error) {
|
356
|
-
throw error;
|
357
|
-
}
|
358
|
-
|
359
355
|
return ["--config", configFilePath, "--basePath", basePath];
|
360
356
|
},
|
361
357
|
|
@@ -383,7 +379,7 @@ const cli = {
|
|
383
379
|
debug("Using flat config?", usingFlatConfig);
|
384
380
|
|
385
381
|
if (allowFlatConfig && !usingFlatConfig) {
|
386
|
-
process.emitWarning("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.", "ESLintRCWarning");
|
382
|
+
process.emitWarning("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.", "ESLintRCWarning");
|
387
383
|
}
|
388
384
|
|
389
385
|
const CLIOptions = createCLIOptions(usingFlatConfig);
|