eslint 9.9.1 → 9.11.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,631 @@
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
+ | Partial<{
257
+ /**
258
+ * @since 9.3.0
259
+ * @default false
260
+ */
261
+ enforceForInnerExpressions: boolean;
262
+ /**
263
+ * @deprecated
264
+ */
265
+ enforceForLogicalOperands: never;
266
+ }>
267
+ | Partial<{
268
+ /**
269
+ * @deprecated
270
+ * @since 7.0.0-alpha.2
271
+ * @default false
272
+ */
273
+ enforceForLogicalOperands: boolean;
274
+ enforceForInnerExpressions: never;
275
+ }>,
276
+ ]
277
+ >;
278
+
279
+ /**
280
+ * Rule to disallow unnecessary parentheses.
281
+ *
282
+ * @since 0.1.4
283
+ * @see https://eslint.org/docs/rules/no-extra-parens
284
+ */
285
+ "no-extra-parens":
286
+ | Linter.RuleEntry<
287
+ [
288
+ "all",
289
+ Partial<{
290
+ /**
291
+ * @default true,
292
+ */
293
+ conditionalAssign: boolean;
294
+ /**
295
+ * @default true
296
+ */
297
+ returnAssign: boolean;
298
+ /**
299
+ * @default true
300
+ */
301
+ nestedBinaryExpressions: boolean;
302
+ /**
303
+ * @default 'none'
304
+ */
305
+ ignoreJSX: "none" | "all" | "multi-line" | "single-line";
306
+ /**
307
+ * @default true
308
+ */
309
+ enforceForArrowConditionals: boolean;
310
+ }>,
311
+ ]
312
+ >
313
+ | Linter.RuleEntry<["functions"]>;
314
+
315
+ /**
316
+ * Rule to disallow unnecessary semicolons.
317
+ *
318
+ * @remarks
319
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
320
+ *
321
+ * @since 0.0.9
322
+ * @see https://eslint.org/docs/rules/no-extra-semi
323
+ */
324
+ "no-extra-semi": Linter.RuleEntry<[]>;
325
+
326
+ /**
327
+ * Rule to disallow reassigning `function` declarations.
328
+ *
329
+ * @remarks
330
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
331
+ *
332
+ * @since 0.0.9
333
+ * @see https://eslint.org/docs/rules/no-func-assign
334
+ */
335
+ "no-func-assign": Linter.RuleEntry<[]>;
336
+
337
+ /**
338
+ * Rule to disallow variable or `function` declarations in nested blocks.
339
+ *
340
+ * @remarks
341
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
342
+ *
343
+ * @since 0.6.0
344
+ * @see https://eslint.org/docs/rules/no-inner-declarations
345
+ */
346
+ "no-inner-declarations": Linter.RuleEntry<["functions" | "both"]>;
347
+
348
+ /**
349
+ * Rule to disallow invalid regular expression strings in `RegExp` constructors.
350
+ *
351
+ * @remarks
352
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
353
+ *
354
+ * @since 0.1.4
355
+ * @see https://eslint.org/docs/rules/no-invalid-regexp
356
+ */
357
+ "no-invalid-regexp": Linter.RuleEntry<
358
+ [
359
+ Partial<{
360
+ allowConstructorFlags: string[];
361
+ }>,
362
+ ]
363
+ >;
364
+
365
+ /**
366
+ * Rule to disallow irregular whitespace.
367
+ *
368
+ * @remarks
369
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
370
+ *
371
+ * @since 0.9.0
372
+ * @see https://eslint.org/docs/rules/no-irregular-whitespace
373
+ */
374
+ "no-irregular-whitespace": Linter.RuleEntry<
375
+ [
376
+ Partial<{
377
+ /**
378
+ * @default true
379
+ */
380
+ skipStrings: boolean;
381
+ /**
382
+ * @default false
383
+ */
384
+ skipComments: boolean;
385
+ /**
386
+ * @default false
387
+ */
388
+ skipRegExps: boolean;
389
+ /**
390
+ * @default false
391
+ */
392
+ skipTemplates: boolean;
393
+ }>,
394
+ ]
395
+ >;
396
+
397
+ /**
398
+ * Disallow literal numbers that lose precision.
399
+ *
400
+ * @remarks
401
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
402
+ *
403
+ * @since 7.1.0
404
+ * @see https://eslint.org/docs/latest/rules/no-loss-of-precision
405
+ */
406
+ "no-loss-of-precision": Linter.RuleEntry<[]>;
407
+
408
+ /**
409
+ * Rule to disallow characters which are made with multiple code points in character class syntax.
410
+ *
411
+ * @remarks
412
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
413
+ *
414
+ * @since 5.3.0
415
+ * @see https://eslint.org/docs/rules/no-misleading-character-class
416
+ */
417
+ "no-misleading-character-class": Linter.RuleEntry<
418
+ [
419
+ Partial<{
420
+ /**
421
+ * @since 9.3.0
422
+ * @default false
423
+ */
424
+ allowEscape: boolean;
425
+ }>,
426
+ ]
427
+ >;
428
+
429
+ /**
430
+ * Rule to disallow calling global object properties as functions.
431
+ *
432
+ * @remarks
433
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
434
+ *
435
+ * @since 0.0.9
436
+ * @see https://eslint.org/docs/rules/no-obj-calls
437
+ */
438
+ "no-obj-calls": Linter.RuleEntry<[]>;
439
+
440
+ /**
441
+ * Rule to disallow returning values from Promise executor functions.
442
+ *
443
+ * @since 7.3.0
444
+ * @see https://eslint.org/docs/rules/no-promise-executor-return
445
+ */
446
+ "no-promise-executor-return": Linter.RuleEntry<[
447
+ {
448
+ /**
449
+ * @default false
450
+ */
451
+ allowVoid?: boolean;
452
+ },
453
+ ]>;
454
+
455
+ /**
456
+ * Rule to disallow use of `Object.prototypes` builtins directly.
457
+ *
458
+ * @remarks
459
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
460
+ *
461
+ * @since 2.11.0
462
+ * @see https://eslint.org/docs/rules/no-prototype-builtins
463
+ */
464
+ "no-prototype-builtins": Linter.RuleEntry<[]>;
465
+
466
+ /**
467
+ * Rule to disallow multiple spaces in regular expressions.
468
+ *
469
+ * @remarks
470
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
471
+ *
472
+ * @since 0.4.0
473
+ * @see https://eslint.org/docs/rules/no-regex-spaces
474
+ */
475
+ "no-regex-spaces": Linter.RuleEntry<[]>;
476
+
477
+ /**
478
+ * Rule to disallow sparse arrays.
479
+ *
480
+ * @remarks
481
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
482
+ *
483
+ * @since 0.4.0
484
+ * @see https://eslint.org/docs/rules/no-sparse-arrays
485
+ */
486
+ "no-sparse-arrays": Linter.RuleEntry<[]>;
487
+
488
+ /**
489
+ * Rule to disallow template literal placeholder syntax in regular strings.
490
+ *
491
+ * @since 3.3.0
492
+ * @see https://eslint.org/docs/rules/no-template-curly-in-string
493
+ */
494
+ "no-template-curly-in-string": Linter.RuleEntry<[]>;
495
+
496
+ /**
497
+ * Rule to disallow confusing multiline expressions.
498
+ *
499
+ * @remarks
500
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
501
+ *
502
+ * @since 0.24.0
503
+ * @see https://eslint.org/docs/rules/no-unexpected-multiline
504
+ */
505
+ "no-unexpected-multiline": Linter.RuleEntry<[]>;
506
+
507
+ /**
508
+ * Rule to disallow unreachable code after `return`, `throw`, `continue`, and `break` statements.
509
+ *
510
+ * @remarks
511
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
512
+ *
513
+ * @since 0.0.6
514
+ * @see https://eslint.org/docs/rules/no-unreachable
515
+ */
516
+ "no-unreachable": Linter.RuleEntry<[]>;
517
+
518
+ /**
519
+ * Disallow loops with a body that allows only one iteration.
520
+ *
521
+ * @since 7.3.0
522
+ * @see https://eslint.org/docs/latest/rules/no-unreachable-loop
523
+ */
524
+ "no-unreachable-loop": Linter.RuleEntry<
525
+ [
526
+ Partial<{
527
+ /**
528
+ * @default []
529
+ */
530
+ ignore: "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement";
531
+ }>,
532
+ ]
533
+ >;
534
+
535
+ /**
536
+ * Rule to disallow control flow statements in `finally` blocks.
537
+ *
538
+ * @remarks
539
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
540
+ *
541
+ * @since 2.9.0
542
+ * @see https://eslint.org/docs/rules/no-unsafe-finally
543
+ */
544
+ "no-unsafe-finally": Linter.RuleEntry<[]>;
545
+
546
+ /**
547
+ * Rule to disallow negating the left operand of relational operators.
548
+ *
549
+ * @remarks
550
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
551
+ *
552
+ * @since 3.3.0
553
+ * @see https://eslint.org/docs/rules/no-unsafe-negation
554
+ */
555
+ "no-unsafe-negation": Linter.RuleEntry<[]>;
556
+
557
+ /**
558
+ * Disallow use of optional chaining in contexts where the `undefined` value is not allowed.
559
+ *
560
+ * @remarks
561
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
562
+ *
563
+ * @since 7.15.0
564
+ * @see https://eslint.org/docs/rules/no-unsafe-optional-chaining
565
+ */
566
+ "no-unsafe-optional-chaining": Linter.RuleEntry<
567
+ [
568
+ Partial<{
569
+ /**
570
+ * @default false
571
+ */
572
+ disallowArithmeticOperators: boolean;
573
+ }>,
574
+ ]
575
+ >;
576
+
577
+ /**
578
+ * Rule to disallow assignments that can lead to race conditions due to usage of `await` or `yield`.
579
+ *
580
+ * @remarks
581
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
582
+ *
583
+ * @since 5.3.0
584
+ * @see https://eslint.org/docs/rules/require-atomic-updates
585
+ */
586
+ "require-atomic-updates": Linter.RuleEntry<[]>;
587
+
588
+ /**
589
+ * Rule to require calls to `isNaN()` when checking for `NaN`.
590
+ *
591
+ * @remarks
592
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
593
+ *
594
+ * @since 0.0.6
595
+ * @see https://eslint.org/docs/rules/use-isnan
596
+ */
597
+ "use-isnan": Linter.RuleEntry<
598
+ [
599
+ Partial<{
600
+ /**
601
+ * @default true
602
+ */
603
+ enforceForSwitchCase: boolean;
604
+ /**
605
+ * @default true
606
+ */
607
+ enforceForIndexOf: boolean;
608
+ }>,
609
+ ]
610
+ >;
611
+
612
+ /**
613
+ * Rule to enforce comparing `typeof` expressions against valid strings.
614
+ *
615
+ * @remarks
616
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
617
+ *
618
+ * @since 0.5.0
619
+ * @see https://eslint.org/docs/rules/valid-typeof
620
+ */
621
+ "valid-typeof": Linter.RuleEntry<
622
+ [
623
+ Partial<{
624
+ /**
625
+ * @default false
626
+ */
627
+ requireStringLiterals: boolean;
628
+ }>,
629
+ ]
630
+ >;
631
+ }
@@ -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
+ }