eslint 8.22.0 → 8.33.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 +51 -45
- package/bin/eslint.js +2 -4
- package/conf/globals.js +6 -1
- package/conf/rule-type-list.json +2 -2
- package/lib/cli-engine/file-enumerator.js +4 -2
- package/lib/cli-engine/formatters/formatters-meta.json +46 -0
- package/lib/cli-engine/formatters/html.js +76 -51
- package/lib/cli.js +163 -40
- package/lib/config/default-config.js +2 -2
- package/lib/config/flat-config-array.js +1 -1
- package/lib/eslint/eslint-helpers.js +409 -87
- package/lib/eslint/eslint.js +5 -2
- package/lib/eslint/flat-eslint.js +113 -110
- package/lib/linter/code-path-analysis/code-path-segment.js +2 -2
- package/lib/linter/code-path-analysis/code-path-state.js +7 -7
- package/lib/linter/code-path-analysis/debug-helpers.js +3 -3
- package/lib/linter/code-path-analysis/id-generator.js +2 -2
- package/lib/linter/config-comment-parser.js +1 -2
- package/lib/linter/linter.js +17 -7
- package/lib/linter/timing.js +4 -4
- package/lib/options.js +293 -239
- package/lib/rule-tester/flat-rule-tester.js +13 -11
- package/lib/rule-tester/rule-tester.js +15 -11
- package/lib/rules/array-callback-return.js +2 -2
- package/lib/rules/comma-dangle.js +3 -3
- package/lib/rules/for-direction.js +1 -1
- package/lib/rules/func-name-matching.js +2 -2
- package/lib/rules/getter-return.js +14 -8
- package/lib/rules/global-require.js +2 -1
- package/lib/rules/id-length.js +43 -2
- package/lib/rules/indent-legacy.js +4 -4
- package/lib/rules/indent.js +23 -15
- package/lib/rules/index.js +3 -0
- package/lib/rules/key-spacing.js +50 -38
- package/lib/rules/lines-around-comment.js +2 -2
- package/lib/rules/logical-assignment-operators.js +474 -0
- package/lib/rules/multiline-ternary.js +2 -2
- package/lib/rules/new-cap.js +2 -2
- package/lib/rules/no-else-return.js +1 -1
- package/lib/rules/no-empty-static-block.js +47 -0
- package/lib/rules/no-empty.js +19 -2
- package/lib/rules/no-extra-boolean-cast.js +1 -1
- package/lib/rules/no-extra-parens.js +18 -3
- package/lib/rules/no-fallthrough.js +26 -5
- package/lib/rules/no-implicit-coercion.js +20 -1
- package/lib/rules/no-implicit-globals.js +5 -0
- package/lib/rules/no-invalid-regexp.js +40 -18
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-lone-blocks.js +1 -1
- package/lib/rules/no-loss-of-precision.js +2 -2
- package/lib/rules/no-magic-numbers.js +18 -1
- package/lib/rules/no-misleading-character-class.js +4 -4
- package/lib/rules/no-new-native-nonconstructor.js +64 -0
- package/lib/rules/no-obj-calls.js +1 -1
- package/lib/rules/no-restricted-exports.js +106 -10
- package/lib/rules/no-return-await.js +28 -1
- package/lib/rules/no-underscore-dangle.js +36 -11
- package/lib/rules/no-unneeded-ternary.js +1 -1
- package/lib/rules/no-use-before-define.js +1 -1
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-var.js +2 -2
- package/lib/rules/no-warning-comments.js +24 -5
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/prefer-arrow-callback.js +4 -3
- package/lib/rules/prefer-const.js +13 -1
- package/lib/rules/prefer-named-capture-group.js +71 -6
- package/lib/rules/prefer-object-spread.js +1 -1
- package/lib/rules/prefer-regex-literals.js +147 -32
- package/lib/rules/prefer-rest-params.js +1 -1
- package/lib/rules/require-yield.js +0 -1
- package/lib/rules/strict.js +1 -1
- package/lib/rules/utils/ast-utils.js +10 -4
- package/lib/shared/directives.js +15 -0
- package/lib/shared/logging.js +1 -1
- package/lib/shared/runtime-info.js +1 -1
- package/lib/shared/traverser.js +1 -1
- package/lib/shared/types.js +15 -2
- package/lib/source-code/token-store/cursor.js +1 -1
- package/messages/print-config-with-directory-path.js +1 -1
- package/package.json +27 -27
package/lib/options.js
CHANGED
@@ -63,261 +63,315 @@ const optionator = require("optionator");
|
|
63
63
|
//------------------------------------------------------------------------------
|
64
64
|
|
65
65
|
// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)"
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Creates the CLI options for ESLint.
|
69
|
+
* @param {boolean} usingFlatConfig Indicates if flat config is being used.
|
70
|
+
* @returns {Object} The optionator instance.
|
71
|
+
*/
|
72
|
+
module.exports = function(usingFlatConfig) {
|
73
|
+
|
74
|
+
let lookupFlag;
|
75
|
+
|
76
|
+
if (usingFlatConfig) {
|
77
|
+
lookupFlag = {
|
78
|
+
option: "config-lookup",
|
79
|
+
type: "Boolean",
|
80
|
+
default: "true",
|
81
|
+
description: "Disable look up for eslint.config.js"
|
82
|
+
};
|
83
|
+
} else {
|
84
|
+
lookupFlag = {
|
77
85
|
option: "eslintrc",
|
78
86
|
type: "Boolean",
|
79
87
|
default: "true",
|
80
88
|
description: "Disable use of configuration from .eslintrc.*"
|
81
|
-
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
{
|
89
|
+
};
|
90
|
+
}
|
91
|
+
|
92
|
+
let envFlag;
|
93
|
+
|
94
|
+
if (!usingFlatConfig) {
|
95
|
+
envFlag = {
|
89
96
|
option: "env",
|
90
97
|
type: "[String]",
|
91
98
|
description: "Specify environments"
|
92
|
-
}
|
93
|
-
|
99
|
+
};
|
100
|
+
}
|
101
|
+
|
102
|
+
let extFlag;
|
103
|
+
|
104
|
+
if (!usingFlatConfig) {
|
105
|
+
extFlag = {
|
94
106
|
option: "ext",
|
95
107
|
type: "[String]",
|
96
108
|
description: "Specify JavaScript file extensions"
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
{
|
104
|
-
option: "parser",
|
105
|
-
type: "String",
|
106
|
-
description: "Specify the parser to be used"
|
107
|
-
},
|
108
|
-
{
|
109
|
-
option: "parser-options",
|
110
|
-
type: "Object",
|
111
|
-
description: "Specify parser options"
|
112
|
-
},
|
113
|
-
{
|
109
|
+
};
|
110
|
+
}
|
111
|
+
|
112
|
+
let resolvePluginsFlag;
|
113
|
+
|
114
|
+
if (!usingFlatConfig) {
|
115
|
+
resolvePluginsFlag = {
|
114
116
|
option: "resolve-plugins-relative-to",
|
115
117
|
type: "path::String",
|
116
118
|
description: "A folder where plugins should be resolved from, CWD by default"
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
description: "Specify plugins"
|
125
|
-
},
|
126
|
-
{
|
127
|
-
option: "rule",
|
128
|
-
type: "Object",
|
129
|
-
description: "Specify rules"
|
130
|
-
},
|
131
|
-
{
|
119
|
+
};
|
120
|
+
}
|
121
|
+
|
122
|
+
let rulesDirFlag;
|
123
|
+
|
124
|
+
if (!usingFlatConfig) {
|
125
|
+
rulesDirFlag = {
|
132
126
|
option: "rulesdir",
|
133
127
|
type: "[path::String]",
|
134
128
|
description: "Load additional rules from this directory. Deprecated: Use rules from plugins"
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
default: false,
|
143
|
-
description: "Automatically fix problems"
|
144
|
-
},
|
145
|
-
{
|
146
|
-
option: "fix-dry-run",
|
147
|
-
type: "Boolean",
|
148
|
-
default: false,
|
149
|
-
description: "Automatically fix problems without saving the changes to the file system"
|
150
|
-
},
|
151
|
-
{
|
152
|
-
option: "fix-type",
|
153
|
-
type: "Array",
|
154
|
-
description: "Specify the types of fixes to apply (directive, problem, suggestion, layout)"
|
155
|
-
},
|
156
|
-
{
|
157
|
-
heading: "Ignoring files"
|
158
|
-
},
|
159
|
-
{
|
129
|
+
};
|
130
|
+
}
|
131
|
+
|
132
|
+
let ignorePathFlag;
|
133
|
+
|
134
|
+
if (!usingFlatConfig) {
|
135
|
+
ignorePathFlag = {
|
160
136
|
option: "ignore-path",
|
161
137
|
type: "path::String",
|
162
138
|
description: "Specify path of ignore file"
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
}
|
139
|
+
};
|
140
|
+
}
|
141
|
+
|
142
|
+
return optionator({
|
143
|
+
prepend: "eslint [options] file.js [file.js] [dir]",
|
144
|
+
defaults: {
|
145
|
+
concatRepeatedArrays: true,
|
146
|
+
mergeRepeatedObjects: true
|
147
|
+
},
|
148
|
+
options: [
|
149
|
+
{
|
150
|
+
heading: "Basic configuration"
|
151
|
+
},
|
152
|
+
lookupFlag,
|
153
|
+
{
|
154
|
+
option: "config",
|
155
|
+
alias: "c",
|
156
|
+
type: "path::String",
|
157
|
+
description: usingFlatConfig
|
158
|
+
? "Use this configuration instead of eslint.config.js"
|
159
|
+
: "Use this configuration, overriding .eslintrc.* config options if present"
|
160
|
+
},
|
161
|
+
envFlag,
|
162
|
+
extFlag,
|
163
|
+
{
|
164
|
+
option: "global",
|
165
|
+
type: "[String]",
|
166
|
+
description: "Define global variables"
|
167
|
+
},
|
168
|
+
{
|
169
|
+
option: "parser",
|
170
|
+
type: "String",
|
171
|
+
description: "Specify the parser to be used"
|
172
|
+
},
|
173
|
+
{
|
174
|
+
option: "parser-options",
|
175
|
+
type: "Object",
|
176
|
+
description: "Specify parser options"
|
177
|
+
},
|
178
|
+
resolvePluginsFlag,
|
179
|
+
{
|
180
|
+
heading: "Specify Rules and Plugins"
|
181
|
+
},
|
182
|
+
{
|
183
|
+
option: "plugin",
|
184
|
+
type: "[String]",
|
185
|
+
description: "Specify plugins"
|
186
|
+
},
|
187
|
+
{
|
188
|
+
option: "rule",
|
189
|
+
type: "Object",
|
190
|
+
description: "Specify rules"
|
191
|
+
},
|
192
|
+
rulesDirFlag,
|
193
|
+
{
|
194
|
+
heading: "Fix Problems"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
option: "fix",
|
198
|
+
type: "Boolean",
|
199
|
+
default: false,
|
200
|
+
description: "Automatically fix problems"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
option: "fix-dry-run",
|
204
|
+
type: "Boolean",
|
205
|
+
default: false,
|
206
|
+
description: "Automatically fix problems without saving the changes to the file system"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
option: "fix-type",
|
210
|
+
type: "Array",
|
211
|
+
description: "Specify the types of fixes to apply (directive, problem, suggestion, layout)"
|
212
|
+
},
|
213
|
+
{
|
214
|
+
heading: "Ignore Files"
|
215
|
+
},
|
216
|
+
ignorePathFlag,
|
217
|
+
{
|
218
|
+
option: "ignore",
|
219
|
+
type: "Boolean",
|
220
|
+
default: "true",
|
221
|
+
description: "Disable use of ignore files and patterns"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
option: "ignore-pattern",
|
225
|
+
type: "[String]",
|
226
|
+
description: "Pattern of files to ignore (in addition to those in .eslintignore)",
|
227
|
+
concatRepeatedArrays: [true, {
|
228
|
+
oneValuePerFlag: true
|
229
|
+
}]
|
230
|
+
},
|
231
|
+
{
|
232
|
+
heading: "Use stdin"
|
233
|
+
},
|
234
|
+
{
|
235
|
+
option: "stdin",
|
236
|
+
type: "Boolean",
|
237
|
+
default: "false",
|
238
|
+
description: "Lint code provided on <STDIN>"
|
239
|
+
},
|
240
|
+
{
|
241
|
+
option: "stdin-filename",
|
242
|
+
type: "String",
|
243
|
+
description: "Specify filename to process STDIN as"
|
244
|
+
},
|
245
|
+
{
|
246
|
+
heading: "Handle Warnings"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
option: "quiet",
|
250
|
+
type: "Boolean",
|
251
|
+
default: "false",
|
252
|
+
description: "Report errors only"
|
253
|
+
},
|
254
|
+
{
|
255
|
+
option: "max-warnings",
|
256
|
+
type: "Int",
|
257
|
+
default: "-1",
|
258
|
+
description: "Number of warnings to trigger nonzero exit code"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
heading: "Output"
|
262
|
+
},
|
263
|
+
{
|
264
|
+
option: "output-file",
|
265
|
+
alias: "o",
|
266
|
+
type: "path::String",
|
267
|
+
description: "Specify file to write report to"
|
268
|
+
},
|
269
|
+
{
|
270
|
+
option: "format",
|
271
|
+
alias: "f",
|
272
|
+
type: "String",
|
273
|
+
default: "stylish",
|
274
|
+
description: "Use a specific output format"
|
275
|
+
},
|
276
|
+
{
|
277
|
+
option: "color",
|
278
|
+
type: "Boolean",
|
279
|
+
alias: "no-color",
|
280
|
+
description: "Force enabling/disabling of color"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
heading: "Inline configuration comments"
|
284
|
+
},
|
285
|
+
{
|
286
|
+
option: "inline-config",
|
287
|
+
type: "Boolean",
|
288
|
+
default: "true",
|
289
|
+
description: "Prevent comments from changing config or rules"
|
290
|
+
},
|
291
|
+
{
|
292
|
+
option: "report-unused-disable-directives",
|
293
|
+
type: "Boolean",
|
294
|
+
default: void 0,
|
295
|
+
description: "Adds reported errors for unused eslint-disable directives"
|
296
|
+
},
|
297
|
+
{
|
298
|
+
heading: "Caching"
|
299
|
+
},
|
300
|
+
{
|
301
|
+
option: "cache",
|
302
|
+
type: "Boolean",
|
303
|
+
default: "false",
|
304
|
+
description: "Only check changed files"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
option: "cache-file",
|
308
|
+
type: "path::String",
|
309
|
+
default: ".eslintcache",
|
310
|
+
description: "Path to the cache file. Deprecated: use --cache-location"
|
311
|
+
},
|
312
|
+
{
|
313
|
+
option: "cache-location",
|
314
|
+
type: "path::String",
|
315
|
+
description: "Path to the cache file or directory"
|
316
|
+
},
|
317
|
+
{
|
318
|
+
option: "cache-strategy",
|
319
|
+
dependsOn: ["cache"],
|
320
|
+
type: "String",
|
321
|
+
default: "metadata",
|
322
|
+
enum: ["metadata", "content"],
|
323
|
+
description: "Strategy to use for detecting changed files in the cache"
|
324
|
+
},
|
325
|
+
{
|
326
|
+
heading: "Miscellaneous"
|
327
|
+
},
|
328
|
+
{
|
329
|
+
option: "init",
|
330
|
+
type: "Boolean",
|
331
|
+
default: "false",
|
332
|
+
description: "Run config initialization wizard"
|
333
|
+
},
|
334
|
+
{
|
335
|
+
option: "env-info",
|
336
|
+
type: "Boolean",
|
337
|
+
default: "false",
|
338
|
+
description: "Output execution environment information"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
option: "error-on-unmatched-pattern",
|
342
|
+
type: "Boolean",
|
343
|
+
default: "true",
|
344
|
+
description: "Prevent errors when pattern is unmatched"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
option: "exit-on-fatal-error",
|
348
|
+
type: "Boolean",
|
349
|
+
default: "false",
|
350
|
+
description: "Exit with exit code 2 in case of fatal error"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
option: "debug",
|
354
|
+
type: "Boolean",
|
355
|
+
default: false,
|
356
|
+
description: "Output debugging information"
|
357
|
+
},
|
358
|
+
{
|
359
|
+
option: "help",
|
360
|
+
alias: "h",
|
361
|
+
type: "Boolean",
|
362
|
+
description: "Show help"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
option: "version",
|
366
|
+
alias: "v",
|
367
|
+
type: "Boolean",
|
368
|
+
description: "Output the version number"
|
369
|
+
},
|
370
|
+
{
|
371
|
+
option: "print-config",
|
372
|
+
type: "path::String",
|
373
|
+
description: "Print the configuration for the given file"
|
374
|
+
}
|
375
|
+
].filter(value => !!value)
|
376
|
+
});
|
377
|
+
};
|
@@ -4,7 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
/*
|
7
|
+
/* globals describe, it -- Mocha globals */
|
8
8
|
|
9
9
|
//------------------------------------------------------------------------------
|
10
10
|
// Requirements
|
@@ -430,7 +430,7 @@ class FlatRuleTester {
|
|
430
430
|
if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") {
|
431
431
|
throw new Error(
|
432
432
|
"Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" +
|
433
|
-
"See https://eslint.org/docs/
|
433
|
+
"See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more."
|
434
434
|
);
|
435
435
|
}
|
436
436
|
if (typeof it === "function") {
|
@@ -619,15 +619,17 @@ class FlatRuleTester {
|
|
619
619
|
plugins: {
|
620
620
|
"rule-tester": {
|
621
621
|
rules: {
|
622
|
-
"validate-ast"
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
622
|
+
"validate-ast": {
|
623
|
+
create() {
|
624
|
+
return {
|
625
|
+
Program(node) {
|
626
|
+
beforeAST = cloneDeeplyExcludesParent(node);
|
627
|
+
},
|
628
|
+
"Program:exit"(node) {
|
629
|
+
afterAST = node;
|
630
|
+
}
|
631
|
+
};
|
632
|
+
}
|
631
633
|
}
|
632
634
|
}
|
633
635
|
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
/*
|
7
|
+
/* globals describe, it -- Mocha globals */
|
8
8
|
|
9
9
|
/*
|
10
10
|
* This is a wrapper around mocha to allow for DRY unittests for eslint
|
@@ -314,7 +314,7 @@ function emitLegacyRuleAPIWarning(ruleName) {
|
|
314
314
|
if (!emitLegacyRuleAPIWarning[`warned-${ruleName}`]) {
|
315
315
|
emitLegacyRuleAPIWarning[`warned-${ruleName}`] = true;
|
316
316
|
process.emitWarning(
|
317
|
-
`"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/
|
317
|
+
`"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules`,
|
318
318
|
"DeprecationWarning"
|
319
319
|
);
|
320
320
|
}
|
@@ -329,7 +329,7 @@ function emitMissingSchemaWarning(ruleName) {
|
|
329
329
|
if (!emitMissingSchemaWarning[`warned-${ruleName}`]) {
|
330
330
|
emitMissingSchemaWarning[`warned-${ruleName}`] = true;
|
331
331
|
process.emitWarning(
|
332
|
-
`"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/
|
332
|
+
`"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`,
|
333
333
|
"DeprecationWarning"
|
334
334
|
);
|
335
335
|
}
|
@@ -493,7 +493,7 @@ class RuleTester {
|
|
493
493
|
if (typeof this[DESCRIBE] === "function" || typeof this[IT] === "function") {
|
494
494
|
throw new Error(
|
495
495
|
"Set `RuleTester.itOnly` to use `only` with a custom test framework.\n" +
|
496
|
-
"See https://eslint.org/docs/
|
496
|
+
"See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more."
|
497
497
|
);
|
498
498
|
}
|
499
499
|
if (typeof it === "function") {
|
@@ -632,14 +632,18 @@ class RuleTester {
|
|
632
632
|
* The goal is to check whether or not AST was modified when
|
633
633
|
* running the rule under test.
|
634
634
|
*/
|
635
|
-
linter.defineRule("rule-tester/validate-ast",
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
635
|
+
linter.defineRule("rule-tester/validate-ast", {
|
636
|
+
create() {
|
637
|
+
return {
|
638
|
+
Program(node) {
|
639
|
+
beforeAST = cloneDeeplyExcludesParent(node);
|
640
|
+
},
|
641
|
+
"Program:exit"(node) {
|
642
|
+
afterAST = node;
|
643
|
+
}
|
644
|
+
};
|
641
645
|
}
|
642
|
-
})
|
646
|
+
});
|
643
647
|
|
644
648
|
if (typeof config.parser === "string") {
|
645
649
|
assert(path.isAbsolute(config.parser), "Parsers provided as strings to RuleTester must be absolute paths");
|