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