eslint 9.18.0 → 9.20.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 +25 -16
- package/lib/cli.js +8 -0
- package/lib/config/config-loader.js +34 -4
- package/lib/config/config.js +6 -1
- package/lib/config/flat-config-schema.js +16 -1
- package/lib/eslint/eslint.js +1 -1
- package/lib/linter/linter.js +98 -8
- package/lib/options.js +13 -0
- package/lib/rules/arrow-body-style.js +1 -1
- package/lib/rules/consistent-this.js +9 -0
- package/lib/shared/flags.js +43 -5
- package/lib/shared/option-utils.js +56 -0
- package/lib/types/index.d.ts +70 -60
- package/lib/types/rules/best-practices.d.ts +109 -95
- package/lib/types/rules/deprecated.d.ts +32 -15
- package/lib/types/rules/ecmascript-6.d.ts +39 -39
- package/lib/types/rules/node-commonjs.d.ts +23 -12
- package/lib/types/rules/possible-errors.d.ts +86 -54
- package/lib/types/rules/strict-mode.d.ts +1 -1
- package/lib/types/rules/stylistic-issues.d.ts +105 -99
- package/lib/types/rules/variables.d.ts +12 -12
- package/messages/config-serialize-function.js +28 -0
- package/messages/eslintrc-plugins.js +6 -2
- package/package.json +7 -5
@@ -32,7 +32,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
32
32
|
* Rule to require or disallow initialization in variable declarations.
|
33
33
|
*
|
34
34
|
* @since 1.0.0-rc-1
|
35
|
-
* @see https://eslint.org/docs/rules/init-declarations
|
35
|
+
* @see https://eslint.org/docs/latest/rules/init-declarations
|
36
36
|
*/
|
37
37
|
"init-declarations":
|
38
38
|
| Linter.RuleEntry<["always"]>
|
@@ -52,7 +52,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
52
52
|
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
53
53
|
*
|
54
54
|
* @since 0.0.9
|
55
|
-
* @see https://eslint.org/docs/rules/no-delete-var
|
55
|
+
* @see https://eslint.org/docs/latest/rules/no-delete-var
|
56
56
|
*/
|
57
57
|
"no-delete-var": Linter.RuleEntry<[]>;
|
58
58
|
|
@@ -60,7 +60,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
60
60
|
* Rule to disallow labels that share a name with a variable.
|
61
61
|
*
|
62
62
|
* @since 0.0.9
|
63
|
-
* @see https://eslint.org/docs/rules/no-label-var
|
63
|
+
* @see https://eslint.org/docs/latest/rules/no-label-var
|
64
64
|
*/
|
65
65
|
"no-label-var": Linter.RuleEntry<[]>;
|
66
66
|
|
@@ -68,7 +68,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
68
68
|
* Rule to disallow specified global variables.
|
69
69
|
*
|
70
70
|
* @since 2.3.0
|
71
|
-
* @see https://eslint.org/docs/rules/no-restricted-globals
|
71
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-globals
|
72
72
|
*/
|
73
73
|
"no-restricted-globals": Linter.RuleEntry<
|
74
74
|
[
|
@@ -86,7 +86,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
86
86
|
* Rule to disallow variable declarations from shadowing variables declared in the outer scope.
|
87
87
|
*
|
88
88
|
* @since 0.0.9
|
89
|
-
* @see https://eslint.org/docs/rules/no-shadow
|
89
|
+
* @see https://eslint.org/docs/latest/rules/no-shadow
|
90
90
|
*/
|
91
91
|
"no-shadow": Linter.RuleEntry<
|
92
92
|
[
|
@@ -116,18 +116,18 @@ export interface Variables extends Linter.RulesRecord {
|
|
116
116
|
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
117
117
|
*
|
118
118
|
* @since 0.1.4
|
119
|
-
* @see https://eslint.org/docs/rules/no-shadow-restricted-names
|
119
|
+
* @see https://eslint.org/docs/latest/rules/no-shadow-restricted-names
|
120
120
|
*/
|
121
121
|
"no-shadow-restricted-names": Linter.RuleEntry<[]>;
|
122
122
|
|
123
123
|
/**
|
124
|
-
* Rule to disallow the use of undeclared variables unless mentioned in
|
124
|
+
* Rule to disallow the use of undeclared variables unless mentioned in \/*global *\/ comments.
|
125
125
|
*
|
126
126
|
* @remarks
|
127
127
|
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
128
128
|
*
|
129
129
|
* @since 0.0.9
|
130
|
-
* @see https://eslint.org/docs/rules/no-undef
|
130
|
+
* @see https://eslint.org/docs/latest/rules/no-undef
|
131
131
|
*/
|
132
132
|
"no-undef": Linter.RuleEntry<
|
133
133
|
[
|
@@ -144,7 +144,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
144
144
|
* Rule to disallow initializing variables to `undefined`.
|
145
145
|
*
|
146
146
|
* @since 0.0.6
|
147
|
-
* @see https://eslint.org/docs/rules/no-undef-init
|
147
|
+
* @see https://eslint.org/docs/latest/rules/no-undef-init
|
148
148
|
*/
|
149
149
|
"no-undef-init": Linter.RuleEntry<[]>;
|
150
150
|
|
@@ -152,7 +152,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
152
152
|
* Rule to disallow the use of `undefined` as an identifier.
|
153
153
|
*
|
154
154
|
* @since 0.7.1
|
155
|
-
* @see https://eslint.org/docs/rules/no-undefined
|
155
|
+
* @see https://eslint.org/docs/latest/rules/no-undefined
|
156
156
|
*/
|
157
157
|
"no-undefined": Linter.RuleEntry<[]>;
|
158
158
|
|
@@ -163,7 +163,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
163
163
|
* Recommended by ESLint, the rule was enabled in `eslint:recommended`.
|
164
164
|
*
|
165
165
|
* @since 0.0.9
|
166
|
-
* @see https://eslint.org/docs/rules/no-unused-vars
|
166
|
+
* @see https://eslint.org/docs/latest/rules/no-unused-vars
|
167
167
|
*/
|
168
168
|
"no-unused-vars": Linter.RuleEntry<
|
169
169
|
[
|
@@ -206,7 +206,7 @@ export interface Variables extends Linter.RulesRecord {
|
|
206
206
|
* Rule to disallow the use of variables before they are defined.
|
207
207
|
*
|
208
208
|
* @since 0.0.9
|
209
|
-
* @see https://eslint.org/docs/rules/no-use-before-define
|
209
|
+
* @see https://eslint.org/docs/latest/rules/no-use-before-define
|
210
210
|
*/
|
211
211
|
"no-use-before-define": Linter.RuleEntry<
|
212
212
|
[
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
module.exports = function({ key, objectKey }) {
|
4
|
+
|
5
|
+
// special case for parsers
|
6
|
+
const isParser = objectKey === "parser" && (key === "parse" || key === "parseForESLint");
|
7
|
+
const parserMessage = `
|
8
|
+
This typically happens when you're using a custom parser that does not
|
9
|
+
provide a "meta" property, which is how ESLint determines the serialized
|
10
|
+
representation. Please open an issue with the maintainer of the custom parser
|
11
|
+
and share this link:
|
12
|
+
|
13
|
+
https://eslint.org/docs/latest/extend/custom-parsers#meta-data-in-custom-parsers
|
14
|
+
`.trim();
|
15
|
+
|
16
|
+
return `
|
17
|
+
The requested operation requires ESLint to serialize configuration data,
|
18
|
+
but the configuration key "${objectKey}.${key}" contains a function value,
|
19
|
+
which cannot be serialized.
|
20
|
+
|
21
|
+
${
|
22
|
+
isParser ? parserMessage : "Please double-check your configuration for errors."
|
23
|
+
}
|
24
|
+
|
25
|
+
If you still have problems, please stop by https://eslint.org/chat/help to chat
|
26
|
+
with the team.
|
27
|
+
`.trimStart();
|
28
|
+
};
|
@@ -5,9 +5,13 @@ module.exports = function({ plugins }) {
|
|
5
5
|
const isArrayOfStrings = typeof plugins[0] === "string";
|
6
6
|
|
7
7
|
return `
|
8
|
-
A config object has a "plugins" key defined as an array${isArrayOfStrings ? " of strings" : ""}.
|
8
|
+
A config object has a "plugins" key defined as an array${isArrayOfStrings ? " of strings" : ""}. It looks something like this:
|
9
9
|
|
10
|
-
|
10
|
+
{
|
11
|
+
"plugins": ${JSON.stringify(plugins)}
|
12
|
+
}
|
13
|
+
|
14
|
+
Flat config requires "plugins" to be an object, like this:
|
11
15
|
|
12
16
|
{
|
13
17
|
plugins: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.20.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"type": "commonjs",
|
@@ -52,6 +52,7 @@
|
|
52
52
|
"lint:unused": "knip",
|
53
53
|
"lint:fix": "trunk check -y --ignore=docs/**/*.js -a --filter=eslint && trunk check -y --ignore=docs/**/*.js",
|
54
54
|
"lint:fix:docs:js": "trunk check -y --ignore=** --ignore=!docs/**/*.js -a --flter=eslint && trunk check -y --ignore=** --ignore=!docs/**/*.js",
|
55
|
+
"lint:rule-types": "node tools/update-rule-type-headers.js --check",
|
55
56
|
"lint:types": "attw --pack",
|
56
57
|
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",
|
57
58
|
"release:generate:beta": "node Makefile.js generatePrerelease -- beta",
|
@@ -75,7 +76,8 @@
|
|
75
76
|
"*.md": "trunk check --fix --filter=markdownlint",
|
76
77
|
"lib/rules/*.js": [
|
77
78
|
"node tools/update-eslint-all.js",
|
78
|
-
"
|
79
|
+
"node tools/update-rule-type-headers.js",
|
80
|
+
"git add packages/js/src/configs/eslint-all.js \"lib/types/rules/*.ts\""
|
79
81
|
],
|
80
82
|
"docs/src/rules/*.md": [
|
81
83
|
"node tools/check-rule-examples.js",
|
@@ -100,9 +102,9 @@
|
|
100
102
|
"@eslint-community/eslint-utils": "^4.2.0",
|
101
103
|
"@eslint-community/regexpp": "^4.12.1",
|
102
104
|
"@eslint/config-array": "^0.19.0",
|
103
|
-
"@eslint/core": "^0.
|
105
|
+
"@eslint/core": "^0.11.0",
|
104
106
|
"@eslint/eslintrc": "^3.2.0",
|
105
|
-
"@eslint/js": "9.
|
107
|
+
"@eslint/js": "9.20.0",
|
106
108
|
"@eslint/plugin-kit": "^0.2.5",
|
107
109
|
"@humanfs/node": "^0.16.6",
|
108
110
|
"@humanwhocodes/module-importer": "^1.0.1",
|
@@ -136,7 +138,7 @@
|
|
136
138
|
"@arethetypeswrong/cli": "^0.17.0",
|
137
139
|
"@babel/core": "^7.4.3",
|
138
140
|
"@babel/preset-env": "^7.4.3",
|
139
|
-
"@eslint/json": "^0.
|
141
|
+
"@eslint/json": "^0.10.0",
|
140
142
|
"@trunkio/launcher": "^1.3.0",
|
141
143
|
"@types/node": "^20.11.5",
|
142
144
|
"@typescript-eslint/parser": "^8.4.0",
|