@plumile/eslint-config-typescript 0.1.200 → 0.1.205

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.
Files changed (3) hide show
  1. package/README.md +2 -5
  2. package/index.js +223 -363
  3. package/package.json +7 -11
package/README.md CHANGED
@@ -15,8 +15,8 @@ The package provides:
15
15
  - a `createConfig` helper for custom `tsconfig` locations
16
16
  - a Relay-specific preset in `relay.js`
17
17
 
18
- It is intended for projects that want Kronex's TypeScript, React, accessibility
19
- and code-quality defaults without copying rule definitions manually.
18
+ It is intended for projects that want Kronex's TypeScript, React hooks and
19
+ code-quality defaults without copying rule definitions manually.
20
20
 
21
21
  ## Installation
22
22
 
@@ -31,9 +31,7 @@ npm install --save-dev \
31
31
  @stylistic/eslint-plugin \
32
32
  @typescript-eslint/eslint-plugin \
33
33
  eslint-plugin-jsdoc \
34
- eslint-plugin-jsx-a11y \
35
34
  eslint-plugin-n \
36
- eslint-plugin-react \
37
35
  eslint-plugin-react-hooks \
38
36
  eslint-plugin-sonarjs
39
37
  ```
@@ -100,7 +98,6 @@ export default [...plumileTs, ...relayPreset];
100
98
 
101
99
  - TypeScript parsing and project-aware linting
102
100
  - React hooks rules
103
- - accessibility checks
104
101
  - jsdoc and general code-quality rules
105
102
  - stylistic rules aligned with the repository expectations
106
103
 
package/index.js CHANGED
@@ -80,14 +80,11 @@ export function createConfig(options = {}) {
80
80
  },
81
81
  /* Rules applicable to all files (https://eslint.org/docs/rules) */
82
82
  rules: {
83
- /* Enforce best practices rules */
84
- 'accessor-pairs': 'off', // enforces getter/setter pairs in objects
83
+ // enforces return statements in callbacks of array's methods
84
+ 'array-callback-return': ['error', { allowImplicit: true }],
85
85
 
86
- 'array-callback-return': ['error', { allowImplicit: true }], // enforces return statements in callbacks of array's methods
87
-
88
- 'block-scoped-var': 'error', // treat var statements as if they were block scoped
89
-
90
- complexity: ['off', 20], // specify the maximum cyclomatic complexity allowed in a program
86
+ // treat var statements as if they were block scoped
87
+ 'block-scoped-var': 'error',
91
88
 
92
89
  // enforce that class methods use "this"
93
90
  'class-methods-use-this': [
@@ -101,58 +98,64 @@ export function createConfig(options = {}) {
101
98
  'consistent-return': 'error',
102
99
 
103
100
  // specify curly brace conventions for all control statements
104
- curly: ['error', 'multi-line'], // multiline
101
+ // multiline
102
+ curly: ['error', 'multi-line'],
105
103
 
106
104
  // require default case in switch statements
107
105
  'default-case': ['error', { commentPattern: '^no default$' }],
108
106
 
109
- 'default-case-last': 'error', // Enforce default clauses in switch statements to be last
107
+ // Enforce default clauses in switch statements to be last
108
+ 'default-case-last': 'error',
110
109
 
111
110
  'default-param-last': 'error',
112
111
 
113
- 'dot-notation': ['error', { allowKeywords: true }], // encourages use of dot notation whenever possible
112
+ // encourages use of dot notation whenever possible
113
+ 'dot-notation': ['error', { allowKeywords: true }],
114
114
 
115
- 'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots
115
+ // enforces consistent newlines before or after dots
116
+ 'dot-location': ['error', 'property'],
116
117
 
117
- eqeqeq: ['error', 'always', { null: 'ignore' }], // require the use of === and !==
118
+ // require the use of === and !==
119
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
118
120
 
119
121
  // Require grouped accessor pairs in object literals and classes
120
122
  'grouped-accessor-pairs': 'error',
121
123
 
122
- // make sure for-in loops have an if statement
123
- 'guard-for-in': 0,
124
-
125
- 'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file
124
+ // enforce a maximum number of classes per file
125
+ 'max-classes-per-file': ['error', 1],
126
126
 
127
- 'no-alert': 2, // disallow the use of alert, confirm, and prompt
127
+ // disallow the use of alert, confirm, and prompt
128
+ 'no-alert': 2,
128
129
 
129
- 'no-caller': 'error', // disallow use of arguments.caller or arguments.callee
130
+ // disallow use of arguments.caller or arguments.callee
131
+ 'no-caller': 'error',
130
132
 
131
- 'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses
133
+ // disallow lexical declarations in case/default clauses
134
+ 'no-case-declarations': 'error',
132
135
 
133
- 'no-constructor-return': 'error', // Disallow returning value in constructor
134
-
135
- // disallow division operators explicitly at beginning of regular expression
136
- 'no-div-regex': 'off',
136
+ // Disallow returning value in constructor
137
+ 'no-constructor-return': 'error',
137
138
 
138
139
  // disallow else after a return in an if
139
140
  'no-else-return': ['error', { allowElseIf: false }],
140
141
 
141
- 'no-empty-function': 0, // disallow empty functions,- handle by typescript-eslint
142
-
143
- 'no-empty-pattern': 'error', // disallow empty destructuring patterns
144
-
145
- 'no-eq-null': 'off', // disallow comparisons to null without a type-checking operator
142
+ // disallow empty destructuring patterns
143
+ 'no-empty-pattern': 'error',
146
144
 
147
- 'no-eval': 'error', // disallow use of eval()
145
+ // disallow use of eval()
146
+ 'no-eval': 'error',
148
147
 
149
- 'no-extend-native': 'error', // disallow adding to native types
148
+ // disallow adding to native types
149
+ 'no-extend-native': 'error',
150
150
 
151
- 'no-extra-bind': 'error', // disallow unnecessary function binding
151
+ // disallow unnecessary function binding
152
+ 'no-extra-bind': 'error',
152
153
 
153
- 'no-extra-label': 'error', // disallow Unnecessary Labels
154
+ // disallow Unnecessary Labels
155
+ 'no-extra-label': 'error',
154
156
 
155
- 'no-fallthrough': 'error', // disallow fallthrough of case statements
157
+ // disallow fallthrough of case statements
158
+ 'no-fallthrough': 'error',
156
159
 
157
160
  // disallow the use of leading or trailing decimal points in numeric literals
158
161
  'no-floating-decimal': 'error',
@@ -160,32 +163,17 @@ export function createConfig(options = {}) {
160
163
  // disallow reassignments of native objects or read-only globals
161
164
  'no-global-assign': ['error', { exceptions: [] }],
162
165
 
163
- // disallow implicit type conversions
164
- 'no-implicit-coercion': [
165
- 'off',
166
- {
167
- boolean: false,
168
- number: true,
169
- string: true,
170
- allow: [],
171
- },
172
- ],
173
-
174
- 'no-implicit-globals': 'off', // disallow var and named functions in global scope
175
-
176
- 'no-implied-eval': 0, // disallow use of eval()-like methods
177
-
178
- // disallow this keywords outside of classes or class-like objects - checked by TS compiler
179
- 'no-invalid-this': 'off',
180
-
181
- 'no-iterator': 'error', // disallow usage of __iterator__ property
166
+ // disallow usage of __iterator__ property
167
+ 'no-iterator': 'error',
182
168
 
183
169
  // disallow use of labels for anything other than loops and switches
184
170
  'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
185
171
 
186
- 'no-lone-blocks': 'error', // disallow unnecessary nested blocks
172
+ // disallow unnecessary nested blocks
173
+ 'no-lone-blocks': 'error',
187
174
 
188
- 'no-loop-func': 'error', // disallow creation of functions within loops
175
+ // disallow creation of functions within loops
176
+ 'no-loop-func': 'error',
189
177
 
190
178
  // disallow use of multiple spaces
191
179
  'no-multi-spaces': [
@@ -195,11 +183,14 @@ export function createConfig(options = {}) {
195
183
  },
196
184
  ],
197
185
 
198
- 'no-multi-str': 'error', // disallow use of multiline strings
186
+ // disallow use of multiline strings
187
+ 'no-multi-str': 'error',
199
188
 
200
- 'no-new': 'error', // disallow use of new operator when not part of the assignment or comparison
189
+ // disallow use of new operator when not part of the assignment or comparison
190
+ 'no-new': 'error',
201
191
 
202
- 'no-new-func': 'error', // disallow use of new operator for Function object
192
+ // disallow use of new operator for Function object
193
+ 'no-new-func': 'error',
203
194
 
204
195
  // disallows creating new instances of String, Number, and Boolean
205
196
  'no-new-wrappers': 'error',
@@ -207,7 +198,8 @@ export function createConfig(options = {}) {
207
198
  // Disallow \8 and \9 escape sequences in string literals
208
199
  'no-nonoctal-decimal-escape': 'error',
209
200
 
210
- 'no-octal': 'error', // disallow use of (old style) octal literals
201
+ // disallow use of (old style) octal literals
202
+ 'no-octal': 'error',
211
203
 
212
204
  // disallow use of octal escape sequences in string literals, such as
213
205
  // var foo = 'Copyright \251';
@@ -235,9 +227,11 @@ export function createConfig(options = {}) {
235
227
  },
236
228
  ],
237
229
 
238
- 'no-proto': 'error', // disallow usage of __proto__ property
230
+ // disallow usage of __proto__ property
231
+ 'no-proto': 'error',
239
232
 
240
- 'no-redeclare': 'error', // disallow declaring the same variable more than once
233
+ // disallow declaring the same variable more than once
234
+ 'no-redeclare': 'error',
241
235
 
242
236
  // disallow certain object properties
243
237
  'no-restricted-properties': [
@@ -295,9 +289,11 @@ export function createConfig(options = {}) {
295
289
  // disallow use of assignment in return statement
296
290
  'no-return-assign': ['error', 'always'],
297
291
 
298
- 'no-return-await': 'error', // disallow redundant `return await`
292
+ // disallow redundant `return await`
293
+ 'no-return-await': 'error',
299
294
 
300
- 'no-script-url': 'error', // disallow use of `javascript:` urls.
295
+ // disallow use of `javascript:` urls.
296
+ 'no-script-url': 'error',
301
297
 
302
298
  // disallow self assignment
303
299
  'no-self-assign': [
@@ -307,51 +303,36 @@ export function createConfig(options = {}) {
307
303
  },
308
304
  ],
309
305
 
310
- 'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same
311
-
312
- 'no-sequences': 'error', // disallow use of comma operator
313
-
314
- // restrict what can be thrown as an exception - handle by typescript-eslint
315
- 'no-throw-literal': 'off', // handle by only-throw-error in typescript-eslint
316
-
317
- // disallow unmodified conditions of loops
318
- 'no-unmodified-loop-condition': 'off',
319
-
320
- // disallow usage of expressions in statement position - handle by typescript-eslint
321
- 'no-unused-expressions': 0,
322
-
323
- 'no-unused-labels': 'error', // disallow unused labels
306
+ // disallow comparisons where both sides are exactly the same
307
+ 'no-self-compare': 'error',
324
308
 
325
- 'no-useless-call': 'off', // disallow unnecessary .call() and .apply()
309
+ // disallow use of comma operator
310
+ 'no-sequences': 'error',
326
311
 
327
- 'no-useless-catch': 'error', // Disallow unnecessary catch clauses
312
+ // disallow unused labels
313
+ 'no-unused-labels': 'error',
328
314
 
329
- 'no-useless-concat': 'error', // disallow useless string concatenation
315
+ // Disallow unnecessary catch clauses
316
+ 'no-useless-catch': 'error',
330
317
 
331
- 'no-useless-escape': 'error', // disallow unnecessary string escaping
318
+ // disallow useless string concatenation
319
+ 'no-useless-concat': 'error',
332
320
 
333
- 'no-useless-return': 'error', // disallow redundant return; keywords
321
+ // disallow unnecessary string escaping
322
+ 'no-useless-escape': 'error',
334
323
 
335
- 'no-void': 'error', // disallow use of void operator
324
+ // disallow redundant return; keywords
325
+ 'no-useless-return': 'error',
336
326
 
337
- // disallow usage of configurable warning terms in comments: e.g. todo
338
- 'no-warning-comments': [
339
- 'off',
340
- { terms: ['todo', 'fixme', 'xxx'], location: 'start' },
341
- ],
327
+ // disallow use of void operator
328
+ 'no-void': 'error',
342
329
 
343
- 'no-with': 'error', // disallow use of the with statement
330
+ // disallow use of the with statement
331
+ 'no-with': 'error',
344
332
 
345
333
  // require using Error objects as Promise rejection reasons
346
334
  'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
347
335
 
348
- // Suggest using named capture group in regular expression
349
- 'prefer-named-capture-group': 'off',
350
-
351
- // Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
352
- // TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
353
- 'prefer-object-has-own': 'off',
354
-
355
336
  // Disallow use of the RegExp constructor in favor of regular expression literals
356
337
  'prefer-regex-literals': [
357
338
  'error',
@@ -360,54 +341,64 @@ export function createConfig(options = {}) {
360
341
  },
361
342
  ],
362
343
 
363
- radix: 'error', // require use of the second argument for parseInt()
344
+ // require use of the second argument for parseInt()
345
+ radix: 'error',
364
346
 
365
- // require `await` in `async function` (note: this is a horrible rule that should never be used)
366
- 'require-await': 'off',
367
-
368
- // Enforce the use of u flag on RegExp
369
- 'require-unicode-regexp': 'off',
370
-
371
- 'vars-on-top': 'error', // requires to declare all vars on top of their containing scope
347
+ // requires to declare all vars on top of their containing scope
348
+ 'vars-on-top': 'error',
372
349
 
373
350
  // require immediate function invocation to be wrapped in parentheses
374
351
  'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
375
352
 
376
- yoda: 'error', // require or disallow Yoda conditions
353
+ // require or disallow Yoda conditions
354
+ yoda: 'error',
377
355
 
378
356
  /* Enforce Errors rules */
379
357
 
380
- 'for-direction': 'error', // Enforce “for” loop update clause moving the counter in the right direction
381
-
382
- 'getter-return': ['error', { allowImplicit: true }], // Enforces that a return statement is present in property getters
358
+ // Enforce “for” loop update clause moving the counter in the right direction
359
+ 'for-direction': 'error',
383
360
 
384
- 'no-async-promise-executor': 'error', // disallow using an async function as a Promise executor
361
+ // Enforces that a return statement is present in property getters
362
+ 'getter-return': ['error', { allowImplicit: true }],
385
363
 
386
- 'no-await-in-loop': 0, // Disallow await inside of loops
364
+ // disallow using an async function as a Promise executor
365
+ 'no-async-promise-executor': 'error',
387
366
 
388
- 'no-compare-neg-zero': 'error', // Disallow comparisons to negative zero
367
+ // Disallow comparisons to negative zero
368
+ 'no-compare-neg-zero': 'error',
389
369
 
390
- 'no-cond-assign': ['error', 'always'], // disallow assignment in conditional expressions
370
+ // disallow assignment in conditional expressions
371
+ 'no-cond-assign': ['error', 'always'],
391
372
 
392
- 'no-console': 'warn', // disallow use of console
373
+ // disallow use of console
374
+ 'no-console': 'warn',
393
375
 
394
- 'no-constant-binary-expression': 2, // Disallows expressions where the operation doesn't affect the value
376
+ // Disallows expressions where the operation doesn't affect the value
377
+ 'no-constant-binary-expression': 2,
395
378
 
396
- 'no-constant-condition': 'warn', // disallow use of constant expressions in conditions
379
+ // disallow use of constant expressions in conditions
380
+ 'no-constant-condition': 'warn',
397
381
 
398
- 'no-control-regex': 'error', // disallow control characters in regular expressions
382
+ // disallow control characters in regular expressions
383
+ 'no-control-regex': 'error',
399
384
 
400
- 'no-debugger': 'error', // disallow use of debugger
385
+ // disallow use of debugger
386
+ 'no-debugger': 'error',
401
387
 
402
- 'no-dupe-args': 'error', // disallow duplicate arguments in functions
388
+ // disallow duplicate arguments in functions
389
+ 'no-dupe-args': 'error',
403
390
 
404
- 'no-dupe-else-if': 'error', // Disallow duplicate conditions in if-else-if chains
391
+ // Disallow duplicate conditions in if-else-if chains
392
+ 'no-dupe-else-if': 'error',
405
393
 
406
- 'no-dupe-keys': 'error', // disallow duplicate keys when creating object literals
394
+ // disallow duplicate keys when creating object literals
395
+ 'no-dupe-keys': 'error',
407
396
 
408
- 'no-duplicate-case': 'error', // disallow a duplicate case label.
397
+ // disallow a duplicate case label.
398
+ 'no-duplicate-case': 'error',
409
399
 
410
- 'no-empty': 'error', // disallow empty statements
400
+ // disallow empty statements
401
+ 'no-empty': 'error',
411
402
 
412
403
  // disallow the use of empty character classes in regular expressions
413
404
  'no-empty-character-class': 'error',
@@ -418,17 +409,23 @@ export function createConfig(options = {}) {
418
409
  // disallow double-negation boolean casts in a boolean context
419
410
  'no-extra-boolean-cast': 'error',
420
411
 
421
- 'no-func-assign': 'error', // disallow overwriting functions written as function declarations
412
+ // disallow overwriting functions written as function declarations
413
+ 'no-func-assign': 'error',
422
414
 
423
- 'no-import-assign': 'error', // Disallow assigning to imported bindings
415
+ // Disallow assigning to imported bindings
416
+ 'no-import-assign': 'error',
424
417
 
425
- 'no-inner-declarations': 'error', // disallow function or variable declarations in nested blocks
418
+ // disallow function or variable declarations in nested blocks
419
+ 'no-inner-declarations': 'error',
426
420
 
427
- 'no-invalid-regexp': 'error', // disallow invalid regular expression strings in the RegExp constructor
421
+ // disallow invalid regular expression strings in the RegExp constructor
422
+ 'no-invalid-regexp': 'error',
428
423
 
429
- 'no-irregular-whitespace': 'error', // disallow irregular whitespace outside of strings and comments
424
+ // disallow irregular whitespace outside of strings and comments
425
+ 'no-irregular-whitespace': 'error',
430
426
 
431
- 'no-loss-of-precision': 'error', // Disallow Number Literals That Lose Precision
427
+ // Disallow Number Literals That Lose Precision
428
+ 'no-loss-of-precision': 'error',
432
429
 
433
430
  // Disallow characters which are made with multiple code points in character class syntax
434
431
  'no-misleading-character-class': 'error',
@@ -442,11 +439,14 @@ export function createConfig(options = {}) {
442
439
  // disallow use of Object.prototypes builtins directly
443
440
  'no-prototype-builtins': 'error',
444
441
 
445
- 'no-regex-spaces': 'error', // disallow multiple spaces in a regular expression literal
442
+ // disallow multiple spaces in a regular expression literal
443
+ 'no-regex-spaces': 'error',
446
444
 
447
- 'no-setter-return': 'error', // Disallow returning values from setters
445
+ // Disallow returning values from setters
446
+ 'no-setter-return': 'error',
448
447
 
449
- 'no-sparse-arrays': 'error', // disallow sparse arrays
448
+ // disallow sparse arrays
449
+ 'no-sparse-arrays': 'error',
450
450
 
451
451
  // Disallow template literal placeholder syntax in regular strings
452
452
  'no-template-curly-in-string': 'error',
@@ -466,7 +466,8 @@ export function createConfig(options = {}) {
466
466
  },
467
467
  ],
468
468
 
469
- 'no-unsafe-finally': 'error', // disallow return/throw/break/continue inside finally blocks
469
+ // disallow return/throw/break/continue inside finally blocks
470
+ 'no-unsafe-finally': 'error',
470
471
 
471
472
  // disallow negating the left operand of relational operators
472
473
  'no-unsafe-negation': 'error',
@@ -477,15 +478,14 @@ export function createConfig(options = {}) {
477
478
  { disallowArithmeticOperators: true },
478
479
  ],
479
480
 
480
- 'no-unused-private-class-members': 1, // Disallow Unused Private Class Members
481
+ // Disallow Unused Private Class Members
482
+ 'no-unused-private-class-members': 1,
481
483
 
482
- 'no-useless-backreference': 'error', // Disallow useless backreferences in regular expressions
484
+ // Disallow useless backreferences in regular expressions
485
+ 'no-useless-backreference': 'error',
483
486
 
484
- // Disallow assignments that can lead to race conditions due to usage of await or yield
485
- // note: not enabled because it is very buggy
486
- 'require-atomic-updates': 0,
487
-
488
- 'use-isnan': 'error', // disallow comparisons with the value NaN
487
+ // disallow comparisons with the value NaN
488
+ 'use-isnan': 'error',
489
489
 
490
490
  // ensure that the results of typeof are compared against a valid string
491
491
  'valid-typeof': ['error', { requireStringLiterals: true }],
@@ -494,17 +494,20 @@ export function createConfig(options = {}) {
494
494
  // enforces no braces where they can be omitted
495
495
  'arrow-body-style': ['error', 'always'],
496
496
 
497
- 'arrow-parens': ['error', 'always'], // require parens in arrow function arguments
497
+ // require parens in arrow function arguments
498
+ 'arrow-parens': ['error', 'always'],
498
499
 
499
500
  // require space before/after arrow function's arrow
500
501
  'arrow-spacing': ['error', { before: true, after: true }],
501
502
 
502
- 'constructor-super': 'error', // verify super() callings in constructors
503
+ // verify super() callings in constructors
504
+ 'constructor-super': 'error',
503
505
 
504
506
  // enforce the spacing around the * in generator functions
505
507
  'generator-star-spacing': ['error', { before: false, after: true }],
506
508
 
507
- 'no-class-assign': 'error', // disallow modifying variables of class declarations
509
+ // disallow modifying variables of class declarations
510
+ 'no-class-assign': 'error',
508
511
 
509
512
  // disallow arrow functions where they could be confused with comparisons
510
513
  'no-confusing-arrow': [
@@ -514,13 +517,14 @@ export function createConfig(options = {}) {
514
517
  },
515
518
  ],
516
519
 
517
- 'no-const-assign': 'error', // disallow modifying variables that are declared using const
518
-
519
- 'no-dupe-class-members': 0, // disallow duplicate class members - handle by typescript-eslint
520
+ // disallow modifying variables that are declared using const
521
+ 'no-const-assign': 'error',
520
522
 
521
- 'no-duplicate-imports': 2, // disallow importing from the same path more than once
523
+ // disallow importing from the same path more than once
524
+ 'no-duplicate-imports': 2,
522
525
 
523
- 'no-new-symbol': 'error', // disallow symbol constructor
526
+ // disallow symbol constructor
527
+ 'no-new-symbol': 'error',
524
528
 
525
529
  // Disallow specified names in exports
526
530
  'no-restricted-exports': [
@@ -533,20 +537,11 @@ export function createConfig(options = {}) {
533
537
  },
534
538
  ],
535
539
 
536
- // disallow specific imports
537
- 'no-restricted-imports': [
538
- 'off',
539
- {
540
- paths: [],
541
- patterns: [],
542
- },
543
- ],
544
-
545
- 'no-this-before-super': 'error', // disallow to use this/super before super() calling in constructors.
540
+ // disallow to use this/super before super() calling in constructors.
541
+ 'no-this-before-super': 'error',
546
542
 
547
- 'no-useless-computed-key': 'error', // disallow useless computed property keys
548
-
549
- 'no-useless-constructor': 0, // disallow unnecessary constructor - handle by typescript-eslint
543
+ // disallow useless computed property keys
544
+ 'no-useless-computed-key': 'error',
550
545
 
551
546
  // disallow renaming import, export, and destructured assignments to the same name
552
547
  'no-useless-rename': [
@@ -558,7 +553,8 @@ export function createConfig(options = {}) {
558
553
  },
559
554
  ],
560
555
 
561
- 'no-var': 'error', // require let or const instead of var
556
+ // require let or const instead of var
557
+ 'no-var': 'error',
562
558
 
563
559
  // require method and property shorthand syntax for object literals
564
560
  'object-shorthand': [
@@ -606,68 +602,54 @@ export function createConfig(options = {}) {
606
602
  },
607
603
  ],
608
604
 
609
- 'prefer-numeric-literals': 'error', // disallow parseInt() in favor of binary, octal, and hexadecimal literals
610
-
611
- 'prefer-reflect': 'off', // suggest using Reflect methods where applicable
612
-
613
- 'prefer-rest-params': 'error', // use rest parameters instead of arguments
614
-
615
- 'prefer-spread': 'error', // suggest using the spread syntax instead of .apply()
616
-
617
- 'prefer-template': 'error', // suggest using template literals instead of string concatenation
618
-
619
- 'require-yield': 'error', // disallow generator functions that do not have yield
620
-
621
- 'rest-spread-spacing': ['error', 'never'], // enforce spacing between object rest-spread
622
-
623
- // import sorting
624
- 'sort-imports': [
625
- 'off',
626
- {
627
- ignoreCase: false,
628
- ignoreDeclarationSort: false,
629
- ignoreMemberSort: false,
630
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
631
- },
632
- ],
633
-
634
- 'symbol-description': 'error', // require a Symbol description
605
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
606
+ 'prefer-numeric-literals': 'error',
635
607
 
636
- 'template-curly-spacing': 'error', // enforce usage of spacing in template strings
608
+ // use rest parameters instead of arguments
609
+ 'prefer-rest-params': 'error',
637
610
 
638
- 'yield-star-spacing': ['error', 'after'], // enforce spacing around the * in yield* expressions
611
+ // suggest using the spread syntax instead of .apply()
612
+ 'prefer-spread': 'error',
639
613
 
640
- /* Enforce node rules://eslint - https://eslint.org/docs/latest/rules/ */
614
+ // suggest using template literals instead of string concatenation
615
+ 'prefer-template': 'error',
641
616
 
642
- 'callback-return': 'off', // enforce return after a callback
617
+ // disallow generator functions that do not have yield
618
+ 'require-yield': 'error',
643
619
 
644
- 'global-require': 'error', // require all requires be top-level
620
+ // enforce spacing between object rest-spread
621
+ 'rest-spread-spacing': ['error', 'never'],
645
622
 
646
- 'handle-callback-err': 'off', // enforces error handling in callbacks (node environment)
623
+ // require a Symbol description
624
+ 'symbol-description': 'error',
647
625
 
648
- 'no-buffer-constructor': 'error', // disallow use of the Buffer() constructor
626
+ // enforce usage of spacing in template strings
627
+ 'template-curly-spacing': 'error',
649
628
 
650
- 'no-mixed-requires': ['off', false], // disallow mixing regular variable and require declarations
629
+ // enforce spacing around the * in yield* expressions
630
+ 'yield-star-spacing': ['error', 'after'],
651
631
 
652
- 'no-new-require': 'error', // disallow use of new operator with the require function
632
+ // require all requires be top-level
633
+ 'global-require': 'error',
653
634
 
654
- 'no-path-concat': 'error', // disallow string concatenation with __dirname and __filename
635
+ // disallow use of the Buffer() constructor
636
+ 'no-buffer-constructor': 'error',
655
637
 
656
- 'no-process-env': 'off', // disallow use of process.env
638
+ // disallow use of new operator with the require function
639
+ 'no-new-require': 'error',
657
640
 
658
- 'no-process-exit': 'off', // disallow process.exit()
659
-
660
- 'no-restricted-modules': 'off', // restrict usage of specified node modules
661
-
662
- 'no-sync': 'off', // disallow use of synchronous methods (off by default)
641
+ // disallow string concatenation with __dirname and __filename
642
+ 'no-path-concat': 'error',
663
643
 
664
644
  /* Enforce strict rules */
665
645
 
666
- strict: ['error', 'never'], // babel inserts `'use strict';` for us
646
+ // babel inserts `'use strict';` for us
647
+ strict: ['error', 'never'],
667
648
 
668
649
  /* Enforce style rules */
669
650
 
670
- 'no-ternary': ['error'], // disallow the use of ternary operators
651
+ // disallow the use of ternary operators
652
+ 'no-ternary': ['error'],
671
653
 
672
654
  // disallow trailing whitespace at the end of lines
673
655
  'no-trailing-spaces': [
@@ -678,17 +660,6 @@ export function createConfig(options = {}) {
678
660
  },
679
661
  ],
680
662
 
681
- // disallow dangling underscores in identifiers
682
- 'no-underscore-dangle': [
683
- 0,
684
- {
685
- allow: [],
686
- allowAfterThis: false,
687
- allowAfterSuper: false,
688
- enforceInMethodNames: true,
689
- },
690
- ],
691
-
692
663
  // disallow the use of Boolean literals in conditional expressions
693
664
  // also, prefer `a || b` over `a ? a : b`
694
665
  'no-unneeded-ternary': ['error', { defaultAssignment: false }],
@@ -703,34 +674,8 @@ export function createConfig(options = {}) {
703
674
  { overrides: {} },
704
675
  ],
705
676
 
706
- '@stylistic-eslint/object-curly-spacing': ['error', 'always'], // require padding inside curly braces
707
-
708
- // enforce line breaks between braces
709
- 'object-curly-newline': [
710
- 0,
711
- {
712
- ObjectExpression: {
713
- minProperties: 4,
714
- multiline: true,
715
- consistent: true,
716
- },
717
- ObjectPattern: {
718
- minProperties: 4,
719
- multiline: true,
720
- consistent: true,
721
- },
722
- ImportDeclaration: {
723
- minProperties: 4,
724
- multiline: true,
725
- consistent: true,
726
- },
727
- ExportDeclaration: {
728
- minProperties: 4,
729
- multiline: true,
730
- consistent: true,
731
- },
732
- },
733
- ],
677
+ // require padding inside curly braces
678
+ '@stylistic-eslint/object-curly-spacing': ['error', 'always'],
734
679
 
735
680
  // enforce "same line" or "multiple line" on object properties.
736
681
  'object-property-newline': [
@@ -740,15 +685,15 @@ export function createConfig(options = {}) {
740
685
  },
741
686
  ],
742
687
 
743
- 'one-var': ['error', 'never'], // allow just one var statement per function
688
+ // allow just one var statement per function
689
+ 'one-var': ['error', 'never'],
744
690
 
745
- 'one-var-declaration-per-line': ['error', 'always'], // require a newline around variable declaration
691
+ // require a newline around variable declaration
692
+ 'one-var-declaration-per-line': ['error', 'always'],
746
693
 
747
694
  // require assignment operator shorthand where possible or prohibit it entirely
748
695
  'operator-assignment': ['error', 'always'],
749
696
 
750
- '@stylistic-eslint/operator-linebreak': 0,
751
-
752
697
  // disallow padding within blocks
753
698
  '@stylistic-eslint/padded-blocks': [
754
699
  'error',
@@ -762,13 +707,11 @@ export function createConfig(options = {}) {
762
707
  },
763
708
  ],
764
709
 
765
- // Require or disallow padding lines between statements
766
- '@stylistic-eslint/padding-line-between-statements': 'off',
767
-
768
710
  // Disallow the use of Math.pow in favor of the ** operator
769
711
  'prefer-exponentiation-operator': 'error',
770
712
 
771
- 'prefer-object-spread': 'error', // Prefer use of an object spread over Object.assign
713
+ // Prefer use of an object spread over Object.assign
714
+ 'prefer-object-spread': 'error',
772
715
 
773
716
  // require quotes around object literal property names
774
717
  '@stylistic-eslint/quote-props': [
@@ -791,12 +734,8 @@ export function createConfig(options = {}) {
791
734
  { before: false, after: true },
792
735
  ],
793
736
 
794
- '@stylistic-eslint/semi-style': ['error', 'last'], // Enforce location of semicolons
795
-
796
- // requires object keys to be sorted
797
- 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
798
-
799
- 'sort-vars': 'off', // sort variables within the same declaration block
737
+ // Enforce location of semicolons
738
+ '@stylistic-eslint/semi-style': ['error', 'last'],
800
739
 
801
740
  // require or disallow space before blocks
802
741
  '@stylistic-eslint/space-before-blocks': 'error',
@@ -814,7 +753,8 @@ export function createConfig(options = {}) {
814
753
  // require or disallow spaces inside parentheses
815
754
  '@stylistic-eslint/space-in-parens': ['error', 'never'],
816
755
 
817
- '@stylistic-eslint/space-infix-ops': 'error', // require spaces around operators
756
+ // require spaces around operators
757
+ '@stylistic-eslint/space-infix-ops': 'error',
818
758
 
819
759
  // Require or disallow spaces before/after unary operators
820
760
  '@stylistic-eslint/space-unary-ops': [
@@ -852,16 +792,12 @@ export function createConfig(options = {}) {
852
792
  // Require or disallow spacing between template tags and their literals
853
793
  '@stylistic-eslint/template-tag-spacing': ['error', 'never'],
854
794
 
855
- 'unicode-bom': ['error', 'never'], // require or disallow the Unicode Byte Order Mark
795
+ // require or disallow the Unicode Byte Order Mark
796
+ 'unicode-bom': ['error', 'never'],
856
797
 
857
- '@stylistic-eslint/wrap-regex': 'off', // require regex literals to be wrapped in parentheses
858
-
859
- /* Enforce variables rules */
860
- 'init-declarations': 'off',
861
- 'no-array-constructor': 'off', // disallow use of the Array constructor - handle by typescript-eslint
862
- 'no-catch-shadow': 'off',
863
798
  'no-delete-var': 'error',
864
799
  'no-label-var': 'error',
800
+
865
801
  'no-restricted-globals': [
866
802
  'error',
867
803
  {
@@ -876,22 +812,14 @@ export function createConfig(options = {}) {
876
812
  },
877
813
  ].concat(confusingBrowserGlobals),
878
814
 
879
- 'no-shadow': 0, // disallow declaration of variables already declared in the outer scope
880
-
881
- 'no-shadow-restricted-names': 'error', // disallow shadowing of names such as arguments
882
-
883
- 'no-undef': 'error', // disallow use of undeclared variables unless mentioned in a /*global */ block
884
-
885
- 'no-undef-init': 'error', // disallow use of undefined when initializing variables
886
-
887
- // Alternative with no-undef-init , no-shadow-restricted-names, no-global-assign activated
888
- 'no-undefined': 'off', // disallow use of undefined variable
815
+ // disallow shadowing of names such as arguments
816
+ 'no-shadow-restricted-names': 'error',
889
817
 
890
- // disallow declaration of variables that are not used in the code - handle by typescript-eslint
891
- 'no-unused-vars': 'off',
818
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
819
+ 'no-undef': 'error',
892
820
 
893
- // disallow use of variables before they are defined - handle by typescript-eslint
894
- 'no-use-before-define': 'off',
821
+ // disallow use of undefined when initializing variables
822
+ 'no-undef-init': 'error',
895
823
 
896
824
  'no-restricted-syntax': [
897
825
  'error',
@@ -935,6 +863,7 @@ export function createConfig(options = {}) {
935
863
  ignoreStrings: true,
936
864
  },
937
865
  ],
866
+
938
867
  '@typescript-eslint/naming-convention': [
939
868
  'error',
940
869
  {
@@ -1115,32 +1044,14 @@ export function createConfig(options = {}) {
1115
1044
  allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
1116
1045
  },
1117
1046
  ],
1118
- '@stylistic-eslint/no-extra-parens': [
1119
- 'off',
1120
- 'all',
1121
- {
1122
- conditionalAssign: true,
1123
- nestedBinaryExpressions: false,
1124
- returnAssign: false,
1125
- ignoreJSX: 'all', // delegate to eslint-plugin-react
1126
- enforceForArrowConditionals: false,
1127
- },
1128
- ],
1047
+
1129
1048
  '@typescript-eslint/no-empty-function': [
1130
1049
  'error',
1131
1050
  {
1132
1051
  allow: ['arrowFunctions', 'functions', 'methods'],
1133
1052
  },
1134
1053
  ],
1135
- '@stylistic-eslint/no-magic-numbers': [
1136
- 'off',
1137
- {
1138
- ignore: [],
1139
- ignoreArrayIndexes: true,
1140
- enforceConst: true,
1141
- detectObjects: false,
1142
- },
1143
- ],
1054
+
1144
1055
  '@typescript-eslint/no-unused-expressions': [
1145
1056
  'error',
1146
1057
  {
@@ -1149,18 +1060,20 @@ export function createConfig(options = {}) {
1149
1060
  allowTaggedTemplates: false,
1150
1061
  },
1151
1062
  ],
1063
+
1152
1064
  '@typescript-eslint/no-unused-vars': [
1153
1065
  'error',
1154
1066
  { vars: 'all', args: 'after-used', ignoreRestSiblings: true },
1155
1067
  ],
1068
+
1156
1069
  '@typescript-eslint/no-use-before-define': [
1157
1070
  'error',
1158
1071
  { functions: true, classes: true, variables: true },
1159
1072
  ],
1160
1073
 
1161
- '@stylistic-eslint/adjacent-overload-signatures': 'off',
1162
1074
  '@typescript-eslint/array-type': ['error'],
1163
1075
  '@typescript-eslint/await-thenable': ['error'],
1076
+
1164
1077
  '@typescript-eslint/ban-ts-comment': [
1165
1078
  'error',
1166
1079
  {
@@ -1168,32 +1081,29 @@ export function createConfig(options = {}) {
1168
1081
  minimumDescriptionLength: 3,
1169
1082
  },
1170
1083
  ],
1084
+
1171
1085
  '@typescript-eslint/ban-tslint-comment': ['error'],
1172
1086
  '@typescript-eslint/no-restricted-types': 2,
1173
1087
  '@typescript-eslint/no-empty-object-type': 2,
1174
1088
  '@typescript-eslint/no-unsafe-function-type': 2,
1175
1089
  '@typescript-eslint/no-wrapper-object-types': 2,
1176
- '@stylistic-eslint/brace-style': 'off',
1177
- '@stylistic-eslint/class-literal-property-style': 'off',
1090
+
1178
1091
  '@stylistic-eslint/comma-spacing': [
1179
1092
  'error',
1180
1093
  { before: false, after: true },
1181
1094
  ],
1095
+
1182
1096
  '@typescript-eslint/consistent-generic-constructors': ['error'],
1097
+
1183
1098
  '@typescript-eslint/consistent-indexed-object-style': [
1184
1099
  'error',
1185
1100
  'record',
1186
1101
  ],
1102
+
1187
1103
  '@typescript-eslint/consistent-type-assertions': ['error'],
1188
- '@typescript-eslint/consistent-type-definitions': 'off',
1189
- '@typescript-eslint/consistent-type-exports': 'off',
1190
- '@typescript-eslint/consistent-type-imports': 'off',
1191
- // Activate explicit-module-boundary-type as an alternative
1192
- '@typescript-eslint/explicit-function-return-type': 'off',
1193
1104
  '@typescript-eslint/explicit-member-accessibility': ['error'],
1194
1105
  '@typescript-eslint/explicit-module-boundary-types': 2,
1195
1106
  '@/func-call-spacing': ['error', 'never'],
1196
- '@stylistic-eslint/indent': 0,
1197
1107
  '@stylistic-eslint/member-delimiter-style': ['error'],
1198
1108
  '@typescript-eslint/member-ordering': ['error'],
1199
1109
  '@typescript-eslint/method-signature-style': ['error'],
@@ -1202,7 +1112,6 @@ export function createConfig(options = {}) {
1202
1112
  '@typescript-eslint/no-confusing-non-null-assertion': ['error'],
1203
1113
  '@typescript-eslint/no-confusing-void-expression': ['error'],
1204
1114
  '@typescript-eslint/no-duplicate-enum-values': ['error'],
1205
- '@typescript-eslint/no-dupe-class-members': 0, // automatically checked by the TypeScript compiler
1206
1115
  '@typescript-eslint/no-dynamic-delete': ['error'],
1207
1116
  '@typescript-eslint/no-empty-interface': ['error'],
1208
1117
  '@typescript-eslint/no-explicit-any': [2],
@@ -1221,7 +1130,6 @@ export function createConfig(options = {}) {
1221
1130
  '@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
1222
1131
  '@typescript-eslint/no-non-null-assertion': ['error'],
1223
1132
  '@typescript-eslint/no-redundant-type-constituents': 'error',
1224
- '@typescript-eslint/no-require-imports': 'off',
1225
1133
  '@typescript-eslint/no-this-alias': ['error'],
1226
1134
  '@typescript-eslint/only-throw-error': 'error',
1227
1135
  '@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
@@ -1230,16 +1138,13 @@ export function createConfig(options = {}) {
1230
1138
  '@typescript-eslint/no-unnecessary-type-arguments': ['error'],
1231
1139
  '@typescript-eslint/no-unnecessary-type-assertion': ['error'],
1232
1140
  '@typescript-eslint/no-unnecessary-type-constraint': ['error'],
1233
- '@typescript-eslint/no-unsafe-argument': 'off',
1234
- '@typescript-eslint/no-unsafe-assignment': 0,
1235
- '@typescript-eslint/no-unsafe-call': ['warn'],
1236
- '@typescript-eslint/no-unsafe-member-access': [1],
1237
- '@typescript-eslint/no-unsafe-return': ['warn'],
1238
- '@typescript-eslint/no-useless-empty-export': 'off',
1141
+ '@typescript-eslint/no-unsafe-argument': 'error',
1142
+ '@typescript-eslint/no-unsafe-assignment': 'error',
1143
+ '@typescript-eslint/no-unsafe-call': ['error'],
1144
+ '@typescript-eslint/no-unsafe-member-access': ['error'],
1145
+ '@typescript-eslint/no-unsafe-return': ['error'],
1239
1146
  '@typescript-eslint/no-useless-constructor': 'error',
1240
- '@typescript-eslint/no-var-requires': 'off',
1241
1147
  '@typescript-eslint/non-nullable-type-assertion-style': ['error'],
1242
- '@typescript-eslint/parameter-properties': 'off',
1243
1148
  '@typescript-eslint/prefer-as-const': ['error'],
1244
1149
  '@typescript-eslint/prefer-enum-initializers': ['error'],
1245
1150
  '@typescript-eslint/prefer-for-of': ['error'],
@@ -1249,8 +1154,6 @@ export function createConfig(options = {}) {
1249
1154
  '@typescript-eslint/prefer-namespace-keyword': ['error'],
1250
1155
  '@typescript-eslint/prefer-nullish-coalescing': ['error'],
1251
1156
  '@typescript-eslint/prefer-optional-chain': ['error'],
1252
- '@typescript-eslint/prefer-readonly-parameter-types': 'off', // ['error'],
1253
- '@typescript-eslint/prefer-readonly': 'off',
1254
1157
  '@typescript-eslint/prefer-reduce-type-parameter': ['error'],
1255
1158
  '@typescript-eslint/prefer-regexp-exec': ['error'],
1256
1159
  '@typescript-eslint/prefer-return-this-type': ['error'],
@@ -1262,55 +1165,12 @@ export function createConfig(options = {}) {
1262
1165
  '@typescript-eslint/switch-exhaustiveness-check': ['error'],
1263
1166
  '@typescript-eslint/triple-slash-reference': ['error'],
1264
1167
  '@stylistic-eslint/type-annotation-spacing': ['error'],
1265
- '@typescript-eslint/typedef': 'off',
1266
1168
  '@typescript-eslint/unbound-method': ['error'],
1267
1169
  '@typescript-eslint/unified-signatures': ['error'],
1268
-
1269
- 'brace-style': 'off',
1270
1170
  'func-style': ['error', 'declaration'],
1271
-
1272
1171
  'no-continue': 1,
1273
-
1274
- 'jsdoc/require-param-description': 0,
1275
- 'jsdoc/require-param-type': 0,
1276
- 'jsdoc/require-param': 0,
1277
- 'jsdoc/require-returns-type': 0,
1278
- 'jsdoc/require-returns': 0,
1279
- 'jsdoc/require-yields': 0,
1280
-
1281
- camelcase: 'off',
1282
-
1283
- indent: 'off',
1284
-
1285
1172
  'sonarjs/no-duplicate-string': 'error',
1286
- // Lot of new rules, we disable them for now
1287
- 'sonarjs/concise-regex': 0,
1288
- 'sonarjs/default-param-last': 0,
1289
- 'sonarjs/deprecation': 0,
1290
- 'sonarjs/duplicates-in-character-class': 0,
1291
- 'sonarjs/function-return-type': 0,
1292
- 'sonarjs/hashing': 0,
1293
- 'sonarjs/no-base-to-string': 0,
1294
- 'sonarjs/no-commented-code': 0,
1295
- 'sonarjs/no-dead-store': 0,
1296
1173
  'sonarjs/no-duplicate-string': 1,
1297
- 'sonarjs/no-empty-function': 0,
1298
- 'sonarjs/no-hardcoded-credentials': 0,
1299
- 'sonarjs/no-ignored-exceptions': 0,
1300
- 'sonarjs/no-incomplete-assertions': 0,
1301
- 'sonarjs/no-misused-promises': 0,
1302
- 'sonarjs/no-nested-functions': 0,
1303
- 'sonarjs/no-redundant-optional': 0,
1304
- 'sonarjs/no-redundant-type-constituents': 0,
1305
- 'sonarjs/no-useless-intersection': 0,
1306
- 'sonarjs/prefer-for-of': 0,
1307
- 'sonarjs/pseudo-random': 0,
1308
- 'sonarjs/redundant-type-aliases': 0,
1309
- 'sonarjs/single-character-alternation': 0,
1310
- 'sonarjs/slow-regex': 0,
1311
- 'sonarjs/sonar-no-control-regex': 0,
1312
- 'sonarjs/sonar-no-unused-vars': 0,
1313
- 'sonarjs/todo-tag': 0,
1314
1174
  },
1315
1175
  },
1316
1176
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Olivier Hardy <olivier@plumile.com>",
3
3
  "name": "@plumile/eslint-config-typescript",
4
- "version": "0.1.200",
4
+ "version": "0.1.205",
5
5
  "description": "Shared ESLint flat config tuned for TypeScript-forward React projects",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -31,29 +31,25 @@
31
31
  "npm": ">=8.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@typescript-eslint/parser": "8.66.0"
34
+ "@typescript-eslint/parser": "8.67.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@stylistic/eslint-plugin": "5.10.0",
38
38
  "eslint": "10.1.0",
39
- "eslint-plugin-jsdoc": "64.0.1",
40
- "eslint-plugin-jsx-a11y": "6.10.2",
39
+ "eslint-plugin-jsdoc": "64.1.0",
41
40
  "eslint-plugin-n": "18.3.0",
42
- "eslint-plugin-react": "7.37.5",
43
41
  "eslint-plugin-react-hooks": "7.1.1",
44
- "eslint-plugin-relay": "2.0.0",
42
+ "eslint-plugin-relay": "2.1.0",
45
43
  "eslint-plugin-sonarjs": "4.2.0"
46
44
  },
47
45
  "peerDependencies": {
48
46
  "@stylistic/eslint-plugin": "5.10.0",
49
- "@typescript-eslint/eslint-plugin": ">=8.66.0",
47
+ "@typescript-eslint/eslint-plugin": ">=8.67.0",
50
48
  "eslint": "10.x.x",
51
- "eslint-plugin-jsdoc": ">=64.0.1",
52
- "eslint-plugin-jsx-a11y": ">=6.10.2",
49
+ "eslint-plugin-jsdoc": ">=64.1.0",
53
50
  "eslint-plugin-n": "18.3.0",
54
- "eslint-plugin-react": ">=7.37.5",
55
51
  "eslint-plugin-react-hooks": "7.1.1",
56
- "eslint-plugin-relay": ">=2.0.0",
52
+ "eslint-plugin-relay": ">=2.1.0",
57
53
  "eslint-plugin-sonarjs": ">=4.2.0"
58
54
  },
59
55
  "files": [