@viclafouch/eslint-config-viclafouch 4.22.1-beta.4 → 4.22.1-beta.5

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.
@@ -1,25 +1,41 @@
1
+ import { defineConfig } from 'eslint/config'
2
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn'
3
+ import pluginPromise from 'eslint-plugin-promise'
4
+ import globals from 'globals'
1
5
  import tseslint from 'typescript-eslint'
2
- import bestPracticesConfig from './best-practices.mjs'
3
- import es6Config from './es6.mjs'
4
- import variablesConfig from './variables.mjs'
5
-
6
- const { rules: baseBestPracticesRules } = bestPracticesConfig
7
- const { rules: baseVariablesRules } = variablesConfig
8
- const { rules: baseES6Rules } = es6Config
9
6
 
10
7
  /**
11
8
  * @type {import("eslint").Linter.Config}
12
9
  */
13
- export default tseslint.config(
10
+ export default defineConfig(
14
11
  tseslint.configs.recommended,
15
12
  {
16
- name: 'typescript',
13
+ name: 'typescript/setup',
14
+ files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
15
+ linterOptions: {
16
+ reportUnusedDisableDirectives: 'error'
17
+ },
17
18
  languageOptions: {
19
+ globals: {
20
+ ...globals.builtin,
21
+ ...globals.browser,
22
+ ...globals.node,
23
+ ...globals.vitest
24
+ },
18
25
  parserOptions: {
19
26
  projectService: {
20
- allowDefaultProject: ['*.js', '*.mjs', '*.cjs']
27
+ allowDefaultProject: ['*.js', '*.cjs']
28
+ },
29
+ ecmaFeatures: {
30
+ jsx: true
21
31
  }
22
- }
32
+ },
33
+ ecmaVersion: 'latest',
34
+ sourceType: 'module'
35
+ },
36
+ plugins: {
37
+ unicorn: eslintPluginUnicorn,
38
+ promise: pluginPromise
23
39
  },
24
40
  settings: {
25
41
  // Apply special parsing for TypeScript files
@@ -27,83 +43,926 @@ export default tseslint.config(
27
43
  '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
28
44
  },
29
45
  // Append 'ts' extensions to @viclafouch/eslint 'import/resolver' setting
30
- // Original: ['.mjs', '.js', '.json']
31
46
  'import/resolver': {
32
47
  node: {
33
48
  extensions: ['.mjs', '.js', '.json', '.ts', '.d.ts']
34
49
  }
35
50
  },
36
51
  // Append 'ts' extensions to @viclafouch/eslint 'import/extensions' setting
37
- // Original: ['.js', '.mjs', '.jsx']
38
52
  'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
39
53
  // Resolve type definition packages
40
54
  'import/external-module-folders': ['node_modules', 'node_modules/@types']
41
- },
55
+ }
56
+ },
57
+ {
58
+ name: 'typescript/rules',
59
+ files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
42
60
  rules: {
43
- // Replace @viclafouch/eslint 'default-param-last' rule with '@typescript-eslint' version
44
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
61
+ // ==========================================
62
+ // Best Practices
63
+ // ==========================================
64
+
65
+ // Enforces getter/setter pairs in objects
66
+ // https://eslint.org/docs/rules/accessor-pairs
67
+ 'accessor-pairs': 'off',
68
+
69
+ // Force curly everytime
70
+ // https://eslint.org/docs/rules/curly
71
+ curly: ['error', 'all'],
72
+
73
+ // Enforces return statements in callbacks of array's methods
74
+ // https://eslint.org/docs/rules/array-callback-return
75
+ 'array-callback-return': [
76
+ 'error',
77
+ { allowImplicit: true, checkForEach: true }
78
+ ],
79
+
80
+ // Enforce for loop update clause moving the counter in the right direction
81
+ // https://eslint.org/docs/latest/rules/for-direction
82
+ 'for-direction': 'error',
83
+
84
+ // Enforce return statements in getters
85
+ // https://eslint.org/docs/latest/rules/getter-return
86
+ 'getter-return': 'error',
87
+
88
+ // Disallow returning values from setters
89
+ // https://eslint.org/docs/latest/rules/no-setter-return
90
+ 'no-setter-return': 'error',
91
+
92
+ // Treat var statements as if they were block scoped
93
+ // https://eslint.org/docs/rules/block-scoped-var
94
+ 'block-scoped-var': 'error',
95
+
96
+ // Specify the maximum cyclomatic complexity allowed in a program
97
+ // https://eslint.org/docs/rules/complexity
98
+ complexity: ['error', 20],
99
+
100
+ // Enforce that class methods use "this"
101
+ // https://eslint.org/docs/rules/class-methods-use-this
102
+ 'class-methods-use-this': [
103
+ 'error',
104
+ {
105
+ exceptMethods: []
106
+ }
107
+ ],
108
+
109
+ // Require return statements to either always or never specify values
110
+ // https://eslint.org/docs/rules/consistent-return
111
+ 'consistent-return': ['error', { treatUndefinedAsUnspecified: true }],
112
+
113
+ // Disallow comparing against -0
114
+ // https://eslint.org/docs/latest/rules/no-compare-neg-zero
115
+ 'no-compare-neg-zero': 'error',
116
+
117
+ // Disallow sparse arrays
118
+ // https://eslint.org/docs/latest/rules/no-sparse-arrays
119
+ 'no-sparse-arrays': 'error',
120
+
121
+ // Disallow expressions where the operation doesn't affect the value
122
+ // https://eslint.org/docs/latest/rules/no-constant-binary-expression
123
+ 'no-constant-binary-expression': 'error',
124
+
125
+ // Require default case in switch statements
126
+ // https://eslint.org/docs/rules/default-case
127
+ 'default-case': ['error'],
128
+
129
+ // Enforce default clauses in switch statements to be last
130
+ // https://eslint.org/docs/rules/default-case-last
131
+ 'default-case-last': 'error',
132
+
133
+ // Require the use of === and !==
134
+ // https://eslint.org/docs/latest/rules/eqeqeq
135
+ eqeqeq: ['error', 'always'],
136
+
137
+ // Enforces consistent newlines before or after dots
138
+ // https://eslint.org/docs/rules/dot-location
139
+ 'dot-location': ['error', 'property'],
140
+
141
+ // Make sure for-in loops have an if statement
142
+ // https://eslint.org/docs/rules/guard-for-in
143
+ 'guard-for-in': 'error',
144
+
145
+ // Disallow the use of alert, confirm, and prompt
146
+ // https://eslint.org/docs/rules/no-alert
147
+ 'no-alert': 'error',
148
+
149
+ // Disallow lexical declarations in case/default clauses
150
+ // https://eslint.org/docs/rules/no-case-declarations
151
+ 'no-case-declarations': 'error',
152
+
153
+ // Disallow returning value in constructor
154
+ // https://eslint.org/docs/rules/no-constructor-return
155
+ 'no-constructor-return': 'error',
156
+
157
+ // Disallow else after a return in an if
158
+ // https://eslint.org/docs/rules/no-else-return
159
+ 'no-else-return': ['error', { allowElseIf: false }],
160
+
161
+ // Disallow empty destructuring patterns
162
+ // https://eslint.org/docs/rules/no-empty-pattern
163
+ 'no-empty-pattern': 'error',
164
+
165
+ // Disallow comparisons to null without a type-checking operator
166
+ // https://eslint.org/docs/rules/no-eq-null
167
+ 'no-eq-null': 'off',
168
+
169
+ // Disallow adding to native types
170
+ // https://eslint.org/docs/rules/no-extend-native
171
+ 'no-extend-native': 'error',
172
+
173
+ // Disallow Unnecessary Labels
174
+ // https://eslint.org/docs/rules/no-extra-label
175
+ 'no-extra-label': 'error',
176
+
177
+ // Disallow fallthrough of case statements
178
+ // https://eslint.org/docs/rules/no-fallthrough
179
+ 'no-fallthrough': 'error',
180
+
181
+ // Disallow the use of leading or trailing decimal points in numeric literals
182
+ // https://eslint.org/docs/rules/no-floating-decimal
183
+ 'no-floating-decimal': 'error',
184
+
185
+ // Disallow reassignments of native objects or read-only globals
186
+ // https://eslint.org/docs/rules/no-global-assign
187
+ 'no-global-assign': ['error', { exceptions: [] }],
188
+
189
+ // Deprecated in favor of no-global-assign
190
+ // https://eslint.org/docs/rules/no-native-reassign
191
+ 'no-native-reassign': 'off',
192
+
193
+ // Disallow implicit type conversions
194
+ // https://eslint.org/docs/rules/no-implicit-coercion
195
+ 'no-implicit-coercion': 'error',
196
+
197
+ // Disallow reassigning function declarations
198
+ // https://eslint.org/docs/latest/rules/no-func-assign
199
+ 'no-func-assign': 'error',
200
+
201
+ // Disallow assigning to imported bindings
202
+ // https://eslint.org/docs/latest/rules/no-import-assign
203
+ 'no-import-assign': 'error',
204
+
205
+ // Disallow var and named functions in global scope
206
+ // https://eslint.org/docs/rules/no-implicit-globals
207
+ 'no-implicit-globals': 'off',
208
+
209
+ // Disallow this keywords outside of classes or class-like objects
210
+ // https://eslint.org/docs/rules/no-invalid-this
211
+ 'no-invalid-this': 'off',
212
+
213
+ // Disallow variable or function declarations in nested blocks
214
+ // https://eslint.org/docs/latest/rules/no-inner-declarations
215
+ 'no-inner-declarations': ['error', 'both'],
216
+
217
+ // Disallow usage of __iterator__ property
218
+ // https://eslint.org/docs/rules/no-iterator
219
+ 'no-iterator': 'error',
220
+
221
+ // Disallow use of labels for anything other than loops and switches
222
+ // https://eslint.org/docs/rules/no-labels
223
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
224
+
225
+ // Disallow unnecessary nested blocks
226
+ // https://eslint.org/docs/rules/no-lone-blocks
227
+ 'no-lone-blocks': 'error',
228
+
229
+ // Disallow use of multiple spaces
230
+ // https://eslint.org/docs/rules/no-multi-spaces
231
+ 'no-multi-spaces': [
232
+ 'error',
233
+ {
234
+ ignoreEOLComments: false
235
+ }
236
+ ],
237
+
238
+ // Disallow use of multiline strings
239
+ // https://eslint.org/docs/rules/no-multi-str
240
+ 'no-multi-str': 'error',
241
+
242
+ // Disallow use of new operator when not part of the assignment or comparison
243
+ // https://eslint.org/docs/rules/no-new
244
+ 'no-new': 'error',
245
+
246
+ // Disallows creating new instances of String, Number, and Boolean
247
+ // https://eslint.org/docs/rules/no-new-wrappers
248
+ 'no-new-wrappers': 'error',
249
+
250
+ // Disallow use of (old style) octal literals
251
+ // https://eslint.org/docs/rules/no-octal
252
+ 'no-octal': 'error',
253
+
254
+ // Disallow use of octal escape sequences in string literals
255
+ // https://eslint.org/docs/rules/no-octal-escape
256
+ 'no-octal-escape': 'error',
257
+
258
+ // Disallow reassignment of function parameters
259
+ // https://eslint.org/docs/rules/no-param-reassign
260
+ 'no-param-reassign': [
261
+ 'error',
262
+ {
263
+ ignorePropertyModificationsForRegex: [
264
+ 'draft',
265
+ 'context2D',
266
+ 'canvasElement'
267
+ ]
268
+ }
269
+ ],
270
+
271
+ // Disallow certain object properties
272
+ // https://eslint.org/docs/rules/no-restricted-properties
273
+ 'no-restricted-properties': [
274
+ 'error',
275
+ {
276
+ object: 'arguments',
277
+ property: 'callee',
278
+ message: 'arguments.callee is deprecated'
279
+ },
280
+ {
281
+ object: 'global',
282
+ property: 'isFinite',
283
+ message: 'Please use Number.isFinite instead'
284
+ },
285
+ {
286
+ object: 'self',
287
+ property: 'isFinite',
288
+ message: 'Please use Number.isFinite instead'
289
+ },
290
+ {
291
+ object: 'window',
292
+ property: 'isFinite',
293
+ message: 'Please use Number.isFinite instead'
294
+ },
295
+ {
296
+ object: 'global',
297
+ property: 'isNaN',
298
+ message: 'Please use Number.isNaN instead'
299
+ },
300
+ {
301
+ object: 'self',
302
+ property: 'isNaN',
303
+ message: 'Please use Number.isNaN instead'
304
+ },
305
+ {
306
+ object: 'window',
307
+ property: 'isNaN',
308
+ message: 'Please use Number.isNaN instead'
309
+ },
310
+ {
311
+ object: 'Math',
312
+ property: 'pow',
313
+ message: 'Use the exponentiation operator (**) instead.'
314
+ }
315
+ ],
316
+
317
+ // Disallow use of assignment in return statement
318
+ // https://eslint.org/docs/rules/no-return-assign
319
+ 'no-return-assign': ['error', 'always'],
320
+
321
+ // Disallow ternary operators when simpler alternatives exist
322
+ // https://eslint.org/docs/rules/no-unneeded-ternary
323
+ 'no-unneeded-ternary': 'error',
324
+
325
+ // Disallow assignments where both sides are exactly the same
326
+ // https://eslint.org/docs/rules/no-self-assign
327
+ 'no-self-assign': [
328
+ 'error',
329
+ {
330
+ props: true
331
+ }
332
+ ],
333
+
334
+ // Disallow comparisons where both sides are exactly the same
335
+ // https://eslint.org/docs/rules/no-self-compare
336
+ 'no-self-compare': 'error',
337
+
338
+ // Restrict what can be thrown as an exception
339
+ // https://eslint.org/docs/rules/no-throw-literal
340
+ 'no-throw-literal': 'error',
341
+
342
+ // Disallow unmodified conditions of loops
343
+ // https://eslint.org/docs/rules/no-unmodified-loop-condition
344
+ 'no-unmodified-loop-condition': 'error',
345
+
346
+ // Disallow negating the left operand of relational operators
347
+ // https://eslint.org/docs/latest/rules/no-unsafe-negation
348
+ 'no-unsafe-negation': 'error',
349
+
350
+ // Enforce comparing typeof expressions against valid strings
351
+ // https://eslint.org/docs/latest/rules/valid-typeof
352
+ 'valid-typeof': 'error',
353
+
354
+ // Require calls to isNaN() when checking for NaN
355
+ // https://eslint.org/docs/latest/rules/use-isnan
356
+ 'use-isnan': 'error',
357
+
358
+ // Disallow unreachable code after return, throw, continue, and break statements
359
+ // https://eslint.org/docs/latest/rules/no-unreachable
360
+ 'no-unreachable': 'error',
361
+
362
+ // Disallow unused labels
363
+ // https://eslint.org/docs/rules/no-unused-labels
364
+ 'no-unused-labels': 'error',
365
+
366
+ // Disallow unnecessary .call() and .apply()
367
+ // https://eslint.org/docs/rules/no-useless-call
368
+ 'no-useless-call': 'off',
369
+
370
+ // Disallow unnecessary catch clauses
371
+ // https://eslint.org/docs/rules/no-useless-catch
372
+ 'no-useless-catch': 'error',
373
+
374
+ // Disallow useless string concatenation
375
+ // https://eslint.org/docs/rules/no-useless-concat
376
+ 'no-useless-concat': 'error',
377
+
378
+ // Disallow unnecessary string escaping
379
+ // https://eslint.org/docs/rules/no-useless-escape
380
+ 'no-useless-escape': 'error',
381
+
382
+ // Disallow redundant return; keywords
383
+ // https://eslint.org/docs/rules/no-useless-return
384
+ 'no-useless-return': 'error',
385
+
386
+ // Require using Error objects as Promise rejection reasons
387
+ // https://eslint.org/docs/rules/prefer-promise-reject-errors
388
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
389
+
390
+ // Suggest using named capture group in regular expression
391
+ // https://eslint.org/docs/rules/prefer-named-capture-group
392
+ 'prefer-named-capture-group': 'off',
393
+
394
+ // Require using regex literals instead of RegExp constructor
395
+ // https://eslint.org/docs/rules/prefer-regex-literals
396
+ 'prefer-regex-literals': [
397
+ 'error',
398
+ {
399
+ disallowRedundantWrapping: true
400
+ }
401
+ ],
402
+
403
+ // Require use of the second argument for parseInt()
404
+ // https://eslint.org/docs/rules/radix
405
+ radix: 'error',
406
+
407
+ // Enforce the use of u flag on RegExp
408
+ // https://eslint.org/docs/rules/require-unicode-regexp
409
+ 'require-unicode-regexp': 'off',
410
+
411
+ // ==========================================
412
+ // Variables
413
+ // ==========================================
414
+
415
+ // Enforce or disallow variable initializations at definition
416
+ // https://eslint.org/docs/rules/init-declarations
417
+ 'init-declarations': 'off',
418
+
419
+ // Disallow the catch clause parameter name being the same as a variable in the outer scope
420
+ // https://eslint.org/docs/rules/no-catch-shadow
421
+ 'no-catch-shadow': 'off',
422
+
423
+ // Disallow deletion of variables
424
+ // https://eslint.org/docs/latest/rules/no-delete-var
425
+ 'no-delete-var': 'error',
426
+
427
+ // Disallow labels that share a name with a variable
428
+ // https://eslint.org/docs/rules/no-label-var
429
+ 'no-label-var': 'error',
430
+
431
+ // For code readability, prevent creating unclear naming
432
+ // https://eslint.org/docs/rules/id-length
433
+ 'id-length': [
434
+ 'error',
435
+ { min: 2, max: Infinity, exceptions: ['t', '_'], properties: 'never' }
436
+ ],
437
+
438
+ // Prefer object shorthands for properties
439
+ // https://eslint.org/docs/rules/object-shorthand
440
+ 'object-shorthand': [
441
+ 'error',
442
+ 'always',
443
+ {
444
+ ignoreConstructors: false,
445
+ avoidQuotes: true
446
+ }
447
+ ],
448
+
449
+ // Disallow shadowing of names such as arguments
450
+ // https://eslint.org/docs/rules/no-shadow-restricted-names
451
+ 'no-shadow-restricted-names': 'error',
452
+
453
+ // Disallow use of undeclared variables unless mentioned in a /*global */ block
454
+ // https://eslint.org/docs/rules/no-undef
455
+ 'no-undef': ['error', { typeof: true }],
456
+
457
+ // Disallow use of undefined when initializing variables
458
+ // https://eslint.org/docs/rules/no-undef-init
459
+ 'no-undef-init': 'error',
460
+
461
+ // Most common naming that is not always understandable
462
+ // https://eslint.org/docs/rules/id-denylist
463
+ 'id-denylist': [
464
+ 'error',
465
+ 'err',
466
+ 'cb',
467
+ 'arr',
468
+ 'acc',
469
+ 'idx',
470
+ 'ctx',
471
+ 'res',
472
+ 'val',
473
+ 'obj',
474
+ 'el',
475
+ 'elem',
476
+ 'req',
477
+ 'str'
478
+ ],
479
+
480
+ // ==========================================
481
+ // ES6+
482
+ // ==========================================
483
+
484
+ // Require braces around arrow function bodies
485
+ // https://eslint.org/docs/rules/arrow-body-style
486
+ 'arrow-body-style': ['error', 'always'],
487
+
488
+ // Require parens in arrow function arguments
489
+ // https://eslint.org/docs/rules/arrow-parens
490
+ 'arrow-parens': ['error', 'always'],
491
+
492
+ // Require space before/after arrow function's arrow
493
+ // https://eslint.org/docs/rules/arrow-spacing
494
+ 'arrow-spacing': ['error', { before: true, after: true }],
495
+
496
+ // Verify super() callings in constructors
497
+ // https://eslint.org/docs/rules/constructor-super
498
+ 'constructor-super': 'error',
499
+
500
+ // Disallow modifying variables of class declarations
501
+ // https://eslint.org/docs/rules/no-class-assign
502
+ 'no-class-assign': 'error',
503
+
504
+ // Disallow duplicate class members
505
+ // https://eslint.org/docs/latest/rules/no-dupe-class-members
506
+ 'no-dupe-class-members': 'error',
507
+
508
+ // Disallow arrow functions where they could be confused with comparisons
509
+ // https://eslint.org/docs/rules/no-confusing-arrow
510
+ 'no-confusing-arrow': [
511
+ 'error',
512
+ {
513
+ allowParens: true
514
+ }
515
+ ],
516
+
517
+ // Disallow modifying variables that are declared using const
518
+ // https://eslint.org/docs/latest/rules/no-const-assign
519
+ 'no-const-assign': 'error',
520
+
521
+ // Disallow importing from the same path more than once
522
+ // https://eslint.org/docs/rules/no-duplicate-imports
523
+ 'no-duplicate-imports': 'off',
524
+
525
+ // Disallow new operators with global non-constructor functions
526
+ // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
527
+ 'no-new-native-nonconstructor': 'error',
528
+
529
+ // Disallow returning values from Promise executor functions
530
+ // https://eslint.org/docs/latest/rules/no-promise-executor-return
531
+ 'no-promise-executor-return': 'error',
532
+
533
+ // Disallow invalid regular expression strings in RegExp constructors
534
+ // https://eslint.org/docs/latest/rules/no-invalid-regexp
535
+ 'no-invalid-regexp': 'error',
536
+
537
+ // Disallow specified names in exports
538
+ // https://eslint.org/docs/rules/no-restricted-exports
539
+ 'no-restricted-exports': [
540
+ 'error',
541
+ {
542
+ restrictedNamedExports: ['default', 'then']
543
+ }
544
+ ],
545
+
546
+ // Disallow this/super before calling super() in constructors
547
+ // https://eslint.org/docs/rules/no-this-before-super
548
+ 'no-this-before-super': 'error',
549
+
550
+ // Disallow use of optional chaining in contexts where the undefined value is not allowed
551
+ // https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
552
+ 'no-unsafe-optional-chaining': 'error',
553
+
554
+ // Disallow control flow statements in finally blocks
555
+ // https://eslint.org/docs/latest/rules/no-unsafe-finally
556
+ 'no-unsafe-finally': 'error',
557
+
558
+ // Disallow useless computed property keys
559
+ // https://eslint.org/docs/rules/no-useless-computed-key
560
+ 'no-useless-computed-key': 'error',
561
+
562
+ // Disallow renaming import, export, and destructured assignments to the same name
563
+ // https://eslint.org/docs/rules/no-useless-rename
564
+ 'no-useless-rename': [
565
+ 'error',
566
+ {
567
+ ignoreDestructuring: false,
568
+ ignoreImport: false,
569
+ ignoreExport: false
570
+ }
571
+ ],
572
+
573
+ // Require let or const instead of var
574
+ // https://eslint.org/docs/rules/no-var
575
+ 'no-var': 'error',
576
+
577
+ // Suggest using arrow functions as callbacks
578
+ // https://eslint.org/docs/rules/prefer-arrow-callback
579
+ 'prefer-arrow-callback': [
580
+ 'error',
581
+ {
582
+ allowNamedFunctions: false,
583
+ allowUnboundThis: true
584
+ }
585
+ ],
586
+
587
+ // Suggest using of const declaration for variables that are never modified after declared
588
+ // https://eslint.org/docs/rules/prefer-const
589
+ 'prefer-const': [
590
+ 'error',
591
+ {
592
+ destructuring: 'any',
593
+ ignoreReadBeforeAssign: true
594
+ }
595
+ ],
596
+
597
+ // Prefer destructuring from arrays and objects
598
+ // https://eslint.org/docs/rules/prefer-destructuring
599
+ 'prefer-destructuring': [
600
+ 'error',
601
+ {
602
+ VariableDeclarator: {
603
+ array: false,
604
+ object: true
605
+ },
606
+ AssignmentExpression: {
607
+ array: true,
608
+ object: false
609
+ }
610
+ },
611
+ {
612
+ enforceForRenamedProperties: false
613
+ }
614
+ ],
615
+
616
+ // Disallow parseInt() in favor of binary, octal, and hexadecimal literals
617
+ // https://eslint.org/docs/rules/prefer-numeric-literals
618
+ 'prefer-numeric-literals': 'error',
619
+
620
+ // Suggest using Reflect methods where applicable
621
+ // https://eslint.org/docs/rules/prefer-reflect
622
+ 'prefer-reflect': 'off',
623
+
624
+ // Use rest parameters instead of arguments
625
+ // https://eslint.org/docs/rules/prefer-rest-params
626
+ 'prefer-rest-params': 'error',
627
+
628
+ // Suggest using the spread syntax instead of .apply()
629
+ // https://eslint.org/docs/rules/prefer-spread
630
+ 'prefer-spread': 'error',
631
+
632
+ // Suggest using template literals instead of string concatenation
633
+ // https://eslint.org/docs/rules/prefer-template
634
+ 'prefer-template': 'error',
635
+
636
+ // Enforce spacing between object rest-spread
637
+ // https://eslint.org/docs/rules/rest-spread-spacing
638
+ 'rest-spread-spacing': ['error', 'never'],
639
+
640
+ // Enforce usage of spacing in template strings
641
+ // https://eslint.org/docs/rules/template-curly-spacing
642
+ 'template-curly-spacing': 'error',
643
+
644
+ // Disallow using an async function as a Promise executor
645
+ // https://eslint.org/docs/latest/rules/no-async-promise-executor
646
+ 'no-async-promise-executor': 'error',
647
+
648
+ // Disallow template literal placeholder syntax in regular strings
649
+ // https://eslint.org/docs/latest/rules/no-template-curly-in-string
650
+ 'no-template-curly-in-string': 'error',
651
+
652
+ // ==========================================
653
+ // Errors
654
+ // ==========================================
655
+
656
+ // Disallow await inside of loops
657
+ // https://eslint.org/docs/rules/no-await-in-loop
658
+ 'no-await-in-loop': 'error',
659
+
660
+ // Disallow assignment in conditional expressions
661
+ // https://eslint.org/docs/latest/rules/no-cond-assign
662
+ 'no-cond-assign': ['error', 'always'],
663
+
664
+ // Disallow use of console
665
+ // https://eslint.org/docs/rules/no-console
666
+ // EXCEPTION: This rule uses 'warn' instead of 'error' to allow console statements during development
667
+ 'no-console': 'warn',
668
+
669
+ // Disallow use of constant expressions in conditions
670
+ // https://eslint.org/docs/latest/rules/no-constant-condition
671
+ 'no-constant-condition': 'error',
672
+
673
+ // Disallow use of debugger
674
+ // https://eslint.org/docs/latest/rules/no-debugger
675
+ 'no-debugger': 'error',
676
+
677
+ // Disallow duplicate conditions in if-else-if chains
678
+ // https://eslint.org/docs/rules/no-dupe-else-if
679
+ 'no-dupe-else-if': 'error',
680
+
681
+ // Disallow duplicate case labels
682
+ // https://eslint.org/docs/latest/rules/no-duplicate-case
683
+ 'no-duplicate-case': 'error',
684
+
685
+ // Disallow duplicate keys when creating object literals
686
+ // https://eslint.org/docs/latest/rules/no-dupe-keys
687
+ 'no-dupe-keys': 'error',
688
+
689
+ // Disallow reassigning exceptions in catch clauses
690
+ // https://eslint.org/docs/latest/rules/no-ex-assign
691
+ 'no-ex-assign': 'error',
692
+
693
+ // Disallow unnecessary semicolons
694
+ // https://eslint.org/docs/rules/no-extra-semi
695
+ 'no-extra-semi': 'error',
696
+
697
+ // ==========================================
698
+ // Node
699
+ // ==========================================
700
+
701
+ // Require all requires be top-level
702
+ // https://eslint.org/docs/rules/global-require
703
+ 'global-require': 'error',
704
+
705
+ // ==========================================
706
+ // Style
707
+ // ==========================================
708
+
709
+ // Enforce camelcase naming convention
710
+ // https://eslint.org/docs/latest/rules/camelcase
711
+ camelcase: 'error',
712
+
713
+ // "red" === color is a "Yoda" condition, prefer color === "red" instead
714
+ // https://eslint.org/docs/latest/rules/yoda
715
+ yoda: 'error',
716
+
717
+ // Disallow the unary operators ++ and --
718
+ // https://eslint.org/docs/latest/rules/no-plusplus
719
+ 'no-plusplus': 'error',
720
+
721
+ // Disallow inline comments after code
722
+ // https://eslint.org/docs/latest/rules/no-inline-comments
723
+ 'no-inline-comments': 'error',
724
+
725
+ // Require or disallow an empty line between class members
726
+ // https://eslint.org/docs/latest/rules/lines-between-class-members
727
+ 'lines-between-class-members': ['error', 'always'],
728
+
729
+ // Require or disallow padding lines between statements
730
+ // https://eslint.org/docs/rules/padding-line-between-statements
731
+ 'padding-line-between-statements': [
732
+ 'error',
733
+ {
734
+ blankLine: 'always',
735
+ prev: '*',
736
+ next: ['return', 'multiline-block-like']
737
+ },
738
+ { blankLine: 'always', prev: 'multiline-block-like', next: '*' }
739
+ ],
740
+
741
+ // ==========================================
742
+ // Unicorn
743
+ // ==========================================
744
+
745
+ // Disallow creating a variable and immediately mutating it
746
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-immediate-mutation.md
747
+ 'unicorn/no-immediate-mutation': 'error',
748
+
749
+ // Disallow useless arguments when constructing Set, Map, WeakSet, WeakMap
750
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-collection-argument.md
751
+ 'unicorn/no-useless-collection-argument': 'error',
752
+
753
+ // Prefer class fields over constructor assignments
754
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md
755
+ 'unicorn/prefer-class-fields': 'error',
756
+
757
+ // Prefer Array#toReversed() over Array#reverse() to avoid mutation
758
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md
759
+ 'unicorn/no-array-reverse': 'error',
760
+
761
+ // Require using new when throwing an error
762
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/throw-new-error.md
763
+ 'unicorn/throw-new-error': 'error',
764
+
765
+ // Prefer includes() over indexOf() when checking for existence
766
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-includes.md
767
+ 'unicorn/prefer-includes': 'error',
768
+
769
+ // Prefer find() over filter()[0] when searching for a single element
770
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-find.md
771
+ 'unicorn/prefer-array-find': 'error',
772
+
773
+ // Prefer startsWith() and endsWith() over regex or slice comparisons
774
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-starts-ends-with.md
775
+ 'unicorn/prefer-string-starts-ends-with': 'error',
776
+
777
+ // Prefer .at() for accessing elements by negative index
778
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-at.md
779
+ 'unicorn/prefer-at': 'error',
780
+
781
+ // Prefer Number static properties over global ones
782
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-number-properties.md
783
+ 'unicorn/prefer-number-properties': 'error',
784
+
785
+ // Prefer for...of over Array#forEach
786
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-for-each.md
787
+ 'unicorn/no-array-for-each': 'error',
788
+
789
+ // Prefer Array#flat() over legacy techniques to flatten arrays
790
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat.md
791
+ 'unicorn/prefer-array-flat': 'error',
792
+
793
+ // Prefer flatMap() over map().flat()
794
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-flat-map.md
795
+ 'unicorn/prefer-array-flat-map': 'error',
796
+
797
+ // Disallow useless undefined
798
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md
799
+ 'unicorn/no-useless-undefined': 'error',
800
+
801
+ // Prefer String#replaceAll() over regex with global flag
802
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
803
+ 'unicorn/prefer-string-replace-all': 'error',
804
+
805
+ // Prefer String#trimStart() / String#trimEnd() over trimLeft() / trimRight()
806
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-trim-start-end.md
807
+ 'unicorn/prefer-string-trim-start-end': 'error',
808
+
809
+ // Disallow if statements as the only statement in else blocks
810
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-lonely-if.md
811
+ 'unicorn/no-lonely-if': 'error',
812
+
813
+ // Prefer RegExp#test() over String#match() for boolean checks
814
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-regexp-test.md
815
+ 'unicorn/prefer-regexp-test': 'error',
816
+
817
+ // Prefer modern DOM APIs
818
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-dom-apis.md
819
+ 'unicorn/prefer-modern-dom-apis': 'error',
820
+
821
+ // Prefer [...iterable] over Array.from(iterable)
822
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md
823
+ 'unicorn/prefer-spread': 'off',
824
+
825
+ // Prefer omitting catch binding when unused
826
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-optional-catch-binding.md
827
+ 'unicorn/prefer-optional-catch-binding': 'off',
828
+
829
+ // Disallow negated conditions when alternative exists
830
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md
831
+ 'unicorn/no-negated-condition': 'off',
832
+
833
+ // Prefer TypeError for type-related errors
834
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-type-error.md
835
+ 'unicorn/prefer-type-error': 'off',
836
+
837
+ // Prefer Date.now() over new Date().getTime()
838
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-date-now.md
839
+ 'unicorn/prefer-date-now': 'error',
840
+
841
+ // Prefer === undefined over typeof === 'undefined'
842
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-typeof-undefined.md
843
+ 'unicorn/no-typeof-undefined': 'error',
844
+
845
+ // Prefer Object.fromEntries() over reduce to create objects
846
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-object-from-entries.md
847
+ 'unicorn/prefer-object-from-entries': 'error',
848
+
849
+ // Prefer Set#has() over Array#includes() for frequent checks
850
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-set-has.md
851
+ 'unicorn/prefer-set-has': 'off',
852
+
853
+ // Prefer some() over find() !== undefined for boolean checks
854
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-some.md
855
+ 'unicorn/prefer-array-some': 'error',
856
+
857
+ // Disallow new Array() and prefer Array.from({length: n})
858
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-new-array.md
859
+ 'unicorn/no-new-array': 'error',
860
+
861
+ // Prefer default parameters over reassignment
862
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-default-parameters.md
863
+ 'unicorn/prefer-default-parameters': 'error',
864
+
865
+ // Prefer negative index over length minus index
866
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
867
+ 'unicorn/prefer-negative-index': 'error',
868
+
869
+ // Enforce usage of the `node:` prefix for builtin imports
870
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
871
+ 'unicorn/prefer-node-protocol': 'error',
872
+
873
+ // ==========================================
874
+ // Promise
875
+ // ==========================================
876
+
877
+ // Prefer to use async/await for Promises
878
+ // https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md
879
+ 'promise/prefer-await-to-then': 'off',
880
+
881
+ // ==========================================
882
+ // TypeScript (with ESLint rule replacements)
883
+ // ==========================================
884
+
885
+ // Enforce default parameters to be last
886
+ // https://typescript-eslint.io/rules/default-param-last
45
887
  'default-param-last': 'off',
46
- '@typescript-eslint/default-param-last':
47
- baseBestPracticesRules['default-param-last'],
888
+ '@typescript-eslint/default-param-last': 'error',
48
889
 
49
- // Replace @viclafouch/eslint 'dot-notation' rule with '@typescript-eslint' version
50
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
890
+ // Enforce dot notation whenever possible
891
+ // https://typescript-eslint.io/rules/dot-notation
51
892
  'dot-notation': 'off',
52
- '@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],
893
+ '@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
53
894
 
54
- // Replace @viclafouch/eslint 'no-empty-function' rule with '@typescript-eslint' version
55
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
895
+ // Disallow empty functions
896
+ // https://typescript-eslint.io/rules/no-empty-function
56
897
  'no-empty-function': 'off',
57
- '@typescript-eslint/no-empty-function':
58
- baseBestPracticesRules['no-empty-function'],
898
+ '@typescript-eslint/no-empty-function': [
899
+ 'error',
900
+ {
901
+ allow: ['arrowFunctions', 'functions', 'methods']
902
+ }
903
+ ],
59
904
 
60
- // Replace @viclafouch/eslint 'no-redeclare' rule with '@typescript-eslint' version
61
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
905
+ // Disallow variable redeclaration
906
+ // https://typescript-eslint.io/rules/no-redeclare
62
907
  'no-redeclare': 'off',
63
- '@typescript-eslint/no-redeclare': baseBestPracticesRules['no-redeclare'],
908
+ '@typescript-eslint/no-redeclare': 'error',
64
909
 
65
- // Replace @viclafouch/eslint 'no-shadow' rule with '@typescript-eslint' version
66
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
910
+ // Disallow variable declarations from shadowing variables declared in the outer scope
911
+ // https://typescript-eslint.io/rules/no-shadow
67
912
  'no-shadow': 'off',
68
- '@typescript-eslint/no-shadow': baseVariablesRules['no-shadow'],
913
+ '@typescript-eslint/no-shadow': 'error',
69
914
 
70
- // Replace @viclafouch/eslint 'no-unused-expressions' rule with '@typescript-eslint' version
71
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
915
+ // Disallow unused expressions
916
+ // https://typescript-eslint.io/rules/no-unused-expressions
72
917
  'no-unused-expressions': 'off',
73
- '@typescript-eslint/no-unused-expressions':
74
- baseBestPracticesRules['no-unused-expressions'],
918
+ '@typescript-eslint/no-unused-expressions': [
919
+ 'error',
920
+ {
921
+ allowShortCircuit: false,
922
+ allowTernary: false,
923
+ allowTaggedTemplates: false
924
+ }
925
+ ],
75
926
 
76
- // Replace @viclafouch/eslint 'no-unused-vars' rule with '@typescript-eslint' version
77
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
927
+ // Disallow unused variables
928
+ // https://typescript-eslint.io/rules/no-unused-vars
78
929
  'no-unused-vars': 'off',
79
- '@typescript-eslint/no-unused-vars': baseVariablesRules['no-unused-vars'],
930
+ '@typescript-eslint/no-unused-vars': [
931
+ 'error',
932
+ {
933
+ vars: 'all',
934
+ args: 'after-used',
935
+ caughtErrors: 'none',
936
+ argsIgnorePattern: '^_',
937
+ ignoreRestSiblings: true
938
+ }
939
+ ],
80
940
 
81
- // Replace @viclafouch/eslint 'no-use-before-define' rule with '@typescript-eslint' version
82
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
941
+ // Disallow the use of variables before they are defined
942
+ // https://typescript-eslint.io/rules/no-use-before-define
83
943
  'no-use-before-define': 'off',
84
- '@typescript-eslint/no-use-before-define':
85
- baseVariablesRules['no-use-before-define'],
944
+ '@typescript-eslint/no-use-before-define': 'off',
86
945
 
87
- // Replace @viclafouch/eslint 'no-useless-constructor' rule with '@typescript-eslint' version
88
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
946
+ // Disallow unnecessary constructors
947
+ // https://typescript-eslint.io/rules/no-useless-constructor
89
948
  'no-useless-constructor': 'off',
90
- '@typescript-eslint/no-useless-constructor':
91
- baseES6Rules['no-useless-constructor'],
949
+ '@typescript-eslint/no-useless-constructor': 'error',
92
950
 
93
- '@typescript-eslint/require-await': baseES6Rules['require-await'],
951
+ // Disallow async functions which have no await expression
952
+ // https://typescript-eslint.io/rules/require-await
953
+ '@typescript-eslint/require-await': 'off',
94
954
 
95
- // Replace @viclafouch/eslint 'no-return-await' rule with '@typescript-eslint' version
96
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
955
+ // Enforce consistent returning of awaited values
956
+ // https://typescript-eslint.io/rules/return-await
97
957
  'no-return-await': 'off',
98
- '@typescript-eslint/return-await': [
99
- baseES6Rules['no-return-await'],
100
- 'in-try-catch'
101
- ],
958
+ '@typescript-eslint/return-await': ['error', 'in-try-catch'],
102
959
 
103
960
  // Accept banning ts lines
961
+ // https://typescript-eslint.io/rules/ban-ts-comment
104
962
  '@typescript-eslint/ban-ts-comment': 'off',
105
963
 
106
- // Naming convention
964
+ // Naming convention for type parameters
965
+ // https://typescript-eslint.io/rules/naming-convention
107
966
  '@typescript-eslint/naming-convention': [
108
967
  'error',
109
968
  {
@@ -123,10 +982,10 @@ export default tseslint.config(
123
982
  '@typescript-eslint/array-type': 'error',
124
983
 
125
984
  // Forbid delete array, use splice for example
126
- // https://typescript-eslint.io/rules/no-array-delete/
985
+ // https://typescript-eslint.io/rules/no-array-delete
127
986
  '@typescript-eslint/no-array-delete': 'error',
128
987
 
129
- // Don't do array.filter(callback)[0], use arrat.find instead
988
+ // Don't do array.filter(callback)[0], use array.find instead
130
989
  // https://typescript-eslint.io/rules/prefer-find
131
990
  '@typescript-eslint/prefer-find': 'error',
132
991
 
@@ -134,24 +993,20 @@ export default tseslint.config(
134
993
  // https://typescript-eslint.io/rules/prefer-string-starts-ends-with
135
994
  '@typescript-eslint/prefer-string-starts-ends-with': 'error',
136
995
 
137
- // Prefer to use unknown instead of any for error in catch callback
138
- // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
139
- // '@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
140
-
141
996
  // No more "as Record<any, any>" in Array.reduce initial value, use generics
142
997
  // https://typescript-eslint.io/rules/prefer-reduce-type-parameter
143
998
  '@typescript-eslint/prefer-reduce-type-parameter': 'error',
144
999
 
145
- // Disallow duplicate constituents of union or intersection types.
1000
+ // Disallow duplicate constituents of union or intersection types
146
1001
  // https://typescript-eslint.io/rules/no-duplicate-type-constituents
147
1002
  '@typescript-eslint/no-duplicate-type-constituents': 'error',
148
1003
 
149
- // Disallow using code marked as @deprecated.
1004
+ // Disallow using code marked as @deprecated
150
1005
  // https://typescript-eslint.io/rules/no-deprecated
151
1006
  '@typescript-eslint/no-deprecated': 'error',
152
1007
 
153
- // Disallow using the spread operator when it might cause unexpected behavior.
154
- // https://typescript-eslint.io/rules/no-misused-spread/
1008
+ // Disallow using the spread operator when it might cause unexpected behavior
1009
+ // https://typescript-eslint.io/rules/no-misused-spread
155
1010
  '@typescript-eslint/no-misused-spread': 'error',
156
1011
 
157
1012
  // Enforce import type { T }
@@ -183,68 +1038,40 @@ export default tseslint.config(
183
1038
  // Disallow passing a value-returning function where void is expected
184
1039
  // https://typescript-eslint.io/rules/strict-void-return
185
1040
  '@typescript-eslint/strict-void-return': 'off'
186
-
187
- // Prefer using nullish coalescing (??) over logical (||) when possible.
188
- // '@typescript-eslint/prefer-nullish-coalescing': 'error'
189
-
190
- // '@typescript-eslint/ban-types': [
191
- // 'error',
192
- // {
193
- // Types: {
194
- // // Omit is not strict enought
195
- // Omit: {
196
- // // https://twitter.com/erikras/status/1673694889974833152
197
- // Message:
198
- // 'Use StrictOmit instead by using reset.d.ts from @viclafouch/eslint-config-viclafouch/reset.d. See https://github.com/viclafouch/eslint-config-viclafouch#better-typing',
199
- // FixWith: 'StrictOmit'
200
- // }
201
- // }
202
- // }
203
- // ]
204
1041
  }
205
1042
  },
206
1043
  {
1044
+ name: 'typescript/disable-type-checked-for-js',
207
1045
  files: ['./**/*.js', './**/*.cjs'],
208
1046
  ...tseslint.configs.disableTypeChecked
209
1047
  },
210
1048
  {
211
- files: ['*.ts?(x)'],
1049
+ name: 'typescript/ts-specific-overrides',
1050
+ files: ['**/*.ts?(x)'],
212
1051
  rules: {
213
- // The following rules are enabled in @viclafouch/eslint config, but are already checked (more thoroughly) by the TypeScript compiler
214
- // Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
215
- // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
1052
+ // The following rules are enabled but already checked (more thoroughly) by the TypeScript compiler
1053
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
216
1054
  'constructor-super': 'off',
217
1055
  'no-const-assign': 'off',
218
- // https://eslint.org/docs/latest/rules/no-dupe-args#handled_by_typescript
219
1056
  'no-dupe-args': 'off',
220
- // https://eslint.org/docs/latest/rules/no-dupe-class-members#handled_by_typescript
221
1057
  'no-dupe-class-members': 'off',
222
- // https://eslint.org/docs/latest/rules/no-dupe-keys#handled_by_typescript
223
1058
  'no-dupe-keys': 'off',
224
- // https://eslint.org/docs/latest/rules/no-func-assign#handled_by_typescript
225
1059
  'no-func-assign': 'off',
226
- // https://eslint.org/docs/latest/rules/no-import-assign#handled_by_typescript
227
1060
  'no-import-assign': 'off',
228
- // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor#handled_by_typescript
229
1061
  'no-new-native-nonconstructor': 'off',
230
1062
  'no-new-symbol': 'off',
231
1063
  'no-obj-calls': 'off',
232
1064
  'no-redeclare': 'off',
233
- // https://eslint.org/docs/latest/rules/no-setter-return#handled_by_typescript
234
1065
  'no-setter-return': 'off',
235
- // https://eslint.org/docs/latest/rules/no-this-before-super#handled_by_typescript
236
1066
  'no-this-before-super': 'off',
237
- // https://eslint.org/docs/latest/rules/no-undef#handled_by_typescript
238
1067
  'no-undef': 'off',
239
- // https://eslint.org/docs/latest/rules/no-unreachable#handled_by_typescript
240
1068
  'no-unreachable': 'off',
241
- // https://eslint.org/docs/latest/rules/no-unsafe-negation#handled_by_typescript
242
1069
  'no-unsafe-negation': 'off',
243
- // The following rules are enabled in @viclafouch/eslint config, but are recommended to be disabled within TypeScript projects
244
- // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
1070
+
1071
+ // Disable import rules that don't work well with TypeScript
1072
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
245
1073
  'import/named': 'off',
246
1074
  'import/no-named-as-default-member': 'off',
247
- // Disable `import/no-unresolved`, see README.md for details
248
1075
  'import/no-unresolved': 'off'
249
1076
  }
250
1077
  }