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,607 @@
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 ECMAScript6 extends Linter.RulesRecord {
31
+ /**
32
+ * Rule to require braces around arrow function bodies.
33
+ *
34
+ * @since 1.8.0
35
+ * @see https://eslint.org/docs/rules/arrow-body-style
36
+ */
37
+ "arrow-body-style":
38
+ | Linter.RuleEntry<
39
+ [
40
+ "as-needed",
41
+ Partial<{
42
+ /**
43
+ * @default false
44
+ */
45
+ requireReturnForObjectLiteral: boolean;
46
+ }>,
47
+ ]
48
+ >
49
+ | Linter.RuleEntry<["always" | "never"]>;
50
+
51
+ /**
52
+ * Rule to require parentheses around arrow function arguments.
53
+ *
54
+ * @since 1.0.0-rc-1
55
+ * @see https://eslint.org/docs/rules/arrow-parens
56
+ */
57
+ "arrow-parens":
58
+ | Linter.RuleEntry<["always"]>
59
+ | Linter.RuleEntry<
60
+ [
61
+ "as-needed",
62
+ Partial<{
63
+ /**
64
+ * @default false
65
+ */
66
+ requireForBlockBody: boolean;
67
+ }>,
68
+ ]
69
+ >;
70
+
71
+ /**
72
+ * Rule to enforce consistent spacing before and after the arrow in arrow functions.
73
+ *
74
+ * @since 1.0.0-rc-1
75
+ * @see https://eslint.org/docs/rules/arrow-spacing
76
+ */
77
+ "arrow-spacing": Linter.RuleEntry<[]>;
78
+
79
+ /**
80
+ * Rule to require `super()` calls in constructors.
81
+ *
82
+ * @remarks
83
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
84
+ *
85
+ * @since 0.24.0
86
+ * @see https://eslint.org/docs/rules/constructor-super
87
+ */
88
+ "constructor-super": Linter.RuleEntry<[]>;
89
+
90
+ /**
91
+ * Rule to enforce consistent spacing around `*` operators in generator functions.
92
+ *
93
+ * @since 0.17.0
94
+ * @see https://eslint.org/docs/rules/generator-star-spacing
95
+ */
96
+ "generator-star-spacing": Linter.RuleEntry<
97
+ [
98
+ | Partial<{
99
+ before: boolean;
100
+ after: boolean;
101
+ named:
102
+ | Partial<{
103
+ before: boolean;
104
+ after: boolean;
105
+ }>
106
+ | "before"
107
+ | "after"
108
+ | "both"
109
+ | "neither";
110
+ anonymous:
111
+ | Partial<{
112
+ before: boolean;
113
+ after: boolean;
114
+ }>
115
+ | "before"
116
+ | "after"
117
+ | "both"
118
+ | "neither";
119
+ method:
120
+ | Partial<{
121
+ before: boolean;
122
+ after: boolean;
123
+ }>
124
+ | "before"
125
+ | "after"
126
+ | "both"
127
+ | "neither";
128
+ }>
129
+ | "before"
130
+ | "after"
131
+ | "both"
132
+ | "neither",
133
+ ]
134
+ >;
135
+
136
+ /**
137
+ * Require or disallow logical assignment operator shorthand.
138
+ *
139
+ * @since 8.24.0
140
+ * @see https://eslint.org/docs/rules/logical-assignment-operators
141
+ */
142
+ "logical-assignment-operators":
143
+ | Linter.RuleEntry<
144
+ [
145
+ "always",
146
+ Partial<{
147
+ /**
148
+ * @default false
149
+ */
150
+ enforceForIfStatements: boolean;
151
+ }>,
152
+ ]
153
+ >
154
+ | Linter.RuleEntry<["never"]>;
155
+
156
+ /**
157
+ * Rule to disallow reassigning class members.
158
+ *
159
+ * @remarks
160
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
161
+ *
162
+ * @since 1.0.0-rc-1
163
+ * @see https://eslint.org/docs/rules/no-class-assign
164
+ */
165
+ "no-class-assign": Linter.RuleEntry<[]>;
166
+
167
+ /**
168
+ * Rule to disallow arrow functions where they could be confused with comparisons.
169
+ *
170
+ * @since 2.0.0-alpha-2
171
+ * @see https://eslint.org/docs/rules/no-confusing-arrow
172
+ */
173
+ "no-confusing-arrow": Linter.RuleEntry<
174
+ [
175
+ Partial<{
176
+ /**
177
+ * @default true
178
+ */
179
+ allowParens: boolean;
180
+ }>,
181
+ ]
182
+ >;
183
+
184
+ /**
185
+ * Rule to disallow reassigning `const` variables.
186
+ *
187
+ * @remarks
188
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
189
+ *
190
+ * @since 1.0.0-rc-1
191
+ * @see https://eslint.org/docs/rules/no-const-assign
192
+ */
193
+ "no-const-assign": Linter.RuleEntry<[]>;
194
+
195
+ /**
196
+ * Rule to disallow duplicate class members.
197
+ *
198
+ * @remarks
199
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
200
+ *
201
+ * @since 1.2.0
202
+ * @see https://eslint.org/docs/rules/no-dupe-class-members
203
+ */
204
+ "no-dupe-class-members": Linter.RuleEntry<[]>;
205
+
206
+ /**
207
+ * Rule to disallow duplicate module imports.
208
+ *
209
+ * @since 2.5.0
210
+ * @see https://eslint.org/docs/rules/no-duplicate-imports
211
+ */
212
+ "no-duplicate-imports": Linter.RuleEntry<
213
+ [
214
+ Partial<{
215
+ /**
216
+ * @default false
217
+ */
218
+ includeExports: boolean;
219
+ }>,
220
+ ]
221
+ >;
222
+
223
+ /**
224
+ * Rule to disallow `new` operators with the `Symbol` object.
225
+ *
226
+ * @remarks
227
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
228
+ *
229
+ * @since 2.0.0-beta.1
230
+ * @see https://eslint.org/docs/rules/no-new-symbol
231
+ */
232
+ "no-new-symbol": Linter.RuleEntry<[]>;
233
+
234
+ /**
235
+ * Rule to disallow specified names in exports.
236
+ *
237
+ * @since 7.0.0-alpha.0
238
+ * @see https://eslint.org/docs/rules/no-restricted-exports
239
+ */
240
+ "no-restricted-exports": Linter.RuleEntry<
241
+ [
242
+ Partial<{
243
+ /**
244
+ * @default []
245
+ */
246
+ restrictedNamedExports: string[];
247
+ /**
248
+ * @since 9.3.0
249
+ */
250
+ restrictedNamedExportsPattern: string;
251
+ /**
252
+ * @since 8.33.0
253
+ */
254
+ restrictDefaultExports: Partial<{
255
+ /**
256
+ * @default false
257
+ */
258
+ direct: boolean;
259
+ /**
260
+ * @default false
261
+ */
262
+ named: boolean;
263
+ /**
264
+ * @default false
265
+ */
266
+ defaultFrom: boolean;
267
+ /**
268
+ * @default false
269
+ */
270
+ namedFrom: boolean;
271
+ /**
272
+ * @default false
273
+ */
274
+ namespaceFrom: boolean;
275
+ }>;
276
+ }>,
277
+ ]
278
+ >;
279
+
280
+ /**
281
+ * Rule to disallow specified modules when loaded by `import`.
282
+ *
283
+ * @since 2.0.0-alpha-1
284
+ * @see https://eslint.org/docs/rules/no-restricted-imports
285
+ */
286
+ "no-restricted-imports": Linter.RuleEntry<
287
+ [
288
+ ...Array<
289
+ | string
290
+ | {
291
+ name: string;
292
+ importNames?: string[] | undefined;
293
+ message?: string | undefined;
294
+ }
295
+ | Partial<{
296
+ paths: Array<
297
+ | string
298
+ | {
299
+ name: string;
300
+ importNames?: string[] | undefined;
301
+ message?: string | undefined;
302
+ }
303
+ >;
304
+ patterns: string[];
305
+ }>
306
+ >,
307
+ ]
308
+ >;
309
+
310
+ /**
311
+ * Rule to disallow `this`/`super` before calling `super()` in constructors.
312
+ *
313
+ * @remarks
314
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
315
+ *
316
+ * @since 0.24.0
317
+ * @see https://eslint.org/docs/rules/no-this-before-super
318
+ */
319
+ "no-this-before-super": Linter.RuleEntry<[]>;
320
+
321
+ /**
322
+ * Rule to disallow unnecessary computed property keys in object literals.
323
+ *
324
+ * @since 2.9.0
325
+ * @see https://eslint.org/docs/rules/no-useless-computed-key
326
+ */
327
+ "no-useless-computed-key": Linter.RuleEntry<[]>;
328
+
329
+ /**
330
+ * Rule to disallow unnecessary constructors.
331
+ *
332
+ * @since 2.0.0-beta.1
333
+ * @see https://eslint.org/docs/rules/no-useless-constructor
334
+ */
335
+ "no-useless-constructor": Linter.RuleEntry<[]>;
336
+
337
+ /**
338
+ * Rule to disallow renaming import, export, and destructured assignments to the same name.
339
+ *
340
+ * @since 2.11.0
341
+ * @see https://eslint.org/docs/rules/no-useless-rename
342
+ */
343
+ "no-useless-rename": Linter.RuleEntry<
344
+ [
345
+ Partial<{
346
+ /**
347
+ * @default false
348
+ */
349
+ ignoreImport: boolean;
350
+ /**
351
+ * @default false
352
+ */
353
+ ignoreExport: boolean;
354
+ /**
355
+ * @default false
356
+ */
357
+ ignoreDestructuring: boolean;
358
+ }>,
359
+ ]
360
+ >;
361
+
362
+ /**
363
+ * Rule to require `let` or `const` instead of `var`.
364
+ *
365
+ * @since 0.12.0
366
+ * @see https://eslint.org/docs/rules/no-var
367
+ */
368
+ "no-var": Linter.RuleEntry<[]>;
369
+
370
+ /**
371
+ * Rule to require or disallow method and property shorthand syntax for object literals.
372
+ *
373
+ * @since 0.20.0
374
+ * @see https://eslint.org/docs/rules/object-shorthand
375
+ */
376
+ "object-shorthand":
377
+ | Linter.RuleEntry<
378
+ [
379
+ "always" | "methods",
380
+ Partial<{
381
+ /**
382
+ * @default false
383
+ */
384
+ avoidQuotes: boolean;
385
+ /**
386
+ * @default false
387
+ */
388
+ ignoreConstructors: boolean;
389
+ /**
390
+ * @default false
391
+ */
392
+ avoidExplicitReturnArrows: boolean;
393
+ }>,
394
+ ]
395
+ >
396
+ | Linter.RuleEntry<
397
+ [
398
+ "properties",
399
+ Partial<{
400
+ /**
401
+ * @default false
402
+ */
403
+ avoidQuotes: boolean;
404
+ }>,
405
+ ]
406
+ >
407
+ | Linter.RuleEntry<["never" | "consistent" | "consistent-as-needed"]>;
408
+
409
+ /**
410
+ * Rule to require using arrow functions for callbacks.
411
+ *
412
+ * @since 1.2.0
413
+ * @see https://eslint.org/docs/rules/prefer-arrow-callback
414
+ */
415
+ "prefer-arrow-callback": Linter.RuleEntry<
416
+ [
417
+ Partial<{
418
+ /**
419
+ * @default false
420
+ */
421
+ allowNamedFunctions: boolean;
422
+ /**
423
+ * @default true
424
+ */
425
+ allowUnboundThis: boolean;
426
+ }>,
427
+ ]
428
+ >;
429
+
430
+ /**
431
+ * Rule to require `const` declarations for variables that are never reassigned after declared.
432
+ *
433
+ * @since 0.23.0
434
+ * @see https://eslint.org/docs/rules/prefer-const
435
+ */
436
+ "prefer-const": Linter.RuleEntry<
437
+ [
438
+ Partial<{
439
+ /**
440
+ * @default 'any'
441
+ */
442
+ destructuring: "any" | "all";
443
+ /**
444
+ * @default false
445
+ */
446
+ ignoreReadBeforeAssign: boolean;
447
+ }>,
448
+ ]
449
+ >;
450
+
451
+ /**
452
+ * Rule to require destructuring from arrays and/or objects.
453
+ *
454
+ * @since 3.13.0
455
+ * @see https://eslint.org/docs/rules/prefer-destructuring
456
+ */
457
+ "prefer-destructuring": Linter.RuleEntry<
458
+ [
459
+ Partial<
460
+ | {
461
+ VariableDeclarator: Partial<{
462
+ array: boolean;
463
+ object: boolean;
464
+ }>;
465
+ AssignmentExpression: Partial<{
466
+ array: boolean;
467
+ object: boolean;
468
+ }>;
469
+ }
470
+ | {
471
+ array: boolean;
472
+ object: boolean;
473
+ }
474
+ >,
475
+ Partial<{
476
+ enforceForRenamedProperties: boolean;
477
+ }>,
478
+ ]
479
+ >;
480
+
481
+ /**
482
+ * Disallow the use of `Math.pow` in favor of the `**` operator.
483
+ *
484
+ * @since 6.7.0
485
+ * @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
486
+ */
487
+ "prefer-exponentiation-operator": Linter.RuleEntry<[]>;
488
+
489
+ /**
490
+ * Rule to disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals.
491
+ *
492
+ * @since 3.5.0
493
+ * @see https://eslint.org/docs/rules/prefer-numeric-literals
494
+ */
495
+ "prefer-numeric-literals": Linter.RuleEntry<[]>;
496
+
497
+ /**
498
+ * Rule to require rest parameters instead of `arguments`.
499
+ *
500
+ * @since 2.0.0-alpha-1
501
+ * @see https://eslint.org/docs/rules/prefer-rest-params
502
+ */
503
+ "prefer-rest-params": Linter.RuleEntry<[]>;
504
+
505
+ /**
506
+ * Rule to require spread operators instead of `.apply()`.
507
+ *
508
+ * @since 1.0.0-rc-1
509
+ * @see https://eslint.org/docs/rules/prefer-spread
510
+ */
511
+ "prefer-spread": Linter.RuleEntry<[]>;
512
+
513
+ /**
514
+ * Rule to require template literals instead of string concatenation.
515
+ *
516
+ * @since 1.2.0
517
+ * @see https://eslint.org/docs/rules/prefer-template
518
+ */
519
+ "prefer-template": Linter.RuleEntry<[]>;
520
+
521
+ /**
522
+ * Rule to require generator functions to contain `yield`.
523
+ *
524
+ * @remarks
525
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
526
+ *
527
+ * @since 1.0.0-rc-1
528
+ * @see https://eslint.org/docs/rules/require-yield
529
+ */
530
+ "require-yield": Linter.RuleEntry<[]>;
531
+
532
+ /**
533
+ * Rule to enforce spacing between rest and spread operators and their expressions.
534
+ *
535
+ * @since 2.12.0
536
+ * @see https://eslint.org/docs/rules/rest-spread-spacing
537
+ */
538
+ "rest-spread-spacing": Linter.RuleEntry<["never" | "always"]>;
539
+
540
+ /**
541
+ * Rule to enforce sorted import declarations within modules.
542
+ *
543
+ * @since 2.0.0-beta.1
544
+ * @see https://eslint.org/docs/rules/sort-imports
545
+ */
546
+ "sort-imports": Linter.RuleEntry<
547
+ [
548
+ Partial<{
549
+ /**
550
+ * @default false
551
+ */
552
+ ignoreCase: boolean;
553
+ /**
554
+ * @default false
555
+ */
556
+ ignoreDeclarationSort: boolean;
557
+ /**
558
+ * @default false
559
+ */
560
+ ignoreMemberSort: boolean;
561
+ /**
562
+ * @default ['none', 'all', 'multiple', 'single']
563
+ */
564
+ memberSyntaxSortOrder: Array<"none" | "all" | "multiple" | "single">;
565
+ /**
566
+ * @default false
567
+ */
568
+ allowSeparatedGroups: boolean;
569
+ }>,
570
+ ]
571
+ >;
572
+
573
+ /**
574
+ * Rule to require symbol descriptions.
575
+ *
576
+ * @since 3.4.0
577
+ * @see https://eslint.org/docs/rules/symbol-description
578
+ */
579
+ "symbol-description": Linter.RuleEntry<[]>;
580
+
581
+ /**
582
+ * Rule to require or disallow spacing around embedded expressions of template strings.
583
+ *
584
+ * @since 2.0.0-rc.0
585
+ * @see https://eslint.org/docs/rules/template-curly-spacing
586
+ */
587
+ "template-curly-spacing": Linter.RuleEntry<["never" | "always"]>;
588
+
589
+ /**
590
+ * Rule to require or disallow spacing around the `*` in `yield*` expressions.
591
+ *
592
+ * @since 2.0.0-alpha-1
593
+ * @see https://eslint.org/docs/rules/yield-star-spacing
594
+ */
595
+ "yield-star-spacing": Linter.RuleEntry<
596
+ [
597
+ | Partial<{
598
+ before: boolean;
599
+ after: boolean;
600
+ }>
601
+ | "before"
602
+ | "after"
603
+ | "both"
604
+ | "neither",
605
+ ]
606
+ >;
607
+ }
@@ -0,0 +1,50 @@
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
+
29
+ import { Linter } from "../index";
30
+
31
+ import { BestPractices } from "./best-practices";
32
+ import { Deprecated } from "./deprecated";
33
+ import { ECMAScript6 } from "./ecmascript-6";
34
+ import { NodeJSAndCommonJS } from "./node-commonjs";
35
+ import { PossibleErrors } from "./possible-errors";
36
+ import { StrictMode } from "./strict-mode";
37
+ import { StylisticIssues } from "./stylistic-issues";
38
+ import { Variables } from "./variables";
39
+
40
+ export interface ESLintRules
41
+ extends
42
+ Linter.RulesRecord,
43
+ PossibleErrors,
44
+ BestPractices,
45
+ StrictMode,
46
+ Variables,
47
+ NodeJSAndCommonJS,
48
+ StylisticIssues,
49
+ ECMAScript6,
50
+ Deprecated { }