@prowise/eslint-config-linting-rules 0.0.1

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,928 @@
1
+ const { rules: baseRules } = require("./base-rules");
2
+ const { rules: baseImportsRules } = require("./plugin-import-rules");
3
+
4
+ module.exports = {
5
+ /*
6
+ * ✅ recommended
7
+ * 🔒 strict
8
+ * 🔧 fixable
9
+ * 💡 has suggestion
10
+ * 💭 requires type information
11
+ */
12
+
13
+ plugins: ["@typescript-eslint"],
14
+ parser: "@typescript-eslint/parser",
15
+
16
+ settings: {
17
+ // Apply special parsing for TypeScript files
18
+ "import/parsers": {
19
+ "@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
20
+ },
21
+
22
+ // Append "ts" extensions to Airbnb "import/resolver" setting
23
+ "import/resolver": {
24
+ node: { extensions: [".mjs", ".js", ".json", ".ts", ".d.ts"] },
25
+ },
26
+
27
+ // Append "ts" extensions to Airbnb "import/extensions" setting
28
+ "import/extensions": [".js", ".mjs", ".jsx", ".ts", ".tsx", ".d.ts"],
29
+
30
+ // Resolve type definition packages
31
+ "import/external-module-folders": ["node_modules", "node_modules/@types"],
32
+ },
33
+
34
+ rules: {
35
+ /**
36
+ * Require that member overloads be consecutive ✅
37
+ * https://typescript-eslint.io/rules/adjacent-overload-signatures.
38
+ */
39
+ "@typescript-eslint/adjacent-overload-signatures": "error",
40
+
41
+ /**
42
+ * Require using either T[] or Array<T> for arrays 🔒 🔧
43
+ * https://typescript-eslint.io/rules/array-type.
44
+ */
45
+ "@typescript-eslint/array-type": ["error", { default: "array" }],
46
+
47
+ /**
48
+ * Disallow awaiting a value that is not a Thenable ✅ 💭
49
+ * https://typescript-eslint.io/rules/await-thenable.
50
+ */
51
+ "@typescript-eslint/await-thenable": "error",
52
+
53
+ /**
54
+ * Disallow @ts-<directive> comments or require descriptions after directive ✅
55
+ * https://typescript-eslint.io/rules/ban-ts-comment.
56
+ */
57
+ "@typescript-eslint/ban-ts-comment": [
58
+ "warn",
59
+ {
60
+ "ts-expect-error": "allow-with-description",
61
+ "ts-ignore": "allow-with-description",
62
+ "ts-nocheck": "allow-with-description",
63
+ "ts-check": "allow-with-description",
64
+ minimumDescriptionLength: 3,
65
+ },
66
+ ],
67
+
68
+ /**
69
+ * Disallow // tslint:<rule-flag> comments 🔒 🔧
70
+ * https://typescript-eslint.io/rules/ban-tslint-comment.
71
+ */
72
+ "@typescript-eslint/ban-tslint-comment": "warn",
73
+
74
+ /**
75
+ * Disallow certain types ✅ 🔧
76
+ * https://typescript-eslint.io/rules/ban-types.
77
+ */
78
+ "@typescript-eslint/ban-types": [
79
+ "error",
80
+ {
81
+ types: {
82
+ Object: {
83
+ message: "Avoid using the `Object` type. Did you mean `object`?",
84
+ },
85
+ Function: {
86
+ message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
87
+ },
88
+ Boolean: {
89
+ message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
90
+ },
91
+ Number: {
92
+ message: "Avoid using the `Number` type. Did you mean `number`?",
93
+ },
94
+ String: {
95
+ message: "Avoid using the `String` type. Did you mean `string`?",
96
+ },
97
+ Symbol: {
98
+ message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
99
+ },
100
+ },
101
+ },
102
+ ],
103
+
104
+ /**
105
+ * Enforce that literals on classes are exposed in a consistent style 🔒 🔧
106
+ * https://typescript-eslint.io/rules/class-litiral-property-style.
107
+ */
108
+ "@typescript-eslint/class-literal-property-style": "warn",
109
+
110
+ /**
111
+ * Require or disallow trailing commas.🔧
112
+ * https://typescript-eslint.io/rules/comma-dangle.
113
+ */
114
+ "comma-dangle": "off",
115
+ "@typescript-eslint/comma-dangle": [
116
+ baseRules["comma-dangle"][0],
117
+ {
118
+ ...baseRules["comma-dangle"][1],
119
+ enums: baseRules["comma-dangle"][1].arrays,
120
+ generics: baseRules["comma-dangle"][1].arrays,
121
+ tuples: baseRules["comma-dangle"][1].arrays,
122
+ },
123
+ ],
124
+
125
+ /**
126
+ * Enforce specifying generic type arguments on type annotation or constructor name of a constructor call 🔒 🔧
127
+ * https://typescript-eslint.io/rules/consistent-generic-constructors.
128
+ */
129
+ "@typescript-eslint/consistent-generic-constructors": "warn",
130
+
131
+ /**
132
+ * Require or disallow the Record type 🔒 🔧
133
+ * https://typescript-eslint.io/rules/consistent-indexed-oject-style.
134
+ */
135
+ "@typescript-eslint/consistent-indexed-object-style": "warn",
136
+
137
+ /**
138
+ * Enforce consistent usage of type assertions 🔒
139
+ * https://typescript-eslint.io/rules/consistent-type-assertions.
140
+ */
141
+ "@typescript-eslint/consistent-type-assertions": "error",
142
+
143
+ /**
144
+ * Enforce type definitions to consistently use either interface or type 🔒 🔧
145
+ * https://typescript-eslint.io/rules/consistent-type-definitions.
146
+ */
147
+ "@typescript-eslint/consistent-type-definitions": "warn",
148
+
149
+ /**
150
+ * Enforce consistent usage of type exports 🔧 💭
151
+ * https://typescript-eslint.io/rules/consistend-type-exports.
152
+ */
153
+ "@typescript-eslint/consistent-type-exports": "warn",
154
+
155
+ /**
156
+ * Enforce consistent usage of type imports 🔧
157
+ * https://typescript-eslint.io/rules/consistent-type-imports.
158
+ */
159
+ "@typescript-eslint/consistent-type-imports": ["warn", { prefer: "no-type-imports" }],
160
+
161
+ /**
162
+ * Enforce default parameters to be last.
163
+ * Https://typescript-eslint.io/rules/default-param-last.
164
+ */
165
+ "default-param-last": "off",
166
+ "@typescript-eslint/default-param-last": baseRules["default-param-last"],
167
+
168
+ /**
169
+ * Enforce dot notation whenever possible.
170
+ * Https://typescript-eslint.io/rules/dot-notation.
171
+ */
172
+ "dot-notation": "off",
173
+ "@typescript-eslint/dot-notation": baseRules["dot-notation"],
174
+
175
+ /**
176
+ * Require explicit return types on functions and class methods
177
+ * https://typescript-eslint.io/rules/explicit-function-return.
178
+ */
179
+ "@typescript-eslint/explicit-function-return-type": "warn",
180
+
181
+ /**
182
+ * Require explicit accessibility modifiers on class properties and methods 🔧 💡
183
+ * https://typescript-eslint.io/rules/explicit-member-accessibility.
184
+ */
185
+ "@typescript-eslint/explicit-member-accessibility": "error",
186
+
187
+ /**
188
+ * Require explicit return and argument types on exported functions" and classes" public class methods
189
+ * https://typescript-eslint.io/rules/explicit-module-boundary-types.
190
+ */
191
+ "@typescript-eslint/explicit-module-boundary-types": "warn",
192
+
193
+ /**
194
+ * Require or disallow initialization in variable declarations
195
+ * https://typescript-eslint.io/rules/init-declarations.
196
+ */
197
+ "init-declarations": "off",
198
+ "@typescript-eslint/init-declarations": baseRules["init-declarations"],
199
+
200
+ /**
201
+ * Require a specific member delimiter style for interfaces and type literals 🔧
202
+ * https://typescript-eslint.io/rules/member-delimiter-style.
203
+ */
204
+ "@typescript-eslint/member-delimiter-style": "warn",
205
+
206
+ /**
207
+ * Require a consistent member declaration order
208
+ * https://typescript-eslint.io/rules/member-ordering.
209
+ */
210
+ "@typescript-eslint/member-ordering": "off",
211
+
212
+ /**
213
+ * Enforce using a particular method signature syntax 🔧
214
+ * https://typescript-eslint.io/rules/method-signature-style.
215
+ */
216
+ "@typescript-eslint/method-signature-style": "warn",
217
+
218
+ /**
219
+ * Enforce naming conventions for everything across a codebase 💭
220
+ * https://typescript-eslint.io/rules/naming-convention.
221
+ */
222
+ camelcase: "off", // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
223
+ "@typescript-eslint/naming-convention": [
224
+ "error",
225
+ // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
226
+ {
227
+ selector: "variable",
228
+ format: ["camelCase", "PascalCase", "UPPER_CASE"],
229
+ },
230
+ // Allow camelCase functions (23.2), and PascalCase functions (23.8)
231
+ {
232
+ selector: "function",
233
+ format: ["camelCase", "PascalCase"],
234
+ },
235
+ // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript
236
+ // recommendations we are assuming this rule would similarly apply to anything "type like",
237
+ // including interfaces, type aliases, and enums
238
+ {
239
+ selector: "typeLike",
240
+ format: ["PascalCase"],
241
+ },
242
+ ],
243
+
244
+ /**
245
+ * Disallow generic Array constructors.✅
246
+ * https://typescript-eslint.io/rules/no-array-constructor.
247
+ */
248
+ "no-array-constructor": "off",
249
+ "@typescript-eslint/no-array-constructor": baseRules["no-array-constructor"],
250
+
251
+ /**
252
+ * Require .toString() to only be called on objects which provide useful information when stringified 🔒 💭
253
+ * https://typescript-eslint.io/rules/no-base-to-string.
254
+ */
255
+ "@typescript-eslint/no-base-to-string": "warn",
256
+
257
+ /**
258
+ * Disallow non-null assertion in locations that may be confusing 🔒 🔧 💡
259
+ * https://typescript-eslint.io/rules/no-confusing-non-null-assertion.
260
+ */
261
+ "@typescript-eslint/no-confusing-non-null-assertion": "warn",
262
+
263
+ /**
264
+ * Require expressions of type void to appear in statement position 🔧 💡 💭
265
+ * https://typescript-eslint.io/rules/no-confusing-void-expression.
266
+ */
267
+ "@typescript-eslint/no-confusing-void-expression": "warn",
268
+
269
+ /**
270
+ * Disallow duplicate class members.
271
+ * Https://typescript-eslint.io/rules/no-dupe-class-members.
272
+ */
273
+ "no-dupe-class-members": "off",
274
+ "@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
275
+
276
+ /**
277
+ * Disallow duplicate enum member values 🔒
278
+ * https://typescript-eslint.io/rules/no-duplicate-enum-values.
279
+ */
280
+ "@typescript-eslint/no-duplicate-enum-values": "warn",
281
+
282
+ /**
283
+ * Disallow using the delete operator on computed key expressions 🔒 🔧
284
+ * https://typescript-eslint.io/rules/no-dynamic-delete.
285
+ */
286
+ "@typescript-eslint/no-dynamic-delete": "warn",
287
+
288
+ /**
289
+ * Disallow the declaration of empty functions ✅
290
+ * https://typescript-eslint.io/rules/no-empty-function.
291
+ */
292
+ "no-empty-function": "off",
293
+ "@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
294
+
295
+ /**
296
+ * Disallow the declaration of empty interfaces ✅ 🔧 💡
297
+ * https://typescript-eslint.io/rules/no-empty-interface.
298
+ */
299
+ "@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: false }],
300
+
301
+ /**
302
+ * Disallow the any type ✅ 🔧 💡
303
+ * https://typescript-eslint.io/rules/no-explicit-any.
304
+ */
305
+ "@typescript-eslint/no-explicit-any": "off",
306
+
307
+ /**
308
+ * Disallow extra non-null assertion ✅ 🔧
309
+ * https://typescript-eslint.io/rules/no-extra-non-null-assertion.
310
+ */
311
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
312
+
313
+ /**
314
+ * Disallow unnecessary parentheses.🔧
315
+ * https://typescript-eslint.io/rules/no-extra-parens.
316
+ */
317
+ "no-extra-parens": "off",
318
+ "@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
319
+
320
+ /**
321
+ * Disallow unnecessary semicolons.✅ 🔧
322
+ * https://typescript-eslint.io/rules/no-extra-semi.
323
+ */
324
+ "no-extra-semi": "off",
325
+ "@typescript-eslint/no-extra-semi": baseRules["no-extra-semi"],
326
+
327
+ /**
328
+ * Disallow classes used as namespaces 🔒
329
+ * https://typescript-eslint.io/rules/no-extraneous-class.
330
+ */
331
+ "@typescript-eslint/no-extraneous-class": "warn",
332
+
333
+ /**
334
+ * Require Promise-like statements to be handled appropriately ✅ 💡 💭
335
+ * https://typescript-eslint.io/rules/no-floating-promises.
336
+ */
337
+ "@typescript-eslint/no-floating-promises": "error",
338
+
339
+ /**
340
+ * Disallow iterating over an array with a for-in loop ✅ 💭
341
+ * https://typescript-eslint.io/rules/no-for-in-array.
342
+ */
343
+ "@typescript-eslint/no-for-in-array": "error",
344
+
345
+ /**
346
+ * Disallow the use of eval()-like methods. ✅ 💭
347
+ * https://typescript-eslint.io/rules/no-implied-eval.
348
+ */
349
+ "no-implied-eval": "off",
350
+ "no-new-function": "off",
351
+ "@typescript-eslint/no-implied-eval": baseRules["no-implied-eval"],
352
+
353
+ /**
354
+ * Disallow explicit type declarations for variables or parameters initialized to a number,
355
+ * string, or boolean ✅ 🔧
356
+ * https://typescript-eslint.io/rules/no-inferrable-types.
357
+ */
358
+ "@typescript-eslint/no-inferrable-types": ["error", { ignoreParameters: false, ignoreProperties: false }],
359
+
360
+ /**
361
+ * Disallow this keywords outside of classes or class-like objects.
362
+ * Https://typescript-eslint.io/rules/no-invalid-this.
363
+ */
364
+ "no-invalid-this": "off",
365
+ "@typescript-eslint/no-invalid-this": baseRules["no-invalid-this"],
366
+
367
+ /**
368
+ * Disallow void type outside of generic or return types 🔒
369
+ * https://typescript-eslint.io/rules/no-invalid-void-type.
370
+ */
371
+ "@typescript-eslint/no-invalid-void-type": "off",
372
+
373
+ /**
374
+ * Disallow function declarations that contain unsafe references inside loop statements.
375
+ * Https://typescript-eslint.io/rules/no-loop-func.
376
+ */
377
+ "no-loop-func": "off",
378
+ "@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
379
+
380
+ /**
381
+ * Disallow literal numbers that lose precision. ✅
382
+ * https://typescript-eslint.io/rules/no-loss-of-precision.
383
+ */
384
+ "no-loss-of-precision": "off",
385
+ "@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
386
+
387
+ /**
388
+ * Disallow magic numbers.
389
+ * Https://typescript-eslint.io/rules/no-magic-numbers.
390
+ */
391
+ "no-magic-numbers": "off",
392
+ "@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
393
+
394
+ /**
395
+ * Disallow the void operator except when used to discard a value 🔒 🔧 💡 💭
396
+ * https://typescript-eslint.io/rules/no-meaningless-void-operator.
397
+ */
398
+ "@typescript-eslint/no-meaningless-void-operator": "warn",
399
+
400
+ /**
401
+ * Enforce valid definition of new and constructor ✅
402
+ * https://typescript-eslint.io/rules/no-misused-new.
403
+ */
404
+ "@typescript-eslint/no-misused-new": "error",
405
+
406
+ /**
407
+ * Disallow Promises in places not designed to handle them ✅ 💭
408
+ * https://typescript-eslint.io/rules/no-misused-promises.
409
+ */
410
+ "@typescript-eslint/no-misused-promises": "error",
411
+
412
+ /**
413
+ * Disallow custom TypeScript modules and namespaces ✅
414
+ * https://typescript-eslint.io/rules/no-namespace.
415
+ */
416
+ "@typescript-eslint/no-namespace": "error",
417
+
418
+ /**
419
+ * Disallow non-null assertions in the left operand of a nullish coalescing operator 🔒 💡
420
+ * https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing.
421
+ */
422
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "warn",
423
+
424
+ /**
425
+ * Disallow non-null assertions after an optional chain expression ✅ 💡
426
+ * https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain.
427
+ */
428
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
429
+
430
+ /**
431
+ * Disallow non-null assertions using the ! Postfix operator ✅ 💡
432
+ * https://typescript-eslint.io/rules/no-non-null-assertion.
433
+ */
434
+ "@typescript-eslint/no-non-null-assertion": "warn",
435
+
436
+ /**
437
+ * Disallow variable re-declaration.
438
+ * Https://typescript-eslint.io/rules/no-redeclare.
439
+ */
440
+ "no-redeclare": "off",
441
+ "@typescript-eslint/no-redeclare": baseRules["no-redeclare"],
442
+
443
+ /**
444
+ * Disallow members of unions and intersections that do nothing or override type information 💭
445
+ * https://typescript-eslint.io/rules/no-redundant-type-constituents.
446
+ */
447
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
448
+
449
+ /**
450
+ * Disallow invocation of require()
451
+ * https://typescript-eslint.io/rules/no-require-imports.
452
+ */
453
+ "@typescript-eslint/no-require-imports": "warn",
454
+
455
+ /**
456
+ * Disallow unnecessary return await
457
+ * https://typescript-eslint.io/rules/return-await.
458
+ */
459
+ "no-return-await": "off",
460
+ "@typescript-eslint/return-await": "warn",
461
+
462
+ /**
463
+ * Disallow specified modules when loaded by import.
464
+ * Https://typescript-eslint.io/rules/no-restricted-imports.
465
+ */
466
+ "no-restricted-imports": "off",
467
+ "@typescript-eslint/no-restricted-imports": baseRules["no-restricted-imports"],
468
+
469
+ /**
470
+ * Disallow variable declarations from shadowing variables declared in the outer scope
471
+ * https://typescript-eslint.io/rules/no-shadow.
472
+ */
473
+ "no-shadow": "off",
474
+ "@typescript-eslint/no-shadow": baseRules["no-shadow"],
475
+
476
+ /**
477
+ * Disallow aliasing this ✅
478
+ * https://typescript-eslint.io/rules/no-this-alias.
479
+ */
480
+ "@typescript-eslint/no-this-alias": "error",
481
+
482
+ /**
483
+ * Disallow throwing literals as exceptions
484
+ * https://typescript-eslint.io/rules/no-throw-literal.
485
+ */
486
+ "no-throw-literal": "off",
487
+ "@typescript-eslint/no-throw-literal": "error",
488
+
489
+ /**
490
+ * Disallow type aliases
491
+ * https://typescript-eslint.io/rules/no-type-alias.
492
+ */
493
+ "@typescript-eslint/no-type-alias": "off",
494
+
495
+ /**
496
+ * Disallow unnecessary equality comparisons against boolean literals 🔒 🔧 💭
497
+ * https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare.
498
+ */
499
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
500
+
501
+ /**
502
+ * Disallow conditionals where the type is always truthy or always falsy 🔒 🔧 💭
503
+ * https://typescript-eslint.io/rules/no-unnecessary-condition.
504
+ */
505
+ "@typescript-eslint/no-unnecessary-condition": "warn",
506
+
507
+ /**
508
+ * Disallow unnecessary namespace qualifiers 🔧 💭
509
+ * https://typescript-eslint.io/rules/no-unnecessary-qualifier.
510
+ */
511
+ "@typescript-eslint/no-unnecessary-qualifier": "warn",
512
+
513
+ /**
514
+ * Disallow type arguments that are equal to the default 🔒 🔧 💭
515
+ * https://typescript-eslint.io/rules/no-unnecessary-type-arguments.
516
+ */
517
+ "@typescript-eslint/no-unnecessary-type-arguments": "warn",
518
+
519
+ /**
520
+ * Disallow type assertions that do not change the type of an expression ✅ 🔧 💭
521
+ * https://typescript-eslint.io/rules/no-unnecessary-type-assertion.
522
+ */
523
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
524
+
525
+ /**
526
+ * Disallow unnecessary constraints on generic types ✅ 💡
527
+ * https://typescript-eslint.io/rules/no-unnecessary-type-constraint.
528
+ */
529
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
530
+
531
+ /**
532
+ * Disallow calling a function with a value with type any ✅ 💭
533
+ * https://typescript-eslint.io/rules/no-unsafe-argument.
534
+ */
535
+ "@typescript-eslint/no-unsafe-argument": "error",
536
+
537
+ /**
538
+ * Disallow assigning a value with type any to variables and properties ✅ 💭
539
+ * Off: catched by tsc
540
+ * https://typescript-eslint.io/rules/no-unsafe-assignment.
541
+ */
542
+ "@typescript-eslint/no-unsafe-assignment": "off",
543
+
544
+ /**
545
+ * Disallow calling a value with type any ✅ 💭
546
+ * Off: gives too much false positive
547
+ * https://typescript-eslint.io/rules/no-unsafe-call.
548
+ */
549
+ "@typescript-eslint/no-unsafe-call": "off",
550
+
551
+ /**
552
+ * Disallow member access on a value with type any ✅ 💭
553
+ * https://typescript-eslint.io/rules/no-unsafe-member-access.
554
+ */
555
+ "@typescript-eslint/no-unsafe-member-access": "off",
556
+
557
+ /**
558
+ * Disallow returning a value with type any from a function ✅ 💭
559
+ * https://typescript-eslint.io/rules/no-unsafe-return.
560
+ */
561
+ "@typescript-eslint/no-unsafe-return": "error",
562
+
563
+ /**
564
+ * Disallow unused expressions
565
+ * https://typescript-eslint.io/rules/no-unused-expressions.
566
+ */
567
+ "no-unused-expressions": "off",
568
+ "@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
569
+
570
+ /**
571
+ * Disallow unused variables
572
+ * https://typescript-eslint.io/rules/no-unused-vars.
573
+ */
574
+ "no-unused-vars": "off",
575
+ "@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
576
+
577
+ /**
578
+ * Disallow the use of variables before they are defined
579
+ * https://typescript-eslint.io/rules/no-use-before-define.
580
+ */
581
+ "no-use-before-define": "off",
582
+ "@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
583
+
584
+ /**
585
+ * Disallow unnecessary constructors
586
+ * https://typescript-eslint.io/rules/no-useless-constructor.
587
+ */
588
+ "no-useless-constructor": "off",
589
+ "@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
590
+
591
+ /**
592
+ * Disallow empty exports that don"t change anything in a module file 🔧
593
+ * https://typescript-eslint.io/rules/no-useless-empty-export.
594
+ */
595
+ "@typescript-eslint/no-useless-empty-export": "warn",
596
+
597
+ /**
598
+ * Disallow require statements except in import statements ✅
599
+ * https://typescript-eslint.io/rules/no-var-requires.
600
+ */
601
+ "@typescript-eslint/no-var-requires": "error",
602
+
603
+ /**
604
+ * Enforce non-null assertions over explicit type casts 🔒 🔧 💭
605
+ * https://typescript-eslint.io/rules/non-nullable-type-assertion-style.
606
+ */
607
+ "@typescript-eslint/non-nullable-type-assertion-style": "warn",
608
+
609
+ /**
610
+ * Require or disallow parameter properties in class constructors
611
+ * https://typescript-eslint.io/rules/parameter-properties.
612
+ */
613
+ "@typescript-eslint/parameter-properties": [
614
+ "warn",
615
+ {
616
+ allow: [],
617
+ prefer: "parameter-property",
618
+ },
619
+ ],
620
+
621
+ /**
622
+ * Enforce the use of as const over literal type ✅ 🔧 💡
623
+ * https://typescript-eslint.io/rules/.
624
+ */
625
+ "@typescript-eslint/prefer-as-const": "error",
626
+
627
+ /**
628
+ * Require each enum member value to be explicitly initialized 💡
629
+ * https://typescript-eslint.io/rules/prefer-enum-initializers.
630
+ */
631
+ "@typescript-eslint/prefer-enum-initializers": "warn",
632
+
633
+ /**
634
+ * Enforce the use of for-of loop over the standard for loop where possible 🔒
635
+ * https://typescript-eslint.io/rules/.
636
+ */
637
+ "@typescript-eslint/prefer-for-of": "error",
638
+
639
+ /**
640
+ * Enforce using function types instead of interfaces with call signatures 🔒 🔧
641
+ * https://typescript-eslint.io/rules/prefer-function-type.
642
+ */
643
+ "@typescript-eslint/prefer-function-type": "error",
644
+
645
+ /**
646
+ * Enforce includes method over indexOf method 🔒 🔧 💭
647
+ * https://typescript-eslint.io/rules/prefer-includes.
648
+ */
649
+ "@typescript-eslint/prefer-includes": "warn",
650
+
651
+ /**
652
+ * Require all enum members to be literal values 🔒
653
+ * https://typescript-eslint.io/rules/prefer-literal-enum-member.
654
+ */
655
+ "@typescript-eslint/prefer-literal-enum-member": "warn",
656
+
657
+ /**
658
+ * Require using namespace keyword over module keyword to declare custom TypeScript modules ✅ 🔧
659
+ * https://typescript-eslint.io/rules/prefer-namespace-keyword.
660
+ */
661
+ "@typescript-eslint/prefer-namespace-keyword": "error",
662
+
663
+ /**
664
+ * Enforce using the nullish coalescing operator instead of logical chaining 🔒 💡 💭
665
+ * https://typescript-eslint.io/rules/prefer-nullish-coalescing.
666
+ */
667
+ "@typescript-eslint/prefer-nullish-coalescing": "warn",
668
+
669
+ /**
670
+ * Enforce using concise optional chain expressions instead of chained logical ands 🔒 💡
671
+ * https://typescript-eslint.io/rules/.
672
+ */
673
+ "@typescript-eslint/prefer-optional-chain": "warn",
674
+
675
+ /**
676
+ * Require private members to be marked as readonly if they"re never modified outside of the constructor 🔧 💭
677
+ * https://typescript-eslint.io/rules/prefer-readonly.
678
+ */
679
+ "@typescript-eslint/prefer-readonly": "warn",
680
+
681
+ /**
682
+ * Require function parameters to be typed as readonly to prevent accidental mutation of inputs 💭
683
+ * https://typescript-eslint.io/rules/prefer-readonly-parameter-types.
684
+ */
685
+ "@typescript-eslint/prefer-readonly-parameter-types": "warn",
686
+
687
+ /**
688
+ * Enforce using type parameter when calling Array#reduce instead of casting 🔒 🔧 💭
689
+ * https://typescript-eslint.io/rules/prefer-reduce-type-parameter.
690
+ */
691
+ "@typescript-eslint/prefer-reduce-type-parameter": "warn",
692
+
693
+ /**
694
+ * Enforce RegExp#exec over String#match if no global flag is provided 🔧 💭
695
+ * https://typescript-eslint.io/rules/prefer-regexp-exec.
696
+ */
697
+ "@typescript-eslint/prefer-regexp-exec": "warn",
698
+
699
+ /**
700
+ * Enforce that this is used when only this type is returned 🔒 🔧 💭
701
+ * https://typescript-eslint.io/rules/prefer-return-this-type.
702
+ */
703
+ "@typescript-eslint/prefer-return-this-type": "warn",
704
+
705
+ /**
706
+ * Enforce using String#startsWith and String#ends
707
+ * With over other equivalent methods of checking substrings 🔒 🔧 💭
708
+ * https://typescript-eslint.io/rules/prefer-string-starts-ends-with.
709
+ */
710
+ "@typescript-eslint/prefer-string-starts-ends-with": "warn",
711
+
712
+ /**
713
+ * Enforce using @ts-expect-error over @ts-ignore 🔒 🔧
714
+ * https://typescript-eslint.io/rules/prefer-ts-expect-error.
715
+ */
716
+ "@typescript-eslint/prefer-ts-expect-error": "warn",
717
+
718
+ /**
719
+ * Require any function or method that returns a Promise to be marked async 🔧 💭
720
+ * https://typescript-eslint.io/rules/promise-function-async.
721
+ */
722
+ "@typescript-eslint/promise-function-async": "error",
723
+
724
+ /**
725
+ * Enforce the consistent use of double quotes
726
+ * https://typescript-eslint.io/rules/quotes.
727
+ */
728
+ quotes: "off",
729
+ "@typescript-eslint/quotes": baseRules.quotes,
730
+
731
+ /**
732
+ * Require Array#sort calls to always provide a compareFunction 💭
733
+ * https://typescript-eslint.io/rules/require-array-sort-compare.
734
+ */
735
+ "@typescript-eslint/require-array-sort-compare": ["warn", { ignoreStringArrays: true }],
736
+
737
+ /**
738
+ * Disallow async functions which have no await expression
739
+ * https://typescript-eslint.io/rules/require-await.
740
+ */
741
+ "require-await": "off",
742
+ "@typescript-eslint/require-await": baseRules["require-await"],
743
+
744
+ /**
745
+ * Require both operands of addition to have type number or string ✅ 💭
746
+ * Off: not really needed
747
+ * https://typescript-eslint.io/rules/restrict-plus-operands.
748
+ */
749
+ "@typescript-eslint/restrict-plus-operands": "off",
750
+
751
+ /**
752
+ * Enforce template literal expressions to be of string type ✅ 💭
753
+ * https://typescript-eslint.io/rules/.
754
+ */
755
+ "@typescript-eslint/restrict-template-expressions": "error",
756
+
757
+ /**
758
+ * Require or disallow semicolons instead of ASI.
759
+ * Https://typescript-eslint.io/rules/semi.
760
+ */
761
+ semi: "off",
762
+ "@typescript-eslint/semi": baseRules.semi,
763
+
764
+ /**
765
+ * Enforce members of a type union/intersection to be sorted alphabetically 🔧 💡
766
+ * https://typescript-eslint.io/rules/sort-type-union-intersection-members.
767
+ */
768
+ "@typescript-eslint/sort-type-union-intersection-members": "off",
769
+
770
+ /**
771
+ * Disallow certain types in boolean expressions 🔧 💡 💭
772
+ * https://typescript-eslint.io/rules/strict-boolean-expressions.
773
+ */
774
+ "@typescript-eslint/strict-boolean-expressions": "off",
775
+
776
+ /**
777
+ * Require switch-case statements to be exhaustive with union type 💡 💭
778
+ * https://typescript-eslint.io/rules/switch-exhaustiveness-check.
779
+ */
780
+ "@typescript-eslint/switch-exhaustiveness-check": "warn",
781
+
782
+ /**
783
+ * Disallow certain triple slash directives in favor of ES6-style import declarations ✅
784
+ * https://typescript-eslint.io/rules/triple-slash-reference.
785
+ */
786
+ "@typescript-eslint/triple-slash-reference": [
787
+ "error",
788
+ {
789
+ path: "always",
790
+ types: "prefer-import",
791
+ lib: "always",
792
+ },
793
+ ],
794
+
795
+ /**
796
+ * Require type annotations in certain places
797
+ * https://typescript-eslint.io/rules/typedef.
798
+ */
799
+ "@typescript-eslint/typedef": "warn",
800
+
801
+ /**
802
+ * Enforce unbound methods are called with their expected scope ✅ 💭
803
+ * While this rule should be enabled, it gives to many problems with external libraries
804
+ * https://typescript-eslint.io/rules/unbound-method.
805
+ */
806
+ "@typescript-eslint/unbound-method": "off",
807
+
808
+ /**
809
+ * Disallow two overloads that could be unified into one with a union or an optional/rest parameter
810
+ * https://typescript-eslint.io/rules/unified-signatures.
811
+ */
812
+ "@typescript-eslint/unified-signatures": "error",
813
+
814
+ // ================= Formatting rules =======================
815
+
816
+ /**
817
+ * Enforce consistent brace style for blocks.
818
+ * Https://typescript-eslint.io/rules/brace-style.
819
+ */
820
+ "brace-style": "off",
821
+ "@typescript-eslint/brace-style": baseRules["brace-style"],
822
+
823
+ /**
824
+ * Enforce consistent spacing before and after commas.
825
+ * Https://typescript-eslint.io/rules/comma-spacing.
826
+ */
827
+ "comma-spacing": "off",
828
+ "@typescript-eslint/comma-spacing": baseRules["comma-spacing"],
829
+
830
+ /**
831
+ * Require or disallow spacing between function identifiers and their invocations.
832
+ * Https://typescript-eslint.io/rules/func-call-spacing.
833
+ */
834
+ "func-call-spacing": "off",
835
+ "@typescript-eslint/func-call-spacing": baseRules["func-call-spacing"],
836
+
837
+ /**
838
+ * Enforce consistent indentation.
839
+ * Https://typescript-eslint.io/rules/indent.
840
+ */
841
+ indent: "off",
842
+ "@typescript-eslint/indent": baseRules.indent,
843
+
844
+ /**
845
+ * Enforce consistent spacing before and after keywords.
846
+ * Https://typescript-eslint.io/rules/keyword-spacing.
847
+ */
848
+ "keyword-spacing": "off",
849
+ "@typescript-eslint/keyword-spacing": baseRules["keyword-spacing"],
850
+
851
+ /**
852
+ * Require or disallow an empty line between class members.
853
+ * Https://typescript-eslint.io/rules/lines-between-class-members.
854
+ */
855
+ "lines-between-class-members": "off",
856
+ "@typescript-eslint/lines-between-class-members": baseRules["lines-between-class-members"],
857
+
858
+ /**
859
+ * Enforce consistent spacing inside braces.
860
+ * Https://typescript-eslint.io/rules/object-curly-spacing.
861
+ */
862
+ "object-curly-spacing": "off",
863
+ "@typescript-eslint/object-curly-spacing": baseRules["object-curly-spacing"],
864
+
865
+ /**
866
+ * Require or disallow padding lines between statements.
867
+ * Https://typescript-eslint.io/rules/padding-line-between-statements.
868
+ */
869
+ "padding-line-between-statements": "off",
870
+ "@typescript-eslint/padding-line-between-statements": baseRules["padding-line-between-statements"],
871
+
872
+ /**
873
+ * Enforce consistent spacing before blocks.
874
+ * Https://typescript-eslint.io/rules/space-before-blocks.
875
+ */
876
+ "space-before-blocks": "off",
877
+ "@typescript-eslint/space-before-blocks": baseRules["space-before-blocks"],
878
+
879
+ /**
880
+ * Enforce consistent spacing before function parenthesis.
881
+ * Https://typescript-eslint.io/rules/space-before-function-paren.
882
+ */
883
+ "space-before-function-paren": "off",
884
+ "@typescript-eslint/space-before-function-paren": baseRules["space-before-function-paren"],
885
+
886
+ /**
887
+ * Require spacing around infix operators.
888
+ * Https://typescript-eslint.io/rules/space-infix-ops.
889
+ */
890
+ "space-infix-ops": "off",
891
+ "@typescript-eslint/space-infix-ops": baseRules["space-infix-ops"],
892
+
893
+ /**
894
+ * Require consistent spacing around type annotations
895
+ * https://typescript-eslint.io/rules/type-annotation-spacing.
896
+ */
897
+ "@typescript-eslint/type-annotation-spacing": "warn",
898
+
899
+ // Append "ts" and "tsx" to Airbnb "import/extensions" rule
900
+ "import/extensions": [
901
+ baseImportsRules["import/extensions"][0],
902
+ baseImportsRules["import/extensions"][1],
903
+ {
904
+ ...baseImportsRules["import/extensions"][2],
905
+ ts: "never",
906
+ tsx: "never",
907
+ },
908
+ ],
909
+
910
+ // Append "ts" and "tsx" extensions to Airbnb "import/no-extraneous-dependencies" rule
911
+ "import/no-extraneous-dependencies": [
912
+ baseImportsRules["import/no-extraneous-dependencies"][0],
913
+ {
914
+ ...baseImportsRules["import/no-extraneous-dependencies"][1],
915
+ devDependencies: baseImportsRules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
916
+ (result, devDep) => {
917
+ const toAppend = [devDep];
918
+ const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
919
+ if (devDepWithTs !== devDep) {
920
+ toAppend.push(devDepWithTs);
921
+ }
922
+ return [...result, ...toAppend];
923
+ },
924
+ ),
925
+ },
926
+ ],
927
+ },
928
+ };