eslint 9.9.1 → 9.10.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.
@@ -0,0 +1,598 @@
1
+ /**
2
+ * @fileoverview This file contains the rule types for ESLint. It was initially extracted
3
+ * from the `@types/eslint` package.
4
+ */
5
+
6
+ /*
7
+ * MIT License
8
+ * Copyright (c) Microsoft Corporation.
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE
26
+ */
27
+
28
+ import { Linter } from "../index";
29
+
30
+ export interface PossibleErrors extends Linter.RulesRecord {
31
+ /**
32
+ * Rule to enforce `for` loop update clause moving the counter in the right direction.
33
+ *
34
+ * @remarks
35
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
36
+ *
37
+ * @since 4.0.0-beta.0
38
+ * @see https://eslint.org/docs/rules/for-direction
39
+ */
40
+ "for-direction": Linter.RuleEntry<[]>;
41
+
42
+ /**
43
+ * Rule to enforce `return` statements in getters.
44
+ *
45
+ * @remarks
46
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
47
+ *
48
+ * @since 4.2.0
49
+ * @see https://eslint.org/docs/rules/getter-return
50
+ */
51
+ "getter-return": Linter.RuleEntry<
52
+ [
53
+ Partial<{
54
+ /**
55
+ * @default false
56
+ */
57
+ allowImplicit: boolean;
58
+ }>,
59
+ ]
60
+ >;
61
+
62
+ /**
63
+ * Rule to disallow using an async function as a `Promise` executor.
64
+ *
65
+ * @remarks
66
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
67
+ *
68
+ * @since 5.3.0
69
+ * @see https://eslint.org/docs/rules/no-async-promise-executor
70
+ */
71
+ "no-async-promise-executor": Linter.RuleEntry<[]>;
72
+
73
+ /**
74
+ * Rule to disallow `await` inside of loops.
75
+ *
76
+ * @since 3.12.0
77
+ * @see https://eslint.org/docs/rules/no-await-in-loop
78
+ */
79
+ "no-await-in-loop": Linter.RuleEntry<[]>;
80
+
81
+ /**
82
+ * Rule to disallow comparing against `-0`.
83
+ *
84
+ * @remarks
85
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
86
+ *
87
+ * @since 3.17.0
88
+ * @see https://eslint.org/docs/rules/no-compare-neg-zero
89
+ */
90
+ "no-compare-neg-zero": Linter.RuleEntry<[]>;
91
+
92
+ /**
93
+ * Rule to disallow assignment operators in conditional statements.
94
+ *
95
+ * @remarks
96
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
97
+ *
98
+ * @since 0.0.9
99
+ * @see https://eslint.org/docs/rules/no-cond-assign
100
+ */
101
+ "no-cond-assign": Linter.RuleEntry<["except-parens" | "always"]>;
102
+
103
+ /**
104
+ * Rule to disallow the use of `console`.
105
+ *
106
+ * @since 0.0.2
107
+ * @see https://eslint.org/docs/rules/no-console
108
+ */
109
+ "no-console": Linter.RuleEntry<
110
+ [
111
+ Partial<{
112
+ allow: Array<keyof Console>;
113
+ }>,
114
+ ]
115
+ >;
116
+
117
+ /**
118
+ * Rule to disallow constant expressions in conditions.
119
+ *
120
+ * @remarks
121
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
122
+ *
123
+ * @since 0.4.1
124
+ * @see https://eslint.org/docs/rules/no-constant-condition
125
+ */
126
+ "no-constant-condition": Linter.RuleEntry<
127
+ [
128
+ {
129
+ /**
130
+ * @default true
131
+ */
132
+ checkLoops: boolean;
133
+ },
134
+ ]
135
+ >;
136
+
137
+ /**
138
+ * Rule to disallow control characters in regular expressions.
139
+ *
140
+ * @remarks
141
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
142
+ *
143
+ * @since 0.1.0
144
+ * @see https://eslint.org/docs/rules/no-control-regex
145
+ */
146
+ "no-control-regex": Linter.RuleEntry<[]>;
147
+
148
+ /**
149
+ * Rule to disallow the use of `debugger`.
150
+ *
151
+ * @remarks
152
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
153
+ *
154
+ * @since 0.0.2
155
+ * @see https://eslint.org/docs/rules/no-debugger
156
+ */
157
+ "no-debugger": Linter.RuleEntry<[]>;
158
+
159
+ /**
160
+ * Rule to disallow duplicate arguments in `function` definitions.
161
+ *
162
+ * @remarks
163
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
164
+ *
165
+ * @since 0.16.0
166
+ * @see https://eslint.org/docs/rules/no-dupe-args
167
+ */
168
+ "no-dupe-args": Linter.RuleEntry<[]>;
169
+
170
+ /**
171
+ * Disallow duplicate conditions in if-else-if chains.
172
+ *
173
+ * @remarks
174
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
175
+ *
176
+ * @since 6.7.0
177
+ * @see https://eslint.org/docs/rules/no-dupe-else-if
178
+ */
179
+ "no-dupe-else-if": Linter.RuleEntry<[]>;
180
+
181
+ /**
182
+ * Rule to disallow duplicate keys in object literals.
183
+ *
184
+ * @remarks
185
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
186
+ *
187
+ * @since 0.0.9
188
+ * @see https://eslint.org/docs/rules/no-dupe-keys
189
+ */
190
+ "no-dupe-keys": Linter.RuleEntry<[]>;
191
+
192
+ /**
193
+ * Rule to disallow a duplicate case label.
194
+ *
195
+ * @remarks
196
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
197
+ *
198
+ * @since 0.17.0
199
+ * @see https://eslint.org/docs/rules/no-duplicate-case
200
+ */
201
+ "no-duplicate-case": Linter.RuleEntry<[]>;
202
+
203
+ /**
204
+ * Rule to disallow empty block statements.
205
+ *
206
+ * @remarks
207
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
208
+ *
209
+ * @since 0.0.2
210
+ * @see https://eslint.org/docs/rules/no-empty
211
+ */
212
+ "no-empty": Linter.RuleEntry<
213
+ [
214
+ Partial<{
215
+ /**
216
+ * @default false
217
+ */
218
+ allowEmptyCatch: boolean;
219
+ }>,
220
+ ]
221
+ >;
222
+
223
+ /**
224
+ * Rule to disallow empty character classes in regular expressions.
225
+ *
226
+ * @remarks
227
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
228
+ *
229
+ * @since 0.22.0
230
+ * @see https://eslint.org/docs/rules/no-empty-character-class
231
+ */
232
+ "no-empty-character-class": Linter.RuleEntry<[]>;
233
+
234
+ /**
235
+ * Rule to disallow reassigning exceptions in `catch` clauses.
236
+ *
237
+ * @remarks
238
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
239
+ *
240
+ * @since 0.0.9
241
+ * @see https://eslint.org/docs/rules/no-ex-assign
242
+ */
243
+ "no-ex-assign": Linter.RuleEntry<[]>;
244
+
245
+ /**
246
+ * Rule to disallow unnecessary boolean casts.
247
+ *
248
+ * @remarks
249
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
250
+ *
251
+ * @since 0.4.0
252
+ * @see https://eslint.org/docs/rules/no-extra-boolean-cast
253
+ */
254
+ "no-extra-boolean-cast": Linter.RuleEntry<[]>;
255
+
256
+ /**
257
+ * Rule to disallow unnecessary parentheses.
258
+ *
259
+ * @since 0.1.4
260
+ * @see https://eslint.org/docs/rules/no-extra-parens
261
+ */
262
+ "no-extra-parens":
263
+ | Linter.RuleEntry<
264
+ [
265
+ "all",
266
+ Partial<{
267
+ /**
268
+ * @default true,
269
+ */
270
+ conditionalAssign: boolean;
271
+ /**
272
+ * @default true
273
+ */
274
+ returnAssign: boolean;
275
+ /**
276
+ * @default true
277
+ */
278
+ nestedBinaryExpressions: boolean;
279
+ /**
280
+ * @default 'none'
281
+ */
282
+ ignoreJSX: "none" | "all" | "multi-line" | "single-line";
283
+ /**
284
+ * @default true
285
+ */
286
+ enforceForArrowConditionals: boolean;
287
+ }>,
288
+ ]
289
+ >
290
+ | Linter.RuleEntry<["functions"]>;
291
+
292
+ /**
293
+ * Rule to disallow unnecessary semicolons.
294
+ *
295
+ * @remarks
296
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
297
+ *
298
+ * @since 0.0.9
299
+ * @see https://eslint.org/docs/rules/no-extra-semi
300
+ */
301
+ "no-extra-semi": Linter.RuleEntry<[]>;
302
+
303
+ /**
304
+ * Rule to disallow reassigning `function` declarations.
305
+ *
306
+ * @remarks
307
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
308
+ *
309
+ * @since 0.0.9
310
+ * @see https://eslint.org/docs/rules/no-func-assign
311
+ */
312
+ "no-func-assign": Linter.RuleEntry<[]>;
313
+
314
+ /**
315
+ * Rule to disallow variable or `function` declarations in nested blocks.
316
+ *
317
+ * @remarks
318
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
319
+ *
320
+ * @since 0.6.0
321
+ * @see https://eslint.org/docs/rules/no-inner-declarations
322
+ */
323
+ "no-inner-declarations": Linter.RuleEntry<["functions" | "both"]>;
324
+
325
+ /**
326
+ * Rule to disallow invalid regular expression strings in `RegExp` constructors.
327
+ *
328
+ * @remarks
329
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
330
+ *
331
+ * @since 0.1.4
332
+ * @see https://eslint.org/docs/rules/no-invalid-regexp
333
+ */
334
+ "no-invalid-regexp": Linter.RuleEntry<
335
+ [
336
+ Partial<{
337
+ allowConstructorFlags: string[];
338
+ }>,
339
+ ]
340
+ >;
341
+
342
+ /**
343
+ * Rule to disallow irregular whitespace.
344
+ *
345
+ * @remarks
346
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
347
+ *
348
+ * @since 0.9.0
349
+ * @see https://eslint.org/docs/rules/no-irregular-whitespace
350
+ */
351
+ "no-irregular-whitespace": Linter.RuleEntry<
352
+ [
353
+ Partial<{
354
+ /**
355
+ * @default true
356
+ */
357
+ skipStrings: boolean;
358
+ /**
359
+ * @default false
360
+ */
361
+ skipComments: boolean;
362
+ /**
363
+ * @default false
364
+ */
365
+ skipRegExps: boolean;
366
+ /**
367
+ * @default false
368
+ */
369
+ skipTemplates: boolean;
370
+ }>,
371
+ ]
372
+ >;
373
+
374
+ /**
375
+ * Disallow literal numbers that lose precision.
376
+ *
377
+ * @remarks
378
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
379
+ *
380
+ * @since 7.1.0
381
+ * @see https://eslint.org/docs/latest/rules/no-loss-of-precision
382
+ */
383
+ "no-loss-of-precision": Linter.RuleEntry<[]>;
384
+
385
+ /**
386
+ * Rule to disallow characters which are made with multiple code points in character class syntax.
387
+ *
388
+ * @remarks
389
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
390
+ *
391
+ * @since 5.3.0
392
+ * @see https://eslint.org/docs/rules/no-misleading-character-class
393
+ */
394
+ "no-misleading-character-class": Linter.RuleEntry<[]>;
395
+
396
+ /**
397
+ * Rule to disallow calling global object properties as functions.
398
+ *
399
+ * @remarks
400
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
401
+ *
402
+ * @since 0.0.9
403
+ * @see https://eslint.org/docs/rules/no-obj-calls
404
+ */
405
+ "no-obj-calls": Linter.RuleEntry<[]>;
406
+
407
+ /**
408
+ * Rule to disallow returning values from Promise executor functions.
409
+ *
410
+ * @since 7.3.0
411
+ * @see https://eslint.org/docs/rules/no-promise-executor-return
412
+ */
413
+ "no-promise-executor-return": Linter.RuleEntry<[
414
+ {
415
+ /**
416
+ * @default false
417
+ */
418
+ allowVoid?: boolean;
419
+ },
420
+ ]>;
421
+
422
+ /**
423
+ * Rule to disallow use of `Object.prototypes` builtins directly.
424
+ *
425
+ * @remarks
426
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
427
+ *
428
+ * @since 2.11.0
429
+ * @see https://eslint.org/docs/rules/no-prototype-builtins
430
+ */
431
+ "no-prototype-builtins": Linter.RuleEntry<[]>;
432
+
433
+ /**
434
+ * Rule to disallow multiple spaces in regular expressions.
435
+ *
436
+ * @remarks
437
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
438
+ *
439
+ * @since 0.4.0
440
+ * @see https://eslint.org/docs/rules/no-regex-spaces
441
+ */
442
+ "no-regex-spaces": Linter.RuleEntry<[]>;
443
+
444
+ /**
445
+ * Rule to disallow sparse arrays.
446
+ *
447
+ * @remarks
448
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
449
+ *
450
+ * @since 0.4.0
451
+ * @see https://eslint.org/docs/rules/no-sparse-arrays
452
+ */
453
+ "no-sparse-arrays": Linter.RuleEntry<[]>;
454
+
455
+ /**
456
+ * Rule to disallow template literal placeholder syntax in regular strings.
457
+ *
458
+ * @since 3.3.0
459
+ * @see https://eslint.org/docs/rules/no-template-curly-in-string
460
+ */
461
+ "no-template-curly-in-string": Linter.RuleEntry<[]>;
462
+
463
+ /**
464
+ * Rule to disallow confusing multiline expressions.
465
+ *
466
+ * @remarks
467
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
468
+ *
469
+ * @since 0.24.0
470
+ * @see https://eslint.org/docs/rules/no-unexpected-multiline
471
+ */
472
+ "no-unexpected-multiline": Linter.RuleEntry<[]>;
473
+
474
+ /**
475
+ * Rule to disallow unreachable code after `return`, `throw`, `continue`, and `break` statements.
476
+ *
477
+ * @remarks
478
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
479
+ *
480
+ * @since 0.0.6
481
+ * @see https://eslint.org/docs/rules/no-unreachable
482
+ */
483
+ "no-unreachable": Linter.RuleEntry<[]>;
484
+
485
+ /**
486
+ * Disallow loops with a body that allows only one iteration.
487
+ *
488
+ * @since 7.3.0
489
+ * @see https://eslint.org/docs/latest/rules/no-unreachable-loop
490
+ */
491
+ "no-unreachable-loop": Linter.RuleEntry<
492
+ [
493
+ Partial<{
494
+ /**
495
+ * @default []
496
+ */
497
+ ignore: "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement";
498
+ }>,
499
+ ]
500
+ >;
501
+
502
+ /**
503
+ * Rule to disallow control flow statements in `finally` blocks.
504
+ *
505
+ * @remarks
506
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
507
+ *
508
+ * @since 2.9.0
509
+ * @see https://eslint.org/docs/rules/no-unsafe-finally
510
+ */
511
+ "no-unsafe-finally": Linter.RuleEntry<[]>;
512
+
513
+ /**
514
+ * Rule to disallow negating the left operand of relational operators.
515
+ *
516
+ * @remarks
517
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
518
+ *
519
+ * @since 3.3.0
520
+ * @see https://eslint.org/docs/rules/no-unsafe-negation
521
+ */
522
+ "no-unsafe-negation": Linter.RuleEntry<[]>;
523
+
524
+ /**
525
+ * Disallow use of optional chaining in contexts where the `undefined` value is not allowed.
526
+ *
527
+ * @remarks
528
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
529
+ *
530
+ * @since 7.15.0
531
+ * @see https://eslint.org/docs/rules/no-unsafe-optional-chaining
532
+ */
533
+ "no-unsafe-optional-chaining": Linter.RuleEntry<
534
+ [
535
+ Partial<{
536
+ /**
537
+ * @default false
538
+ */
539
+ disallowArithmeticOperators: boolean;
540
+ }>,
541
+ ]
542
+ >;
543
+
544
+ /**
545
+ * Rule to disallow assignments that can lead to race conditions due to usage of `await` or `yield`.
546
+ *
547
+ * @remarks
548
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
549
+ *
550
+ * @since 5.3.0
551
+ * @see https://eslint.org/docs/rules/require-atomic-updates
552
+ */
553
+ "require-atomic-updates": Linter.RuleEntry<[]>;
554
+
555
+ /**
556
+ * Rule to require calls to `isNaN()` when checking for `NaN`.
557
+ *
558
+ * @remarks
559
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
560
+ *
561
+ * @since 0.0.6
562
+ * @see https://eslint.org/docs/rules/use-isnan
563
+ */
564
+ "use-isnan": Linter.RuleEntry<
565
+ [
566
+ Partial<{
567
+ /**
568
+ * @default true
569
+ */
570
+ enforceForSwitchCase: boolean;
571
+ /**
572
+ * @default true
573
+ */
574
+ enforceForIndexOf: boolean;
575
+ }>,
576
+ ]
577
+ >;
578
+
579
+ /**
580
+ * Rule to enforce comparing `typeof` expressions against valid strings.
581
+ *
582
+ * @remarks
583
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
584
+ *
585
+ * @since 0.5.0
586
+ * @see https://eslint.org/docs/rules/valid-typeof
587
+ */
588
+ "valid-typeof": Linter.RuleEntry<
589
+ [
590
+ Partial<{
591
+ /**
592
+ * @default false
593
+ */
594
+ requireStringLiterals: boolean;
595
+ }>,
596
+ ]
597
+ >;
598
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @fileoverview This file contains the rule types for ESLint. It was initially extracted
3
+ * from the `@types/eslint` package.
4
+ */
5
+
6
+ /*
7
+ * MIT License
8
+ * Copyright (c) Microsoft Corporation.
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE
26
+ */
27
+
28
+ import { Linter } from "../index";
29
+
30
+ export interface StrictMode extends Linter.RulesRecord {
31
+ /**
32
+ * Rule to require or disallow strict mode directives.
33
+ *
34
+ * @since 0.1.0
35
+ * @see https://eslint.org/docs/rules/strict
36
+ */
37
+ strict: Linter.RuleEntry<["safe" | "global" | "function" | "never"]>;
38
+ }