@plumile/eslint-config-typescript 0.1.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.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/index.js +1464 -0
- package/package.json +52 -0
- package/src/rules/confusingBrowserGlobals.js +67 -0
package/index.js
ADDED
|
@@ -0,0 +1,1464 @@
|
|
|
1
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
2
|
+
import n from 'eslint-plugin-n';
|
|
3
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
4
|
+
import sonarjs from 'eslint-plugin-sonarjs';
|
|
5
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
6
|
+
import typescript from '@typescript-eslint/eslint-plugin';
|
|
7
|
+
import typescriptParser from '@typescript-eslint/parser';
|
|
8
|
+
|
|
9
|
+
import confusingBrowserGlobals from './src/rules/confusingBrowserGlobals.js';
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
// Global exclusion
|
|
13
|
+
{
|
|
14
|
+
ignores: [
|
|
15
|
+
// Common ignores
|
|
16
|
+
'.storybook/**',
|
|
17
|
+
'**/__generated__/**',
|
|
18
|
+
'**/__mocks__/**',
|
|
19
|
+
'**/__snapshots__/**',
|
|
20
|
+
'**/coverage/**',
|
|
21
|
+
'**/dist/**',
|
|
22
|
+
'**/generated/**',
|
|
23
|
+
'**/i18next-parser.config.cjs',
|
|
24
|
+
'**/lint-staged.config.cjs',
|
|
25
|
+
'**/node_modules/**',
|
|
26
|
+
'**/packages/**/lib/**',
|
|
27
|
+
'**/pino-pretty.config.js',
|
|
28
|
+
'**/schema/**',
|
|
29
|
+
'**/storybook-static/**',
|
|
30
|
+
'**/.docusaurus/**',
|
|
31
|
+
'/website/**',
|
|
32
|
+
'/.build-*/**',
|
|
33
|
+
'/data',
|
|
34
|
+
'/docker',
|
|
35
|
+
'tools/**',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
plugins: {
|
|
40
|
+
'@typescript-eslint': typescript,
|
|
41
|
+
'@stylistic-eslint': stylistic,
|
|
42
|
+
sonarjs,
|
|
43
|
+
jsdoc,
|
|
44
|
+
},
|
|
45
|
+
languageOptions: {
|
|
46
|
+
ecmaVersion: 6,
|
|
47
|
+
sourceType: 'module',
|
|
48
|
+
parser: typescriptParser,
|
|
49
|
+
parserOptions: {
|
|
50
|
+
project: './tsconfig.eslint.json',
|
|
51
|
+
ecmaFeatures: {
|
|
52
|
+
jsx: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
linterOptions: {
|
|
57
|
+
reportUnusedDisableDirectives: true,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
settings: {
|
|
61
|
+
n: {
|
|
62
|
+
typescriptExtensionMap: [
|
|
63
|
+
['', '.js'],
|
|
64
|
+
['.ts', '.js'],
|
|
65
|
+
['.cts', '.cjs'],
|
|
66
|
+
['.mts', '.mjs'],
|
|
67
|
+
['.tsx', '.js'],
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
/* Rules applicable to all files (https://eslint.org/docs/rules) */
|
|
72
|
+
rules: {
|
|
73
|
+
/* Enforce best practices rules */
|
|
74
|
+
'accessor-pairs': 'off', // enforces getter/setter pairs in objects
|
|
75
|
+
|
|
76
|
+
'array-callback-return': ['error', { allowImplicit: true }], // enforces return statements in callbacks of array's methods
|
|
77
|
+
|
|
78
|
+
'block-scoped-var': 'error', // treat var statements as if they were block scoped
|
|
79
|
+
|
|
80
|
+
complexity: ['off', 20], // specify the maximum cyclomatic complexity allowed in a program
|
|
81
|
+
|
|
82
|
+
// enforce that class methods use "this"
|
|
83
|
+
'class-methods-use-this': [
|
|
84
|
+
2,
|
|
85
|
+
{
|
|
86
|
+
exceptMethods: [],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
// require return statements to either always or never specify values
|
|
91
|
+
'consistent-return': 'error',
|
|
92
|
+
|
|
93
|
+
// specify curly brace conventions for all control statements
|
|
94
|
+
curly: ['error', 'multi-line'], // multiline
|
|
95
|
+
|
|
96
|
+
// require default case in switch statements
|
|
97
|
+
'default-case': ['error', { commentPattern: '^no default$' }],
|
|
98
|
+
|
|
99
|
+
'default-case-last': 'error', // Enforce default clauses in switch statements to be last
|
|
100
|
+
|
|
101
|
+
'default-param-last': 'error',
|
|
102
|
+
|
|
103
|
+
'dot-notation': ['error', { allowKeywords: true }], // encourages use of dot notation whenever possible
|
|
104
|
+
|
|
105
|
+
'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots
|
|
106
|
+
|
|
107
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }], // require the use of === and !==
|
|
108
|
+
|
|
109
|
+
// Require grouped accessor pairs in object literals and classes
|
|
110
|
+
'grouped-accessor-pairs': 'error',
|
|
111
|
+
|
|
112
|
+
// make sure for-in loops have an if statement
|
|
113
|
+
'guard-for-in': 0,
|
|
114
|
+
|
|
115
|
+
'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file
|
|
116
|
+
|
|
117
|
+
'no-alert': 2, // disallow the use of alert, confirm, and prompt
|
|
118
|
+
|
|
119
|
+
'no-caller': 'error', // disallow use of arguments.caller or arguments.callee
|
|
120
|
+
|
|
121
|
+
'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses
|
|
122
|
+
|
|
123
|
+
'no-constructor-return': 'error', // Disallow returning value in constructor
|
|
124
|
+
|
|
125
|
+
// disallow division operators explicitly at beginning of regular expression
|
|
126
|
+
'no-div-regex': 'off',
|
|
127
|
+
|
|
128
|
+
// disallow else after a return in an if
|
|
129
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
130
|
+
|
|
131
|
+
'no-empty-function': 0, // disallow empty functions,- handle by typescript-eslint
|
|
132
|
+
|
|
133
|
+
'no-empty-pattern': 'error', // disallow empty destructuring patterns
|
|
134
|
+
|
|
135
|
+
'no-eq-null': 'off', // disallow comparisons to null without a type-checking operator
|
|
136
|
+
|
|
137
|
+
'no-eval': 'error', // disallow use of eval()
|
|
138
|
+
|
|
139
|
+
'no-extend-native': 'error', // disallow adding to native types
|
|
140
|
+
|
|
141
|
+
'no-extra-bind': 'error', // disallow unnecessary function binding
|
|
142
|
+
|
|
143
|
+
'no-extra-label': 'error', // disallow Unnecessary Labels
|
|
144
|
+
|
|
145
|
+
'no-fallthrough': 'error', // disallow fallthrough of case statements
|
|
146
|
+
|
|
147
|
+
// disallow the use of leading or trailing decimal points in numeric literals
|
|
148
|
+
'no-floating-decimal': 'error',
|
|
149
|
+
|
|
150
|
+
// disallow reassignments of native objects or read-only globals
|
|
151
|
+
'no-global-assign': ['error', { exceptions: [] }],
|
|
152
|
+
|
|
153
|
+
// disallow implicit type conversions
|
|
154
|
+
'no-implicit-coercion': [
|
|
155
|
+
'off',
|
|
156
|
+
{
|
|
157
|
+
boolean: false,
|
|
158
|
+
number: true,
|
|
159
|
+
string: true,
|
|
160
|
+
allow: [],
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
|
|
164
|
+
'no-implicit-globals': 'off', // disallow var and named functions in global scope
|
|
165
|
+
|
|
166
|
+
'no-implied-eval': 0, // disallow use of eval()-like methods
|
|
167
|
+
|
|
168
|
+
// disallow this keywords outside of classes or class-like objects - checked by TS compiler
|
|
169
|
+
'no-invalid-this': 'off',
|
|
170
|
+
|
|
171
|
+
'no-iterator': 'error', // disallow usage of __iterator__ property
|
|
172
|
+
|
|
173
|
+
// disallow use of labels for anything other than loops and switches
|
|
174
|
+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
175
|
+
|
|
176
|
+
'no-lone-blocks': 'error', // disallow unnecessary nested blocks
|
|
177
|
+
|
|
178
|
+
'no-loop-func': 'error', // disallow creation of functions within loops
|
|
179
|
+
|
|
180
|
+
// disallow use of multiple spaces
|
|
181
|
+
'no-multi-spaces': [
|
|
182
|
+
'error',
|
|
183
|
+
{
|
|
184
|
+
ignoreEOLComments: false,
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
|
|
188
|
+
'no-multi-str': 'error', // disallow use of multiline strings
|
|
189
|
+
|
|
190
|
+
'no-new': 'error', // disallow use of new operator when not part of the assignment or comparison
|
|
191
|
+
|
|
192
|
+
'no-new-func': 'error', // disallow use of new operator for Function object
|
|
193
|
+
|
|
194
|
+
// disallows creating new instances of String, Number, and Boolean
|
|
195
|
+
'no-new-wrappers': 'error',
|
|
196
|
+
|
|
197
|
+
// Disallow \8 and \9 escape sequences in string literals
|
|
198
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
199
|
+
|
|
200
|
+
'no-octal': 'error', // disallow use of (old style) octal literals
|
|
201
|
+
|
|
202
|
+
// disallow use of octal escape sequences in string literals, such as
|
|
203
|
+
// var foo = 'Copyright \251';
|
|
204
|
+
'no-octal-escape': 'error',
|
|
205
|
+
|
|
206
|
+
// disallow reassignment of function parameters
|
|
207
|
+
// disallow parameter object manipulation except for specific exclusions
|
|
208
|
+
'no-param-reassign': [
|
|
209
|
+
'error',
|
|
210
|
+
{
|
|
211
|
+
props: true,
|
|
212
|
+
ignorePropertyModificationsFor: [
|
|
213
|
+
'acc', // for reduce accumulators
|
|
214
|
+
'accumulator', // for reduce accumulators
|
|
215
|
+
'e', // for e.returnvalue
|
|
216
|
+
'ctx', // for Koa routing
|
|
217
|
+
'context', // for Koa routing
|
|
218
|
+
'req', // for Express requests
|
|
219
|
+
'request', // for Express requests
|
|
220
|
+
'res', // for Express responses
|
|
221
|
+
'response', // for Express responses
|
|
222
|
+
'$scope', // for Angular 1 scopes
|
|
223
|
+
'staticContext', // for ReactRouter context
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
|
|
228
|
+
'no-proto': 'error', // disallow usage of __proto__ property
|
|
229
|
+
|
|
230
|
+
'no-redeclare': 'error', // disallow declaring the same variable more than once
|
|
231
|
+
|
|
232
|
+
// disallow certain object properties
|
|
233
|
+
'no-restricted-properties': [
|
|
234
|
+
'error',
|
|
235
|
+
{
|
|
236
|
+
object: 'arguments',
|
|
237
|
+
property: 'callee',
|
|
238
|
+
message: 'arguments.callee is deprecated',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
object: 'global',
|
|
242
|
+
property: 'isFinite',
|
|
243
|
+
message: 'Please use Number.isFinite instead',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
object: 'self',
|
|
247
|
+
property: 'isFinite',
|
|
248
|
+
message: 'Please use Number.isFinite instead',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
object: 'window',
|
|
252
|
+
property: 'isFinite',
|
|
253
|
+
message: 'Please use Number.isFinite instead',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
object: 'global',
|
|
257
|
+
property: 'isNaN',
|
|
258
|
+
message: 'Please use Number.isNaN instead',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
object: 'self',
|
|
262
|
+
property: 'isNaN',
|
|
263
|
+
message: 'Please use Number.isNaN instead',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
object: 'window',
|
|
267
|
+
property: 'isNaN',
|
|
268
|
+
message: 'Please use Number.isNaN instead',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
property: '__defineGetter__',
|
|
272
|
+
message: 'Please use Object.defineProperty instead.',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
property: '__defineSetter__',
|
|
276
|
+
message: 'Please use Object.defineProperty instead.',
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
object: 'Math',
|
|
280
|
+
property: 'pow',
|
|
281
|
+
message: 'Use the exponentiation operator (**) instead.',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
|
|
285
|
+
// disallow use of assignment in return statement
|
|
286
|
+
'no-return-assign': ['error', 'always'],
|
|
287
|
+
|
|
288
|
+
'no-return-await': 'error', // disallow redundant `return await`
|
|
289
|
+
|
|
290
|
+
'no-script-url': 'error', // disallow use of `javascript:` urls.
|
|
291
|
+
|
|
292
|
+
// disallow self assignment
|
|
293
|
+
'no-self-assign': [
|
|
294
|
+
'error',
|
|
295
|
+
{
|
|
296
|
+
props: true,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
|
|
300
|
+
'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same
|
|
301
|
+
|
|
302
|
+
'no-sequences': 'error', // disallow use of comma operator
|
|
303
|
+
|
|
304
|
+
// restrict what can be thrown as an exception - handle by typescript-eslint
|
|
305
|
+
'no-throw-literal': 'off', // handle by only-throw-error in typescript-eslint
|
|
306
|
+
|
|
307
|
+
// disallow unmodified conditions of loops
|
|
308
|
+
'no-unmodified-loop-condition': 'off',
|
|
309
|
+
|
|
310
|
+
// disallow usage of expressions in statement position - handle by typescript-eslint
|
|
311
|
+
'no-unused-expressions': 0,
|
|
312
|
+
|
|
313
|
+
'no-unused-labels': 'error', // disallow unused labels
|
|
314
|
+
|
|
315
|
+
'no-useless-call': 'off', // disallow unnecessary .call() and .apply()
|
|
316
|
+
|
|
317
|
+
'no-useless-catch': 'error', // Disallow unnecessary catch clauses
|
|
318
|
+
|
|
319
|
+
'no-useless-concat': 'error', // disallow useless string concatenation
|
|
320
|
+
|
|
321
|
+
'no-useless-escape': 'error', // disallow unnecessary string escaping
|
|
322
|
+
|
|
323
|
+
'no-useless-return': 'error', // disallow redundant return; keywords
|
|
324
|
+
|
|
325
|
+
'no-void': 'error', // disallow use of void operator
|
|
326
|
+
|
|
327
|
+
// disallow usage of configurable warning terms in comments: e.g. todo
|
|
328
|
+
'no-warning-comments': [
|
|
329
|
+
'off',
|
|
330
|
+
{ terms: ['todo', 'fixme', 'xxx'], location: 'start' },
|
|
331
|
+
],
|
|
332
|
+
|
|
333
|
+
'no-with': 'error', // disallow use of the with statement
|
|
334
|
+
|
|
335
|
+
// require using Error objects as Promise rejection reasons
|
|
336
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
337
|
+
|
|
338
|
+
// Suggest using named capture group in regular expression
|
|
339
|
+
'prefer-named-capture-group': 'off',
|
|
340
|
+
|
|
341
|
+
// Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
|
|
342
|
+
// TODO: semver-major: enable thus rule, once eslint v8.5.0 is required
|
|
343
|
+
'prefer-object-has-own': 'off',
|
|
344
|
+
|
|
345
|
+
// Disallow use of the RegExp constructor in favor of regular expression literals
|
|
346
|
+
'prefer-regex-literals': [
|
|
347
|
+
'error',
|
|
348
|
+
{
|
|
349
|
+
disallowRedundantWrapping: true,
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
|
|
353
|
+
radix: 'error', // require use of the second argument for parseInt()
|
|
354
|
+
|
|
355
|
+
// require `await` in `async function` (note: this is a horrible rule that should never be used)
|
|
356
|
+
'require-await': 'off',
|
|
357
|
+
|
|
358
|
+
// Enforce the use of u flag on RegExp
|
|
359
|
+
'require-unicode-regexp': 'off',
|
|
360
|
+
|
|
361
|
+
'vars-on-top': 'error', // requires to declare all vars on top of their containing scope
|
|
362
|
+
|
|
363
|
+
// require immediate function invocation to be wrapped in parentheses
|
|
364
|
+
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
365
|
+
|
|
366
|
+
yoda: 'error', // require or disallow Yoda conditions
|
|
367
|
+
|
|
368
|
+
/* Enforce Errors rules */
|
|
369
|
+
|
|
370
|
+
'for-direction': 'error', // Enforce “for” loop update clause moving the counter in the right direction
|
|
371
|
+
|
|
372
|
+
'getter-return': ['error', { allowImplicit: true }], // Enforces that a return statement is present in property getters
|
|
373
|
+
|
|
374
|
+
'no-async-promise-executor': 'error', // disallow using an async function as a Promise executor
|
|
375
|
+
|
|
376
|
+
'no-await-in-loop': 0, // Disallow await inside of loops
|
|
377
|
+
|
|
378
|
+
'no-compare-neg-zero': 'error', // Disallow comparisons to negative zero
|
|
379
|
+
|
|
380
|
+
'no-cond-assign': ['error', 'always'], // disallow assignment in conditional expressions
|
|
381
|
+
|
|
382
|
+
'no-console': 'warn', // disallow use of console
|
|
383
|
+
|
|
384
|
+
'no-constant-binary-expression': 2, // Disallows expressions where the operation doesn't affect the value
|
|
385
|
+
|
|
386
|
+
'no-constant-condition': 'warn', // disallow use of constant expressions in conditions
|
|
387
|
+
|
|
388
|
+
'no-control-regex': 'error', // disallow control characters in regular expressions
|
|
389
|
+
|
|
390
|
+
'no-debugger': 'error', // disallow use of debugger
|
|
391
|
+
|
|
392
|
+
'no-dupe-args': 'error', // disallow duplicate arguments in functions
|
|
393
|
+
|
|
394
|
+
'no-dupe-else-if': 'error', // Disallow duplicate conditions in if-else-if chains
|
|
395
|
+
|
|
396
|
+
'no-dupe-keys': 'error', // disallow duplicate keys when creating object literals
|
|
397
|
+
|
|
398
|
+
'no-duplicate-case': 'error', // disallow a duplicate case label.
|
|
399
|
+
|
|
400
|
+
'no-empty': 'error', // disallow empty statements
|
|
401
|
+
|
|
402
|
+
// disallow the use of empty character classes in regular expressions
|
|
403
|
+
'no-empty-character-class': 'error',
|
|
404
|
+
|
|
405
|
+
// disallow assigning to the exception in a catch block
|
|
406
|
+
'no-ex-assign': 'error',
|
|
407
|
+
|
|
408
|
+
// disallow double-negation boolean casts in a boolean context
|
|
409
|
+
'no-extra-boolean-cast': 'error',
|
|
410
|
+
|
|
411
|
+
'no-func-assign': 'error', // disallow overwriting functions written as function declarations
|
|
412
|
+
|
|
413
|
+
'no-import-assign': 'error', // Disallow assigning to imported bindings
|
|
414
|
+
|
|
415
|
+
'no-inner-declarations': 'error', // disallow function or variable declarations in nested blocks
|
|
416
|
+
|
|
417
|
+
'no-invalid-regexp': 'error', // disallow invalid regular expression strings in the RegExp constructor
|
|
418
|
+
|
|
419
|
+
'no-irregular-whitespace': 'error', // disallow irregular whitespace outside of strings and comments
|
|
420
|
+
|
|
421
|
+
'no-loss-of-precision': 'error', // Disallow Number Literals That Lose Precision
|
|
422
|
+
|
|
423
|
+
// Disallow characters which are made with multiple code points in character class syntax
|
|
424
|
+
'no-misleading-character-class': 'error',
|
|
425
|
+
|
|
426
|
+
// disallow the use of object properties of the global object (Math and JSON) as functions
|
|
427
|
+
'no-obj-calls': 'error',
|
|
428
|
+
|
|
429
|
+
// Disallow returning values from Promise executor functions
|
|
430
|
+
'no-promise-executor-return': 'error',
|
|
431
|
+
|
|
432
|
+
// disallow use of Object.prototypes builtins directly
|
|
433
|
+
'no-prototype-builtins': 'error',
|
|
434
|
+
|
|
435
|
+
'no-regex-spaces': 'error', // disallow multiple spaces in a regular expression literal
|
|
436
|
+
|
|
437
|
+
'no-setter-return': 'error', // Disallow returning values from setters
|
|
438
|
+
|
|
439
|
+
'no-sparse-arrays': 'error', // disallow sparse arrays
|
|
440
|
+
|
|
441
|
+
// Disallow template literal placeholder syntax in regular strings
|
|
442
|
+
'no-template-curly-in-string': 'error',
|
|
443
|
+
|
|
444
|
+
// Avoid code that looks like two expressions but is actually one
|
|
445
|
+
'no-unexpected-multiline': 'error',
|
|
446
|
+
|
|
447
|
+
// disallow unreachable statements after a return, throw, continue, or break statement
|
|
448
|
+
'no-unreachable': 'error',
|
|
449
|
+
|
|
450
|
+
// Disallow loops with a body that allows only one iteration
|
|
451
|
+
'no-unreachable-loop': [
|
|
452
|
+
'error',
|
|
453
|
+
{
|
|
454
|
+
// WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
|
|
455
|
+
ignore: [],
|
|
456
|
+
},
|
|
457
|
+
],
|
|
458
|
+
|
|
459
|
+
'no-unsafe-finally': 'error', // disallow return/throw/break/continue inside finally blocks
|
|
460
|
+
|
|
461
|
+
// disallow negating the left operand of relational operators
|
|
462
|
+
'no-unsafe-negation': 'error',
|
|
463
|
+
|
|
464
|
+
// disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
465
|
+
'no-unsafe-optional-chaining': [
|
|
466
|
+
'error',
|
|
467
|
+
{ disallowArithmeticOperators: true },
|
|
468
|
+
],
|
|
469
|
+
|
|
470
|
+
'no-unused-private-class-members': 1, // Disallow Unused Private Class Members
|
|
471
|
+
|
|
472
|
+
'no-useless-backreference': 'error', // Disallow useless backreferences in regular expressions
|
|
473
|
+
|
|
474
|
+
// Disallow assignments that can lead to race conditions due to usage of await or yield
|
|
475
|
+
// note: not enabled because it is very buggy
|
|
476
|
+
'require-atomic-updates': 0,
|
|
477
|
+
|
|
478
|
+
'use-isnan': 'error', // disallow comparisons with the value NaN
|
|
479
|
+
|
|
480
|
+
// ensure that the results of typeof are compared against a valid string
|
|
481
|
+
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
482
|
+
|
|
483
|
+
/* Enforce es6 rules */
|
|
484
|
+
// enforces no braces where they can be omitted
|
|
485
|
+
'arrow-body-style': ['error', 'always'],
|
|
486
|
+
|
|
487
|
+
'arrow-parens': ['error', 'always'], // require parens in arrow function arguments
|
|
488
|
+
|
|
489
|
+
// require space before/after arrow function's arrow
|
|
490
|
+
'arrow-spacing': ['error', { before: true, after: true }],
|
|
491
|
+
|
|
492
|
+
'constructor-super': 'error', // verify super() callings in constructors
|
|
493
|
+
|
|
494
|
+
// enforce the spacing around the * in generator functions
|
|
495
|
+
'generator-star-spacing': ['error', { before: false, after: true }],
|
|
496
|
+
|
|
497
|
+
'no-class-assign': 'error', // disallow modifying variables of class declarations
|
|
498
|
+
|
|
499
|
+
// disallow arrow functions where they could be confused with comparisons
|
|
500
|
+
'no-confusing-arrow': [
|
|
501
|
+
'error',
|
|
502
|
+
{
|
|
503
|
+
allowParens: true,
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
|
|
507
|
+
'no-const-assign': 'error', // disallow modifying variables that are declared using const
|
|
508
|
+
|
|
509
|
+
'no-dupe-class-members': 0, // disallow duplicate class members - handle by typescript-eslint
|
|
510
|
+
|
|
511
|
+
'no-duplicate-imports': 2, // disallow importing from the same path more than once
|
|
512
|
+
|
|
513
|
+
'no-new-symbol': 'error', // disallow symbol constructor
|
|
514
|
+
|
|
515
|
+
// Disallow specified names in exports
|
|
516
|
+
'no-restricted-exports': [
|
|
517
|
+
'error',
|
|
518
|
+
{
|
|
519
|
+
restrictedNamedExports: [
|
|
520
|
+
'default', // use `export default` to provide a default export
|
|
521
|
+
'then', // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
522
|
+
],
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
|
|
526
|
+
// disallow specific imports
|
|
527
|
+
'no-restricted-imports': [
|
|
528
|
+
'off',
|
|
529
|
+
{
|
|
530
|
+
paths: [],
|
|
531
|
+
patterns: [],
|
|
532
|
+
},
|
|
533
|
+
],
|
|
534
|
+
|
|
535
|
+
'no-this-before-super': 'error', // disallow to use this/super before super() calling in constructors.
|
|
536
|
+
|
|
537
|
+
'no-useless-computed-key': 'error', // disallow useless computed property keys
|
|
538
|
+
|
|
539
|
+
'no-useless-constructor': 0, // disallow unnecessary constructor - handle by typescript-eslint
|
|
540
|
+
|
|
541
|
+
// disallow renaming import, export, and destructured assignments to the same name
|
|
542
|
+
'no-useless-rename': [
|
|
543
|
+
'error',
|
|
544
|
+
{
|
|
545
|
+
ignoreDestructuring: false,
|
|
546
|
+
ignoreImport: false,
|
|
547
|
+
ignoreExport: false,
|
|
548
|
+
},
|
|
549
|
+
],
|
|
550
|
+
|
|
551
|
+
'no-var': 'error', // require let or const instead of var
|
|
552
|
+
|
|
553
|
+
// require method and property shorthand syntax for object literals
|
|
554
|
+
'object-shorthand': [
|
|
555
|
+
'error',
|
|
556
|
+
'always',
|
|
557
|
+
{
|
|
558
|
+
ignoreConstructors: false,
|
|
559
|
+
avoidQuotes: true,
|
|
560
|
+
},
|
|
561
|
+
],
|
|
562
|
+
|
|
563
|
+
// suggest using arrow functions as callbacks
|
|
564
|
+
'prefer-arrow-callback': [
|
|
565
|
+
'error',
|
|
566
|
+
{
|
|
567
|
+
allowNamedFunctions: false,
|
|
568
|
+
allowUnboundThis: true,
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
|
|
572
|
+
// suggest using of const declaration for variables that are never modified after declared
|
|
573
|
+
'prefer-const': [
|
|
574
|
+
'error',
|
|
575
|
+
{
|
|
576
|
+
destructuring: 'any',
|
|
577
|
+
ignoreReadBeforeAssign: true,
|
|
578
|
+
},
|
|
579
|
+
],
|
|
580
|
+
|
|
581
|
+
// Prefer destructuring from arrays and objects
|
|
582
|
+
'prefer-destructuring': [
|
|
583
|
+
'error',
|
|
584
|
+
{
|
|
585
|
+
VariableDeclarator: {
|
|
586
|
+
array: false,
|
|
587
|
+
object: true,
|
|
588
|
+
},
|
|
589
|
+
AssignmentExpression: {
|
|
590
|
+
array: true,
|
|
591
|
+
object: false,
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
enforceForRenamedProperties: false,
|
|
596
|
+
},
|
|
597
|
+
],
|
|
598
|
+
|
|
599
|
+
'prefer-numeric-literals': 'error', // disallow parseInt() in favor of binary, octal, and hexadecimal literals
|
|
600
|
+
|
|
601
|
+
'prefer-reflect': 'off', // suggest using Reflect methods where applicable
|
|
602
|
+
|
|
603
|
+
'prefer-rest-params': 'error', // use rest parameters instead of arguments
|
|
604
|
+
|
|
605
|
+
'prefer-spread': 'error', // suggest using the spread syntax instead of .apply()
|
|
606
|
+
|
|
607
|
+
'prefer-template': 'error', // suggest using template literals instead of string concatenation
|
|
608
|
+
|
|
609
|
+
'require-yield': 'error', // disallow generator functions that do not have yield
|
|
610
|
+
|
|
611
|
+
'rest-spread-spacing': ['error', 'never'], // enforce spacing between object rest-spread
|
|
612
|
+
|
|
613
|
+
// import sorting
|
|
614
|
+
'sort-imports': [
|
|
615
|
+
'off',
|
|
616
|
+
{
|
|
617
|
+
ignoreCase: false,
|
|
618
|
+
ignoreDeclarationSort: false,
|
|
619
|
+
ignoreMemberSort: false,
|
|
620
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
621
|
+
},
|
|
622
|
+
],
|
|
623
|
+
|
|
624
|
+
'symbol-description': 'error', // require a Symbol description
|
|
625
|
+
|
|
626
|
+
'template-curly-spacing': 'error', // enforce usage of spacing in template strings
|
|
627
|
+
|
|
628
|
+
'yield-star-spacing': ['error', 'after'], // enforce spacing around the * in yield* expressions
|
|
629
|
+
|
|
630
|
+
/* Enforce node rules://eslint - https://eslint.org/docs/latest/rules/ */
|
|
631
|
+
|
|
632
|
+
'callback-return': 'off', // enforce return after a callback
|
|
633
|
+
|
|
634
|
+
'global-require': 'error', // require all requires be top-level
|
|
635
|
+
|
|
636
|
+
'handle-callback-err': 'off', // enforces error handling in callbacks (node environment)
|
|
637
|
+
|
|
638
|
+
'no-buffer-constructor': 'error', // disallow use of the Buffer() constructor
|
|
639
|
+
|
|
640
|
+
'no-mixed-requires': ['off', false], // disallow mixing regular variable and require declarations
|
|
641
|
+
|
|
642
|
+
'no-new-require': 'error', // disallow use of new operator with the require function
|
|
643
|
+
|
|
644
|
+
'no-path-concat': 'error', // disallow string concatenation with __dirname and __filename
|
|
645
|
+
|
|
646
|
+
'no-process-env': 'off', // disallow use of process.env
|
|
647
|
+
|
|
648
|
+
'no-process-exit': 'off', // disallow process.exit()
|
|
649
|
+
|
|
650
|
+
'no-restricted-modules': 'off', // restrict usage of specified node modules
|
|
651
|
+
|
|
652
|
+
'no-sync': 'off', // disallow use of synchronous methods (off by default)
|
|
653
|
+
|
|
654
|
+
/* Enforce strict rules */
|
|
655
|
+
|
|
656
|
+
strict: ['error', 'never'], // babel inserts `'use strict';` for us
|
|
657
|
+
|
|
658
|
+
/* Enforce style rules */
|
|
659
|
+
|
|
660
|
+
'no-ternary': ['error'], // disallow the use of ternary operators
|
|
661
|
+
|
|
662
|
+
// disallow trailing whitespace at the end of lines
|
|
663
|
+
'no-trailing-spaces': [
|
|
664
|
+
'error',
|
|
665
|
+
{
|
|
666
|
+
skipBlankLines: false,
|
|
667
|
+
ignoreComments: false,
|
|
668
|
+
},
|
|
669
|
+
],
|
|
670
|
+
|
|
671
|
+
// disallow dangling underscores in identifiers
|
|
672
|
+
'no-underscore-dangle': [
|
|
673
|
+
0,
|
|
674
|
+
{
|
|
675
|
+
allow: [],
|
|
676
|
+
allowAfterThis: false,
|
|
677
|
+
allowAfterSuper: false,
|
|
678
|
+
enforceInMethodNames: true,
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
|
|
682
|
+
// disallow the use of Boolean literals in conditional expressions
|
|
683
|
+
// also, prefer `a || b` over `a ? a : b`
|
|
684
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
685
|
+
|
|
686
|
+
// disallow whitespace before properties
|
|
687
|
+
'@stylistic-eslint/no-whitespace-before-property': 2,
|
|
688
|
+
|
|
689
|
+
// enforce the location of single-line statements
|
|
690
|
+
'nonblock-statement-body-position': [
|
|
691
|
+
'error',
|
|
692
|
+
'beside',
|
|
693
|
+
{ overrides: {} },
|
|
694
|
+
],
|
|
695
|
+
|
|
696
|
+
'@stylistic-eslint/object-curly-spacing': ['error', 'always'], // require padding inside curly braces
|
|
697
|
+
|
|
698
|
+
// enforce line breaks between braces
|
|
699
|
+
'object-curly-newline': [
|
|
700
|
+
0,
|
|
701
|
+
{
|
|
702
|
+
ObjectExpression: {
|
|
703
|
+
minProperties: 4,
|
|
704
|
+
multiline: true,
|
|
705
|
+
consistent: true,
|
|
706
|
+
},
|
|
707
|
+
ObjectPattern: {
|
|
708
|
+
minProperties: 4,
|
|
709
|
+
multiline: true,
|
|
710
|
+
consistent: true,
|
|
711
|
+
},
|
|
712
|
+
ImportDeclaration: {
|
|
713
|
+
minProperties: 4,
|
|
714
|
+
multiline: true,
|
|
715
|
+
consistent: true,
|
|
716
|
+
},
|
|
717
|
+
ExportDeclaration: {
|
|
718
|
+
minProperties: 4,
|
|
719
|
+
multiline: true,
|
|
720
|
+
consistent: true,
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
|
|
725
|
+
// enforce "same line" or "multiple line" on object properties.
|
|
726
|
+
'object-property-newline': [
|
|
727
|
+
'error',
|
|
728
|
+
{
|
|
729
|
+
allowAllPropertiesOnSameLine: true,
|
|
730
|
+
},
|
|
731
|
+
],
|
|
732
|
+
|
|
733
|
+
'one-var': ['error', 'never'], // allow just one var statement per function
|
|
734
|
+
|
|
735
|
+
'one-var-declaration-per-line': ['error', 'always'], // require a newline around variable declaration
|
|
736
|
+
|
|
737
|
+
// require assignment operator shorthand where possible or prohibit it entirely
|
|
738
|
+
'operator-assignment': ['error', 'always'],
|
|
739
|
+
|
|
740
|
+
// Requires operator at the beginning of the line in multiline statements
|
|
741
|
+
'@stylistic-eslint/operator-linebreak': [
|
|
742
|
+
'error',
|
|
743
|
+
'after',
|
|
744
|
+
{ overrides: { '?': 'before', ':': 'before' } },
|
|
745
|
+
],
|
|
746
|
+
|
|
747
|
+
// disallow padding within blocks
|
|
748
|
+
'@stylistic-eslint/padded-blocks': [
|
|
749
|
+
'error',
|
|
750
|
+
{
|
|
751
|
+
blocks: 'never',
|
|
752
|
+
classes: 'never',
|
|
753
|
+
switches: 'never',
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
allowSingleLineBlocks: true,
|
|
757
|
+
},
|
|
758
|
+
],
|
|
759
|
+
|
|
760
|
+
// Require or disallow padding lines between statements
|
|
761
|
+
'@stylistic-eslint/padding-line-between-statements': 'off',
|
|
762
|
+
|
|
763
|
+
// Disallow the use of Math.pow in favor of the ** operator
|
|
764
|
+
'prefer-exponentiation-operator': 'error',
|
|
765
|
+
|
|
766
|
+
'prefer-object-spread': 'error', // Prefer use of an object spread over Object.assign
|
|
767
|
+
|
|
768
|
+
// require quotes around object literal property names
|
|
769
|
+
'@stylistic-eslint/quote-props': [
|
|
770
|
+
'error',
|
|
771
|
+
'as-needed',
|
|
772
|
+
{ keywords: false, unnecessary: true, numbers: false },
|
|
773
|
+
],
|
|
774
|
+
|
|
775
|
+
// specify whether double or single quotes should be used
|
|
776
|
+
'@stylistic-eslint/quotes': ['error', 'single', { avoidEscape: true }],
|
|
777
|
+
|
|
778
|
+
// require or disallow use of semicolons instead of ASI
|
|
779
|
+
'@stylistic-eslint/semi': ['error', 'always'],
|
|
780
|
+
|
|
781
|
+
'@stylistic-eslint/no-extra-semi': 'error',
|
|
782
|
+
|
|
783
|
+
// enforce spacing before and after semicolons
|
|
784
|
+
'@stylistic-eslint/semi-spacing': [
|
|
785
|
+
'error',
|
|
786
|
+
{ before: false, after: true },
|
|
787
|
+
],
|
|
788
|
+
|
|
789
|
+
'@stylistic-eslint/semi-style': ['error', 'last'], // Enforce location of semicolons
|
|
790
|
+
|
|
791
|
+
// requires object keys to be sorted
|
|
792
|
+
'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
|
|
793
|
+
|
|
794
|
+
'sort-vars': 'off', // sort variables within the same declaration block
|
|
795
|
+
|
|
796
|
+
// require or disallow space before blocks
|
|
797
|
+
'@stylistic-eslint/space-before-blocks': 'error',
|
|
798
|
+
|
|
799
|
+
// require or disallow space before function opening parenthesis
|
|
800
|
+
'@stylistic-eslint/space-before-function-paren': [
|
|
801
|
+
'error',
|
|
802
|
+
{
|
|
803
|
+
anonymous: 'always',
|
|
804
|
+
named: 'never',
|
|
805
|
+
asyncArrow: 'always',
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
|
|
809
|
+
// require or disallow spaces inside parentheses
|
|
810
|
+
'@stylistic-eslint/space-in-parens': ['error', 'never'],
|
|
811
|
+
|
|
812
|
+
'@stylistic-eslint/space-infix-ops': 'error', // require spaces around operators
|
|
813
|
+
|
|
814
|
+
// Require or disallow spaces before/after unary operators
|
|
815
|
+
'@stylistic-eslint/space-unary-ops': [
|
|
816
|
+
'error',
|
|
817
|
+
{
|
|
818
|
+
words: true,
|
|
819
|
+
nonwords: false,
|
|
820
|
+
overrides: {},
|
|
821
|
+
},
|
|
822
|
+
],
|
|
823
|
+
|
|
824
|
+
// require or disallow a space immediately following the // or /* in a comment
|
|
825
|
+
'@stylistic-eslint/spaced-comment': [
|
|
826
|
+
'error',
|
|
827
|
+
'always',
|
|
828
|
+
{
|
|
829
|
+
line: {
|
|
830
|
+
exceptions: ['-', '+'],
|
|
831
|
+
markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments
|
|
832
|
+
},
|
|
833
|
+
block: {
|
|
834
|
+
exceptions: ['-', '+'],
|
|
835
|
+
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
|
|
836
|
+
balanced: true,
|
|
837
|
+
},
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
|
|
841
|
+
// Enforce spacing around colons of switch statements
|
|
842
|
+
'@stylistic-eslint/switch-colon-spacing': [
|
|
843
|
+
'error',
|
|
844
|
+
{ after: true, before: false },
|
|
845
|
+
],
|
|
846
|
+
|
|
847
|
+
// Require or disallow spacing between template tags and their literals
|
|
848
|
+
'@stylistic-eslint/template-tag-spacing': ['error', 'never'],
|
|
849
|
+
|
|
850
|
+
'unicode-bom': ['error', 'never'], // require or disallow the Unicode Byte Order Mark
|
|
851
|
+
|
|
852
|
+
'@stylistic-eslint/wrap-regex': 'off', // require regex literals to be wrapped in parentheses
|
|
853
|
+
|
|
854
|
+
/* Enforce variables rules */
|
|
855
|
+
'init-declarations': 'off',
|
|
856
|
+
'no-array-constructor': 'off', // disallow use of the Array constructor - handle by typescript-eslint
|
|
857
|
+
'no-catch-shadow': 'off',
|
|
858
|
+
'no-delete-var': 'error',
|
|
859
|
+
'no-label-var': 'error',
|
|
860
|
+
'no-restricted-globals': [
|
|
861
|
+
'error',
|
|
862
|
+
{
|
|
863
|
+
name: 'isFinite',
|
|
864
|
+
message:
|
|
865
|
+
'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
name: 'isNaN',
|
|
869
|
+
message:
|
|
870
|
+
'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
871
|
+
},
|
|
872
|
+
].concat(confusingBrowserGlobals),
|
|
873
|
+
|
|
874
|
+
'no-shadow': 0, // disallow declaration of variables already declared in the outer scope
|
|
875
|
+
|
|
876
|
+
'no-shadow-restricted-names': 'error', // disallow shadowing of names such as arguments
|
|
877
|
+
|
|
878
|
+
'no-undef': 'error', // disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
879
|
+
|
|
880
|
+
'no-undef-init': 'error', // disallow use of undefined when initializing variables
|
|
881
|
+
|
|
882
|
+
// Alternative with no-undef-init , no-shadow-restricted-names, no-global-assign activated
|
|
883
|
+
'no-undefined': 'off', // disallow use of undefined variable
|
|
884
|
+
|
|
885
|
+
// disallow declaration of variables that are not used in the code - handle by typescript-eslint
|
|
886
|
+
'no-unused-vars': 'off',
|
|
887
|
+
|
|
888
|
+
// disallow use of variables before they are defined - handle by typescript-eslint
|
|
889
|
+
'no-use-before-define': 'off',
|
|
890
|
+
|
|
891
|
+
'no-restricted-syntax': [
|
|
892
|
+
'error',
|
|
893
|
+
{
|
|
894
|
+
selector:
|
|
895
|
+
"CallExpression[callee.name='setTimeout'][arguments.length!=2]",
|
|
896
|
+
message: 'setTimeout must always be invoked with two arguments.',
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
selector: 'LabeledStatement',
|
|
900
|
+
message:
|
|
901
|
+
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
selector: 'WithStatement',
|
|
905
|
+
message:
|
|
906
|
+
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
907
|
+
},
|
|
908
|
+
],
|
|
909
|
+
|
|
910
|
+
'@stylistic-eslint/comma-dangle': [
|
|
911
|
+
'error',
|
|
912
|
+
{
|
|
913
|
+
arrays: 'always-multiline',
|
|
914
|
+
enums: 'always-multiline',
|
|
915
|
+
exports: 'always-multiline',
|
|
916
|
+
functions: 'always-multiline',
|
|
917
|
+
generics: 'always-multiline',
|
|
918
|
+
imports: 'always-multiline',
|
|
919
|
+
objects: 'always-multiline',
|
|
920
|
+
tuples: 'always-multiline',
|
|
921
|
+
},
|
|
922
|
+
],
|
|
923
|
+
|
|
924
|
+
'@stylistic-eslint/max-len': [
|
|
925
|
+
'error',
|
|
926
|
+
{
|
|
927
|
+
code: 100,
|
|
928
|
+
comments: 110,
|
|
929
|
+
ignoreTemplateLiterals: true,
|
|
930
|
+
ignoreStrings: true,
|
|
931
|
+
},
|
|
932
|
+
],
|
|
933
|
+
'@typescript-eslint/naming-convention': [
|
|
934
|
+
'error',
|
|
935
|
+
{
|
|
936
|
+
selector: 'default',
|
|
937
|
+
format: ['camelCase'],
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
selector: 'default',
|
|
941
|
+
format: ['camelCase'],
|
|
942
|
+
modifiers: ['unused'],
|
|
943
|
+
leadingUnderscore: 'allow',
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
selector: 'variable', // variables that does not include _id or __ properties
|
|
947
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
948
|
+
filter: {
|
|
949
|
+
regex: "^(?!.*(__|'*_id)).*$",
|
|
950
|
+
match: true,
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
selector: 'variable', // variable with leadingUnderscore: 'allow',
|
|
955
|
+
format: null,
|
|
956
|
+
prefix: ['__'],
|
|
957
|
+
filter: {
|
|
958
|
+
regex: '^__',
|
|
959
|
+
match: true,
|
|
960
|
+
},
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
selector: 'variable', // _id or _id.index... variables
|
|
964
|
+
custom: {
|
|
965
|
+
regex: '^_id(\\.[a-z]+([A-Z][a-z]+)*)*',
|
|
966
|
+
match: true,
|
|
967
|
+
},
|
|
968
|
+
format: null,
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
selector: 'enumMember',
|
|
972
|
+
format: ['PascalCase'],
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
selector: 'enum',
|
|
976
|
+
format: ['PascalCase'],
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
selector: 'variable',
|
|
980
|
+
types: ['boolean'],
|
|
981
|
+
format: ['PascalCase'],
|
|
982
|
+
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
selector: 'parameter',
|
|
986
|
+
format: ['camelCase', 'PascalCase'],
|
|
987
|
+
leadingUnderscore: 'allow',
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
selector: 'parameterProperty',
|
|
991
|
+
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
992
|
+
leadingUnderscore: 'allow',
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
selector: 'memberLike', // leadingUnderscore: 'allow',
|
|
996
|
+
modifiers: ['protected'],
|
|
997
|
+
format: ['camelCase'],
|
|
998
|
+
prefix: ['_'],
|
|
999
|
+
filter: {
|
|
1000
|
+
regex: '^_',
|
|
1001
|
+
match: true,
|
|
1002
|
+
},
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
selector: 'memberLike', // leadingUnderscore: 'allow',
|
|
1006
|
+
modifiers: ['private'],
|
|
1007
|
+
format: ['camelCase'],
|
|
1008
|
+
prefix: ['__'],
|
|
1009
|
+
filter: {
|
|
1010
|
+
regex: '^__',
|
|
1011
|
+
match: true,
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
selector: 'memberLike', // all that is not including _id or __ properties
|
|
1016
|
+
format: ['camelCase', 'PascalCase'],
|
|
1017
|
+
filter: {
|
|
1018
|
+
regex: "^(?!.*(__|\\.|'*_id)).*$",
|
|
1019
|
+
match: true,
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
selector: 'memberLike', // _id or _id.index... properties
|
|
1024
|
+
custom: {
|
|
1025
|
+
regex:
|
|
1026
|
+
'((?<_idProperties>^_id(\\.[a-z]+([A-Z][a-z]+)*)*)|(?<double_snake>^([a-zA-Z0-9]+)(__([a-zA-Z0-9]+))+))',
|
|
1027
|
+
match: true,
|
|
1028
|
+
},
|
|
1029
|
+
format: null,
|
|
1030
|
+
},
|
|
1031
|
+
{
|
|
1032
|
+
selector: 'property', // Properties camelCase.camelCase
|
|
1033
|
+
format: null,
|
|
1034
|
+
filter: {
|
|
1035
|
+
regex:
|
|
1036
|
+
'(?<dot_camelCase>[a-z]+([A-Z][a-z]+)*(\\.[a-z]+([A-Z][a-z]+)*)*)',
|
|
1037
|
+
match: true,
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
selector: 'objectLiteralProperty', // object propertie .camelCase properties
|
|
1042
|
+
format: null,
|
|
1043
|
+
filter: {
|
|
1044
|
+
regex: '(?<start_with_dot_camelCase>(^\\.[a-z]+([A-Z][a-z]+)*)*)',
|
|
1045
|
+
match: true,
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
selector: 'objectLiteralProperty', // object propertie /camelCase properties
|
|
1050
|
+
format: null,
|
|
1051
|
+
filter: {
|
|
1052
|
+
regex: '(?<slash_camelCase>(^/[a-z]+([A-Z][a-z]+)*)*)',
|
|
1053
|
+
match: true,
|
|
1054
|
+
},
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
selector: 'property',
|
|
1058
|
+
filter: {
|
|
1059
|
+
regex: '(?<At_Properties>^@[a-zA-Z0-9]+(_[a-zA-Z0-9]+)*)',
|
|
1060
|
+
match: true,
|
|
1061
|
+
},
|
|
1062
|
+
format: null,
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
selector: 'property', // Properties $operator
|
|
1066
|
+
filter: {
|
|
1067
|
+
regex: '(?<$_operator>^$([a-zA-Z0-9]+))',
|
|
1068
|
+
match: true,
|
|
1069
|
+
},
|
|
1070
|
+
format: null,
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
selector: 'property',
|
|
1074
|
+
filter: {
|
|
1075
|
+
regex:
|
|
1076
|
+
'(?<snake_extendedCamelCase>^([a-zA-Z0-9]+)(_([a-zA-Z0-9]+))*)',
|
|
1077
|
+
match: true,
|
|
1078
|
+
},
|
|
1079
|
+
format: null,
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
selector: 'classProperty',
|
|
1083
|
+
format: ['camelCase'],
|
|
1084
|
+
prefix: ['__'],
|
|
1085
|
+
filter: {
|
|
1086
|
+
regex: '^__',
|
|
1087
|
+
match: true,
|
|
1088
|
+
},
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
selector: 'typeLike',
|
|
1092
|
+
format: ['PascalCase'],
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
selector: 'import',
|
|
1096
|
+
format: null,
|
|
1097
|
+
},
|
|
1098
|
+
],
|
|
1099
|
+
|
|
1100
|
+
'@typescript-eslint/strict-boolean-expressions': [
|
|
1101
|
+
'error',
|
|
1102
|
+
{
|
|
1103
|
+
allowString: false,
|
|
1104
|
+
allowNumber: false,
|
|
1105
|
+
allowNullableObject: false,
|
|
1106
|
+
allowNullableBoolean: true,
|
|
1107
|
+
allowNullableString: false,
|
|
1108
|
+
allowNullableNumber: false,
|
|
1109
|
+
allowAny: false,
|
|
1110
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
1111
|
+
},
|
|
1112
|
+
],
|
|
1113
|
+
'@stylistic-eslint/no-extra-parens': [
|
|
1114
|
+
'off',
|
|
1115
|
+
'all',
|
|
1116
|
+
{
|
|
1117
|
+
conditionalAssign: true,
|
|
1118
|
+
nestedBinaryExpressions: false,
|
|
1119
|
+
returnAssign: false,
|
|
1120
|
+
ignoreJSX: 'all', // delegate to eslint-plugin-react
|
|
1121
|
+
enforceForArrowConditionals: false,
|
|
1122
|
+
},
|
|
1123
|
+
],
|
|
1124
|
+
'@typescript-eslint/no-empty-function': [
|
|
1125
|
+
'error',
|
|
1126
|
+
{
|
|
1127
|
+
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
1128
|
+
},
|
|
1129
|
+
],
|
|
1130
|
+
'@stylistic-eslint/no-magic-numbers': [
|
|
1131
|
+
'off',
|
|
1132
|
+
{
|
|
1133
|
+
ignore: [],
|
|
1134
|
+
ignoreArrayIndexes: true,
|
|
1135
|
+
enforceConst: true,
|
|
1136
|
+
detectObjects: false,
|
|
1137
|
+
},
|
|
1138
|
+
],
|
|
1139
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
1140
|
+
'error',
|
|
1141
|
+
{
|
|
1142
|
+
allowShortCircuit: false,
|
|
1143
|
+
allowTernary: false,
|
|
1144
|
+
allowTaggedTemplates: false,
|
|
1145
|
+
},
|
|
1146
|
+
],
|
|
1147
|
+
'@typescript-eslint/no-unused-vars': [
|
|
1148
|
+
'error',
|
|
1149
|
+
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
|
|
1150
|
+
],
|
|
1151
|
+
'@typescript-eslint/no-use-before-define': [
|
|
1152
|
+
'error',
|
|
1153
|
+
{ functions: true, classes: true, variables: true },
|
|
1154
|
+
],
|
|
1155
|
+
|
|
1156
|
+
'@stylistic-eslint/adjacent-overload-signatures': 'off',
|
|
1157
|
+
'@typescript-eslint/array-type': ['error'],
|
|
1158
|
+
'@typescript-eslint/await-thenable': ['error'],
|
|
1159
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
1160
|
+
'error',
|
|
1161
|
+
{
|
|
1162
|
+
'ts-expect-error': 'allow-with-description',
|
|
1163
|
+
minimumDescriptionLength: 3,
|
|
1164
|
+
},
|
|
1165
|
+
],
|
|
1166
|
+
'@typescript-eslint/ban-tslint-comment': ['error'],
|
|
1167
|
+
'@typescript-eslint/no-restricted-types': 2,
|
|
1168
|
+
'@typescript-eslint/no-empty-object-type': 2,
|
|
1169
|
+
'@typescript-eslint/no-unsafe-function-type': 2,
|
|
1170
|
+
'@typescript-eslint/no-wrapper-object-types': 2,
|
|
1171
|
+
'@stylistic-eslint/brace-style': 'off',
|
|
1172
|
+
'@stylistic-eslint/class-literal-property-style': 'off',
|
|
1173
|
+
'@stylistic-eslint/comma-spacing': [
|
|
1174
|
+
'error',
|
|
1175
|
+
{ before: false, after: true },
|
|
1176
|
+
],
|
|
1177
|
+
'@typescript-eslint/consistent-generic-constructors': ['error'],
|
|
1178
|
+
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
1179
|
+
'@typescript-eslint/consistent-type-assertions': ['error'],
|
|
1180
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
1181
|
+
'@typescript-eslint/consistent-type-exports': 'off',
|
|
1182
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
1183
|
+
// Activate explicit-module-boundary-type as an alternative
|
|
1184
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
1185
|
+
'@typescript-eslint/explicit-member-accessibility': ['error'],
|
|
1186
|
+
'@typescript-eslint/explicit-module-boundary-types': 2,
|
|
1187
|
+
'@stylistic-eslint/func-call-spacing': ['error', 'never'],
|
|
1188
|
+
'@stylistic-eslint/indent': 0,
|
|
1189
|
+
'@stylistic-eslint/member-delimiter-style': ['error'],
|
|
1190
|
+
'@typescript-eslint/member-ordering': ['error'],
|
|
1191
|
+
'@typescript-eslint/method-signature-style': ['error'],
|
|
1192
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
1193
|
+
'@typescript-eslint/no-base-to-string': ['error'],
|
|
1194
|
+
'@typescript-eslint/no-confusing-non-null-assertion': ['error'],
|
|
1195
|
+
'@typescript-eslint/no-confusing-void-expression': ['error'],
|
|
1196
|
+
'@typescript-eslint/no-duplicate-enum-values': ['error'],
|
|
1197
|
+
'@typescript-eslint/no-dupe-class-members': 0, // automatically checked by the TypeScript compiler
|
|
1198
|
+
'@typescript-eslint/no-dynamic-delete': ['error'],
|
|
1199
|
+
'@typescript-eslint/no-empty-interface': ['error'],
|
|
1200
|
+
'@typescript-eslint/no-explicit-any': [2],
|
|
1201
|
+
'@typescript-eslint/no-extra-non-null-assertion': ['error'],
|
|
1202
|
+
'@typescript-eslint/no-extraneous-class': ['error'],
|
|
1203
|
+
'@typescript-eslint/no-floating-promises': ['error'],
|
|
1204
|
+
'@typescript-eslint/no-for-in-array': ['error'],
|
|
1205
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
1206
|
+
'@typescript-eslint/no-inferrable-types': ['error'],
|
|
1207
|
+
'@typescript-eslint/no-invalid-void-type': ['error'],
|
|
1208
|
+
'@typescript-eslint/no-meaningless-void-operator': ['error'],
|
|
1209
|
+
'@typescript-eslint/no-misused-new': ['error'],
|
|
1210
|
+
'@typescript-eslint/no-misused-promises': ['error'],
|
|
1211
|
+
'@typescript-eslint/no-namespace': ['error'],
|
|
1212
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': ['error'],
|
|
1213
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
|
|
1214
|
+
'@typescript-eslint/no-non-null-assertion': ['error'],
|
|
1215
|
+
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
|
1216
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
1217
|
+
'@typescript-eslint/no-this-alias': ['error'],
|
|
1218
|
+
'@typescript-eslint/only-throw-error': 'error',
|
|
1219
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
|
|
1220
|
+
'@typescript-eslint/no-unnecessary-condition': ['error'],
|
|
1221
|
+
'@typescript-eslint/no-unnecessary-qualifier': ['error'],
|
|
1222
|
+
'@typescript-eslint/no-unnecessary-type-arguments': ['error'],
|
|
1223
|
+
'@typescript-eslint/no-unnecessary-type-assertion': ['error'],
|
|
1224
|
+
'@typescript-eslint/no-unnecessary-type-constraint': ['error'],
|
|
1225
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
1226
|
+
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
1227
|
+
'@typescript-eslint/no-unsafe-call': ['warn'],
|
|
1228
|
+
'@typescript-eslint/no-unsafe-member-access': [1],
|
|
1229
|
+
'@typescript-eslint/no-unsafe-return': ['warn'],
|
|
1230
|
+
'@typescript-eslint/no-useless-empty-export': 'off',
|
|
1231
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
1232
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
1233
|
+
'@typescript-eslint/non-nullable-type-assertion-style': ['error'],
|
|
1234
|
+
'@typescript-eslint/parameter-properties': 'off',
|
|
1235
|
+
'@typescript-eslint/prefer-as-const': ['error'],
|
|
1236
|
+
'@typescript-eslint/prefer-enum-initializers': ['error'],
|
|
1237
|
+
'@typescript-eslint/prefer-for-of': ['error'],
|
|
1238
|
+
'@typescript-eslint/prefer-function-type': ['error'],
|
|
1239
|
+
'@typescript-eslint/prefer-includes': ['error'],
|
|
1240
|
+
'@typescript-eslint/prefer-literal-enum-member': ['error'],
|
|
1241
|
+
'@typescript-eslint/prefer-namespace-keyword': ['error'],
|
|
1242
|
+
'@typescript-eslint/prefer-nullish-coalescing': ['error'],
|
|
1243
|
+
'@typescript-eslint/prefer-optional-chain': ['error'],
|
|
1244
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off', // ['error'],
|
|
1245
|
+
'@typescript-eslint/prefer-readonly': 'off',
|
|
1246
|
+
'@typescript-eslint/prefer-reduce-type-parameter': ['error'],
|
|
1247
|
+
'@typescript-eslint/prefer-regexp-exec': ['error'],
|
|
1248
|
+
'@typescript-eslint/prefer-return-this-type': ['error'],
|
|
1249
|
+
'@typescript-eslint/prefer-string-starts-ends-with': ['error'],
|
|
1250
|
+
'@typescript-eslint/promise-function-async': ['error'],
|
|
1251
|
+
'@typescript-eslint/require-array-sort-compare': ['error'],
|
|
1252
|
+
'@typescript-eslint/restrict-plus-operands': ['error'],
|
|
1253
|
+
'@typescript-eslint/restrict-template-expressions': ['error'],
|
|
1254
|
+
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
|
|
1255
|
+
'@typescript-eslint/triple-slash-reference': ['error'],
|
|
1256
|
+
'@stylistic-eslint/type-annotation-spacing': ['error'],
|
|
1257
|
+
'@typescript-eslint/typedef': 'off',
|
|
1258
|
+
'@typescript-eslint/unbound-method': ['error'],
|
|
1259
|
+
'@typescript-eslint/unified-signatures': ['error'],
|
|
1260
|
+
|
|
1261
|
+
'brace-style': 'off',
|
|
1262
|
+
'func-style': ['error', 'declaration'],
|
|
1263
|
+
|
|
1264
|
+
'no-continue': 1,
|
|
1265
|
+
|
|
1266
|
+
'jsdoc/require-param-description': 0,
|
|
1267
|
+
'jsdoc/require-param-type': 0,
|
|
1268
|
+
'jsdoc/require-param': 0,
|
|
1269
|
+
'jsdoc/require-returns-type': 0,
|
|
1270
|
+
'jsdoc/require-returns': 0,
|
|
1271
|
+
'jsdoc/require-yields': 0,
|
|
1272
|
+
|
|
1273
|
+
camelcase: 'off',
|
|
1274
|
+
|
|
1275
|
+
indent: 'off',
|
|
1276
|
+
|
|
1277
|
+
'sonarjs/no-duplicate-string': 'error',
|
|
1278
|
+
// Lot of new rules, we disable them for now
|
|
1279
|
+
'sonarjs/concise-regex': 0,
|
|
1280
|
+
'sonarjs/default-param-last': 0,
|
|
1281
|
+
'sonarjs/deprecation': 0,
|
|
1282
|
+
'sonarjs/duplicates-in-character-class': 0,
|
|
1283
|
+
'sonarjs/function-return-type': 0,
|
|
1284
|
+
'sonarjs/hashing': 0,
|
|
1285
|
+
'sonarjs/no-base-to-string': 0,
|
|
1286
|
+
'sonarjs/no-commented-code': 0,
|
|
1287
|
+
'sonarjs/no-dead-store': 0,
|
|
1288
|
+
'sonarjs/no-duplicate-string': 1,
|
|
1289
|
+
'sonarjs/no-empty-function': 0,
|
|
1290
|
+
'sonarjs/no-hardcoded-credentials': 0,
|
|
1291
|
+
'sonarjs/no-ignored-exceptions': 0,
|
|
1292
|
+
'sonarjs/no-incomplete-assertions': 0,
|
|
1293
|
+
'sonarjs/no-misused-promises': 0,
|
|
1294
|
+
'sonarjs/no-nested-functions': 0,
|
|
1295
|
+
'sonarjs/no-redundant-optional': 0,
|
|
1296
|
+
'sonarjs/no-redundant-type-constituents': 0,
|
|
1297
|
+
'sonarjs/no-useless-intersection': 0,
|
|
1298
|
+
'sonarjs/prefer-for-of': 0,
|
|
1299
|
+
'sonarjs/pseudo-random': 0,
|
|
1300
|
+
'sonarjs/redundant-type-aliases': 0,
|
|
1301
|
+
'sonarjs/single-character-alternation': 0,
|
|
1302
|
+
'sonarjs/slow-regex': 0,
|
|
1303
|
+
'sonarjs/sonar-no-control-regex': 0,
|
|
1304
|
+
'sonarjs/sonar-no-unused-vars': 0,
|
|
1305
|
+
'sonarjs/todo-tag': 0,
|
|
1306
|
+
},
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
|
1310
|
+
plugins: {
|
|
1311
|
+
'@typescript-eslint': typescript,
|
|
1312
|
+
jsdoc,
|
|
1313
|
+
'@stylistic-eslint': stylistic,
|
|
1314
|
+
'react-hooks': reactHooksPlugin,
|
|
1315
|
+
sonarjs,
|
|
1316
|
+
},
|
|
1317
|
+
rules: {
|
|
1318
|
+
// Disable `no-undef` rule within TypeScript files because it incorrectly
|
|
1319
|
+
// errors when exporting default interfaces
|
|
1320
|
+
// https://github.com/iamturns/eslint-config-airbnb-typescript/issues/50
|
|
1321
|
+
// This will be caught by TypeScript compiler if `strictNullChecks` (or `strict`) is enabled
|
|
1322
|
+
'no-undef': 'off',
|
|
1323
|
+
|
|
1324
|
+
/* Using TypeScript makes it safe enough to disable the checks below */
|
|
1325
|
+
|
|
1326
|
+
'@typescript-eslint/default-param-last': 'error',
|
|
1327
|
+
'dot-notation': 0,
|
|
1328
|
+
'@typescript-eslint/dot-notation': 'error',
|
|
1329
|
+
'@typescript-eslint/no-misused-promises': 'error',
|
|
1330
|
+
'default-param-last': 0,
|
|
1331
|
+
'implicit-arrow-linebreak': 'error',
|
|
1332
|
+
|
|
1333
|
+
'jsdoc/check-tag-names': 0,
|
|
1334
|
+
'jsdoc/no-undefined-types': 0,
|
|
1335
|
+
'jsdoc/require-jsdoc': 2,
|
|
1336
|
+
'jsdoc/require-param-description': 0,
|
|
1337
|
+
'jsdoc/require-param-type': 0,
|
|
1338
|
+
'jsdoc/require-param': 0,
|
|
1339
|
+
'jsdoc/require-property-name': 0,
|
|
1340
|
+
'jsdoc/require-property-type': 0,
|
|
1341
|
+
'jsdoc/require-returns': 0,
|
|
1342
|
+
'@stylistic-eslint/jsx-one-expression-per-line': 0,
|
|
1343
|
+
'@stylistic-eslint/jsx-props-no-spreading': 0,
|
|
1344
|
+
|
|
1345
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
1346
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
1347
|
+
'sonarjs/no-identical-functions': 'error',
|
|
1348
|
+
'sonarjs/no-redundant-jump': 'error',
|
|
1349
|
+
'sonarjs/no-collapsible-if': 'error',
|
|
1350
|
+
},
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
files: [
|
|
1354
|
+
'**/*.config.js',
|
|
1355
|
+
'**/*.config.cjs',
|
|
1356
|
+
'**/packages/eslint-config-*/index.js',
|
|
1357
|
+
],
|
|
1358
|
+
plugins: {
|
|
1359
|
+
'@typescript-eslint': typescript,
|
|
1360
|
+
'@stylistic-eslint': stylistic,
|
|
1361
|
+
sonarjs,
|
|
1362
|
+
},
|
|
1363
|
+
rules: {
|
|
1364
|
+
'@stylistic-eslint/max-len': 0,
|
|
1365
|
+
'@typescript-eslint/naming-convention': 0,
|
|
1366
|
+
'sonarjs/no-duplicate-string': 0,
|
|
1367
|
+
'no-dupe-keys': 0,
|
|
1368
|
+
'no-undef': 0,
|
|
1369
|
+
},
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
files: ['**/*.tsx'],
|
|
1373
|
+
rules: {
|
|
1374
|
+
'func-style': 0,
|
|
1375
|
+
},
|
|
1376
|
+
},
|
|
1377
|
+
// Additional for projects or packages files
|
|
1378
|
+
{
|
|
1379
|
+
files: [
|
|
1380
|
+
'packages/**/*.ts',
|
|
1381
|
+
'packages/**/*.tsx',
|
|
1382
|
+
'projects/**/*.js',
|
|
1383
|
+
'projects/**/*.ts',
|
|
1384
|
+
'projects/**/*.tsx',
|
|
1385
|
+
'vite.config.ts',
|
|
1386
|
+
],
|
|
1387
|
+
plugins: {
|
|
1388
|
+
n,
|
|
1389
|
+
'@typescript-eslint': typescript,
|
|
1390
|
+
'@stylistic-eslint': stylistic,
|
|
1391
|
+
jsdoc,
|
|
1392
|
+
},
|
|
1393
|
+
ignores: ['**/*.test.ts'],
|
|
1394
|
+
rules: {
|
|
1395
|
+
'@stylistic-eslint/function-paren-newline': [
|
|
1396
|
+
'error',
|
|
1397
|
+
'multiline-arguments',
|
|
1398
|
+
],
|
|
1399
|
+
'n/file-extension-in-import': ['error', 'always'],
|
|
1400
|
+
|
|
1401
|
+
'@typescript-eslint/camelcase': 0,
|
|
1402
|
+
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
1403
|
+
'@typescript-eslint/no-unsafe-return': 0,
|
|
1404
|
+
'jsdoc/require-param-description': 0,
|
|
1405
|
+
'jsdoc/require-param-type': 0,
|
|
1406
|
+
'jsdoc/require-param': 0,
|
|
1407
|
+
'jsdoc/require-returns-type': 0,
|
|
1408
|
+
'jsdoc/require-returns': 0,
|
|
1409
|
+
'jsdoc/require-yields': 0,
|
|
1410
|
+
'@stylistic-eslint/jsx-one-expression-per-line': 0,
|
|
1411
|
+
'@typescript-eslint/no-misused-promises': ['error'],
|
|
1412
|
+
'@typescript-eslint/no-unsafe-call': 2,
|
|
1413
|
+
'@typescript-eslint/consistent-type-exports': 'error',
|
|
1414
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
1415
|
+
2,
|
|
1416
|
+
{
|
|
1417
|
+
fixStyle: 'inline-type-imports',
|
|
1418
|
+
},
|
|
1419
|
+
],
|
|
1420
|
+
},
|
|
1421
|
+
},
|
|
1422
|
+
|
|
1423
|
+
// Additional config for test files
|
|
1424
|
+
{
|
|
1425
|
+
files: ['**/*.test.tsx', '**/*.test.ts'],
|
|
1426
|
+
plugins: {
|
|
1427
|
+
sonarjs,
|
|
1428
|
+
jsdoc,
|
|
1429
|
+
},
|
|
1430
|
+
rules: {
|
|
1431
|
+
'jsdoc/require-jsdoc': 2,
|
|
1432
|
+
'jsdoc/check-tag-names': 0,
|
|
1433
|
+
'sonarjs/no-duplicate-string': 1,
|
|
1434
|
+
'no-undef': 0,
|
|
1435
|
+
},
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
files: [
|
|
1439
|
+
'**/__mocks__/**/*.ts',
|
|
1440
|
+
'src/backend/mongodb/seeds/collections/*.ts',
|
|
1441
|
+
],
|
|
1442
|
+
rules: {
|
|
1443
|
+
'jsdoc/require-jsdoc': 0,
|
|
1444
|
+
},
|
|
1445
|
+
},
|
|
1446
|
+
// Additionnal for css files
|
|
1447
|
+
{
|
|
1448
|
+
files: ['**/*.css.ts'],
|
|
1449
|
+
plugins: {
|
|
1450
|
+
'@typescript-eslint': typescript,
|
|
1451
|
+
},
|
|
1452
|
+
rules: {
|
|
1453
|
+
'@typescript-eslint/no-unsafe-call': 0,
|
|
1454
|
+
},
|
|
1455
|
+
},
|
|
1456
|
+
// Additional for storybook files
|
|
1457
|
+
{
|
|
1458
|
+
files: ['stories/**'],
|
|
1459
|
+
rules: {
|
|
1460
|
+
'implicit-arrow-linebreak': 0,
|
|
1461
|
+
'arrow-body-style': 0,
|
|
1462
|
+
},
|
|
1463
|
+
},
|
|
1464
|
+
];
|