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,561 @@
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 modules when loaded by `import`.
236
+ *
237
+ * @since 2.0.0-alpha-1
238
+ * @see https://eslint.org/docs/rules/no-restricted-imports
239
+ */
240
+ "no-restricted-imports": Linter.RuleEntry<
241
+ [
242
+ ...Array<
243
+ | string
244
+ | {
245
+ name: string;
246
+ importNames?: string[] | undefined;
247
+ message?: string | undefined;
248
+ }
249
+ | Partial<{
250
+ paths: Array<
251
+ | string
252
+ | {
253
+ name: string;
254
+ importNames?: string[] | undefined;
255
+ message?: string | undefined;
256
+ }
257
+ >;
258
+ patterns: string[];
259
+ }>
260
+ >,
261
+ ]
262
+ >;
263
+
264
+ /**
265
+ * Rule to disallow `this`/`super` before calling `super()` in constructors.
266
+ *
267
+ * @remarks
268
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
269
+ *
270
+ * @since 0.24.0
271
+ * @see https://eslint.org/docs/rules/no-this-before-super
272
+ */
273
+ "no-this-before-super": Linter.RuleEntry<[]>;
274
+
275
+ /**
276
+ * Rule to disallow unnecessary computed property keys in object literals.
277
+ *
278
+ * @since 2.9.0
279
+ * @see https://eslint.org/docs/rules/no-useless-computed-key
280
+ */
281
+ "no-useless-computed-key": Linter.RuleEntry<[]>;
282
+
283
+ /**
284
+ * Rule to disallow unnecessary constructors.
285
+ *
286
+ * @since 2.0.0-beta.1
287
+ * @see https://eslint.org/docs/rules/no-useless-constructor
288
+ */
289
+ "no-useless-constructor": Linter.RuleEntry<[]>;
290
+
291
+ /**
292
+ * Rule to disallow renaming import, export, and destructured assignments to the same name.
293
+ *
294
+ * @since 2.11.0
295
+ * @see https://eslint.org/docs/rules/no-useless-rename
296
+ */
297
+ "no-useless-rename": Linter.RuleEntry<
298
+ [
299
+ Partial<{
300
+ /**
301
+ * @default false
302
+ */
303
+ ignoreImport: boolean;
304
+ /**
305
+ * @default false
306
+ */
307
+ ignoreExport: boolean;
308
+ /**
309
+ * @default false
310
+ */
311
+ ignoreDestructuring: boolean;
312
+ }>,
313
+ ]
314
+ >;
315
+
316
+ /**
317
+ * Rule to require `let` or `const` instead of `var`.
318
+ *
319
+ * @since 0.12.0
320
+ * @see https://eslint.org/docs/rules/no-var
321
+ */
322
+ "no-var": Linter.RuleEntry<[]>;
323
+
324
+ /**
325
+ * Rule to require or disallow method and property shorthand syntax for object literals.
326
+ *
327
+ * @since 0.20.0
328
+ * @see https://eslint.org/docs/rules/object-shorthand
329
+ */
330
+ "object-shorthand":
331
+ | Linter.RuleEntry<
332
+ [
333
+ "always" | "methods",
334
+ Partial<{
335
+ /**
336
+ * @default false
337
+ */
338
+ avoidQuotes: boolean;
339
+ /**
340
+ * @default false
341
+ */
342
+ ignoreConstructors: boolean;
343
+ /**
344
+ * @default false
345
+ */
346
+ avoidExplicitReturnArrows: boolean;
347
+ }>,
348
+ ]
349
+ >
350
+ | Linter.RuleEntry<
351
+ [
352
+ "properties",
353
+ Partial<{
354
+ /**
355
+ * @default false
356
+ */
357
+ avoidQuotes: boolean;
358
+ }>,
359
+ ]
360
+ >
361
+ | Linter.RuleEntry<["never" | "consistent" | "consistent-as-needed"]>;
362
+
363
+ /**
364
+ * Rule to require using arrow functions for callbacks.
365
+ *
366
+ * @since 1.2.0
367
+ * @see https://eslint.org/docs/rules/prefer-arrow-callback
368
+ */
369
+ "prefer-arrow-callback": Linter.RuleEntry<
370
+ [
371
+ Partial<{
372
+ /**
373
+ * @default false
374
+ */
375
+ allowNamedFunctions: boolean;
376
+ /**
377
+ * @default true
378
+ */
379
+ allowUnboundThis: boolean;
380
+ }>,
381
+ ]
382
+ >;
383
+
384
+ /**
385
+ * Rule to require `const` declarations for variables that are never reassigned after declared.
386
+ *
387
+ * @since 0.23.0
388
+ * @see https://eslint.org/docs/rules/prefer-const
389
+ */
390
+ "prefer-const": Linter.RuleEntry<
391
+ [
392
+ Partial<{
393
+ /**
394
+ * @default 'any'
395
+ */
396
+ destructuring: "any" | "all";
397
+ /**
398
+ * @default false
399
+ */
400
+ ignoreReadBeforeAssign: boolean;
401
+ }>,
402
+ ]
403
+ >;
404
+
405
+ /**
406
+ * Rule to require destructuring from arrays and/or objects.
407
+ *
408
+ * @since 3.13.0
409
+ * @see https://eslint.org/docs/rules/prefer-destructuring
410
+ */
411
+ "prefer-destructuring": Linter.RuleEntry<
412
+ [
413
+ Partial<
414
+ | {
415
+ VariableDeclarator: Partial<{
416
+ array: boolean;
417
+ object: boolean;
418
+ }>;
419
+ AssignmentExpression: Partial<{
420
+ array: boolean;
421
+ object: boolean;
422
+ }>;
423
+ }
424
+ | {
425
+ array: boolean;
426
+ object: boolean;
427
+ }
428
+ >,
429
+ Partial<{
430
+ enforceForRenamedProperties: boolean;
431
+ }>,
432
+ ]
433
+ >;
434
+
435
+ /**
436
+ * Disallow the use of `Math.pow` in favor of the `**` operator.
437
+ *
438
+ * @since 6.7.0
439
+ * @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
440
+ */
441
+ "prefer-exponentiation-operator": Linter.RuleEntry<[]>;
442
+
443
+ /**
444
+ * Rule to disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals.
445
+ *
446
+ * @since 3.5.0
447
+ * @see https://eslint.org/docs/rules/prefer-numeric-literals
448
+ */
449
+ "prefer-numeric-literals": Linter.RuleEntry<[]>;
450
+
451
+ /**
452
+ * Rule to require rest parameters instead of `arguments`.
453
+ *
454
+ * @since 2.0.0-alpha-1
455
+ * @see https://eslint.org/docs/rules/prefer-rest-params
456
+ */
457
+ "prefer-rest-params": Linter.RuleEntry<[]>;
458
+
459
+ /**
460
+ * Rule to require spread operators instead of `.apply()`.
461
+ *
462
+ * @since 1.0.0-rc-1
463
+ * @see https://eslint.org/docs/rules/prefer-spread
464
+ */
465
+ "prefer-spread": Linter.RuleEntry<[]>;
466
+
467
+ /**
468
+ * Rule to require template literals instead of string concatenation.
469
+ *
470
+ * @since 1.2.0
471
+ * @see https://eslint.org/docs/rules/prefer-template
472
+ */
473
+ "prefer-template": Linter.RuleEntry<[]>;
474
+
475
+ /**
476
+ * Rule to require generator functions to contain `yield`.
477
+ *
478
+ * @remarks
479
+ * Recommended by ESLint, the rule was enabled in `eslint:recommended`.
480
+ *
481
+ * @since 1.0.0-rc-1
482
+ * @see https://eslint.org/docs/rules/require-yield
483
+ */
484
+ "require-yield": Linter.RuleEntry<[]>;
485
+
486
+ /**
487
+ * Rule to enforce spacing between rest and spread operators and their expressions.
488
+ *
489
+ * @since 2.12.0
490
+ * @see https://eslint.org/docs/rules/rest-spread-spacing
491
+ */
492
+ "rest-spread-spacing": Linter.RuleEntry<["never" | "always"]>;
493
+
494
+ /**
495
+ * Rule to enforce sorted import declarations within modules.
496
+ *
497
+ * @since 2.0.0-beta.1
498
+ * @see https://eslint.org/docs/rules/sort-imports
499
+ */
500
+ "sort-imports": Linter.RuleEntry<
501
+ [
502
+ Partial<{
503
+ /**
504
+ * @default false
505
+ */
506
+ ignoreCase: boolean;
507
+ /**
508
+ * @default false
509
+ */
510
+ ignoreDeclarationSort: boolean;
511
+ /**
512
+ * @default false
513
+ */
514
+ ignoreMemberSort: boolean;
515
+ /**
516
+ * @default ['none', 'all', 'multiple', 'single']
517
+ */
518
+ memberSyntaxSortOrder: Array<"none" | "all" | "multiple" | "single">;
519
+ /**
520
+ * @default false
521
+ */
522
+ allowSeparatedGroups: boolean;
523
+ }>,
524
+ ]
525
+ >;
526
+
527
+ /**
528
+ * Rule to require symbol descriptions.
529
+ *
530
+ * @since 3.4.0
531
+ * @see https://eslint.org/docs/rules/symbol-description
532
+ */
533
+ "symbol-description": Linter.RuleEntry<[]>;
534
+
535
+ /**
536
+ * Rule to require or disallow spacing around embedded expressions of template strings.
537
+ *
538
+ * @since 2.0.0-rc.0
539
+ * @see https://eslint.org/docs/rules/template-curly-spacing
540
+ */
541
+ "template-curly-spacing": Linter.RuleEntry<["never" | "always"]>;
542
+
543
+ /**
544
+ * Rule to require or disallow spacing around the `*` in `yield*` expressions.
545
+ *
546
+ * @since 2.0.0-alpha-1
547
+ * @see https://eslint.org/docs/rules/yield-star-spacing
548
+ */
549
+ "yield-star-spacing": Linter.RuleEntry<
550
+ [
551
+ | Partial<{
552
+ before: boolean;
553
+ after: boolean;
554
+ }>
555
+ | "before"
556
+ | "after"
557
+ | "both"
558
+ | "neither",
559
+ ]
560
+ >;
561
+ }
@@ -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 { }