@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.
Files changed (4) hide show
  1. package/README.md +23 -0
  2. package/index.js +1251 -1233
  3. package/package.json +11 -8
  4. 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
- export default [
12
- // Global exclusion
13
- {
14
- ignores: [
15
- // Common ignores
16
- '**/__generated__/**',
17
- '**/__mocks__/**',
18
- '**/__snapshots__/**',
19
- '**/coverage/**',
20
- '**/dist/**',
21
- '**/generated/**',
22
- '**/i18next-parser.config.cjs',
23
- '**/lint-staged.config.cjs',
24
- '**/node_modules/**',
25
- '**/packages/**/lib/**',
26
- '**/pino-pretty.config.js',
27
- '**/schema/**',
28
- '**/.docusaurus/**',
29
- '/website/**',
30
- '/.build-*/**',
31
- '/data',
32
- '/docker',
33
- 'tools/**',
34
- 'docs/api/**',
35
- '.remarkrc.mjs',
36
- ],
37
- },
38
- {
39
- plugins: {
40
- '@typescript-eslint': typescript,
41
- '@stylistic-eslint': stylistic,
42
- sonarjs,
43
- jsdoc,
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
- languageOptions: {
46
- ecmaVersion: 6,
47
- sourceType: 'module',
48
- parser: typescriptParser,
49
- parserOptions: {
50
- project: './tsconfig.eslint.json',
51
- ecmaFeatures: {
52
- jsx: true,
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
- linterOptions: {
57
- reportUnusedDisableDirectives: true,
58
- },
65
+ linterOptions: {
66
+ reportUnusedDisableDirectives: true,
67
+ },
59
68
 
60
- settings: {
61
- n: {
62
- typescriptExtensionMap: [
63
- ['', '.js'],
64
- ['.ts', '.js'],
65
- ['.cts', '.cjs'],
66
- ['.mts', '.mjs'],
67
- ['.tsx', '.js'],
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
- /* 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
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
- 'array-callback-return': ['error', { allowImplicit: true }], // enforces return statements in callbacks of array's methods
85
+ 'array-callback-return': ['error', { allowImplicit: true }], // enforces return statements in callbacks of array's methods
77
86
 
78
- 'block-scoped-var': 'error', // treat var statements as if they were block scoped
87
+ 'block-scoped-var': 'error', // treat var statements as if they were block scoped
79
88
 
80
- complexity: ['off', 20], // specify the maximum cyclomatic complexity allowed in a program
89
+ complexity: ['off', 20], // specify the maximum cyclomatic complexity allowed in a program
81
90
 
82
- // enforce that class methods use "this"
83
- 'class-methods-use-this': [
84
- 2,
85
- {
86
- exceptMethods: [],
87
- },
88
- ],
91
+ // enforce that class methods use "this"
92
+ 'class-methods-use-this': [
93
+ 2,
94
+ {
95
+ exceptMethods: [],
96
+ },
97
+ ],
89
98
 
90
- // require return statements to either always or never specify values
91
- 'consistent-return': 'error',
99
+ // require return statements to either always or never specify values
100
+ 'consistent-return': 'error',
92
101
 
93
- // specify curly brace conventions for all control statements
94
- curly: ['error', 'multi-line'], // multiline
102
+ // specify curly brace conventions for all control statements
103
+ curly: ['error', 'multi-line'], // multiline
95
104
 
96
- // require default case in switch statements
97
- 'default-case': ['error', { commentPattern: '^no default$' }],
105
+ // require default case in switch statements
106
+ 'default-case': ['error', { commentPattern: '^no default$' }],
98
107
 
99
- 'default-case-last': 'error', // Enforce default clauses in switch statements to be last
108
+ 'default-case-last': 'error', // Enforce default clauses in switch statements to be last
100
109
 
101
- 'default-param-last': 'error',
110
+ 'default-param-last': 'error',
102
111
 
103
- 'dot-notation': ['error', { allowKeywords: true }], // encourages use of dot notation whenever possible
112
+ 'dot-notation': ['error', { allowKeywords: true }], // encourages use of dot notation whenever possible
104
113
 
105
- 'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots
114
+ 'dot-location': ['error', 'property'], // enforces consistent newlines before or after dots
106
115
 
107
- eqeqeq: ['error', 'always', { null: 'ignore' }], // require the use of === and !==
116
+ eqeqeq: ['error', 'always', { null: 'ignore' }], // require the use of === and !==
108
117
 
109
- // Require grouped accessor pairs in object literals and classes
110
- 'grouped-accessor-pairs': 'error',
118
+ // Require grouped accessor pairs in object literals and classes
119
+ 'grouped-accessor-pairs': 'error',
111
120
 
112
- // make sure for-in loops have an if statement
113
- 'guard-for-in': 0,
121
+ // make sure for-in loops have an if statement
122
+ 'guard-for-in': 0,
114
123
 
115
- 'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file
124
+ 'max-classes-per-file': ['error', 1], // enforce a maximum number of classes per file
116
125
 
117
- 'no-alert': 2, // disallow the use of alert, confirm, and prompt
126
+ 'no-alert': 2, // disallow the use of alert, confirm, and prompt
118
127
 
119
- 'no-caller': 'error', // disallow use of arguments.caller or arguments.callee
128
+ 'no-caller': 'error', // disallow use of arguments.caller or arguments.callee
120
129
 
121
- 'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses
130
+ 'no-case-declarations': 'error', // disallow lexical declarations in case/default clauses
122
131
 
123
- 'no-constructor-return': 'error', // Disallow returning value in constructor
132
+ 'no-constructor-return': 'error', // Disallow returning value in constructor
124
133
 
125
- // disallow division operators explicitly at beginning of regular expression
126
- 'no-div-regex': 'off',
134
+ // disallow division operators explicitly at beginning of regular expression
135
+ 'no-div-regex': 'off',
127
136
 
128
- // disallow else after a return in an if
129
- 'no-else-return': ['error', { allowElseIf: false }],
137
+ // disallow else after a return in an if
138
+ 'no-else-return': ['error', { allowElseIf: false }],
130
139
 
131
- 'no-empty-function': 0, // disallow empty functions,- handle by typescript-eslint
140
+ 'no-empty-function': 0, // disallow empty functions,- handle by typescript-eslint
132
141
 
133
- 'no-empty-pattern': 'error', // disallow empty destructuring patterns
142
+ 'no-empty-pattern': 'error', // disallow empty destructuring patterns
134
143
 
135
- 'no-eq-null': 'off', // disallow comparisons to null without a type-checking operator
144
+ 'no-eq-null': 'off', // disallow comparisons to null without a type-checking operator
136
145
 
137
- 'no-eval': 'error', // disallow use of eval()
146
+ 'no-eval': 'error', // disallow use of eval()
138
147
 
139
- 'no-extend-native': 'error', // disallow adding to native types
148
+ 'no-extend-native': 'error', // disallow adding to native types
140
149
 
141
- 'no-extra-bind': 'error', // disallow unnecessary function binding
150
+ 'no-extra-bind': 'error', // disallow unnecessary function binding
142
151
 
143
- 'no-extra-label': 'error', // disallow Unnecessary Labels
152
+ 'no-extra-label': 'error', // disallow Unnecessary Labels
144
153
 
145
- 'no-fallthrough': 'error', // disallow fallthrough of case statements
154
+ 'no-fallthrough': 'error', // disallow fallthrough of case statements
146
155
 
147
- // disallow the use of leading or trailing decimal points in numeric literals
148
- 'no-floating-decimal': 'error',
156
+ // disallow the use of leading or trailing decimal points in numeric literals
157
+ 'no-floating-decimal': 'error',
149
158
 
150
- // disallow reassignments of native objects or read-only globals
151
- 'no-global-assign': ['error', { exceptions: [] }],
159
+ // disallow reassignments of native objects or read-only globals
160
+ 'no-global-assign': ['error', { exceptions: [] }],
152
161
 
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
- ],
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
- 'no-implicit-globals': 'off', // disallow var and named functions in global scope
173
+ 'no-implicit-globals': 'off', // disallow var and named functions in global scope
165
174
 
166
- 'no-implied-eval': 0, // disallow use of eval()-like methods
175
+ 'no-implied-eval': 0, // disallow use of eval()-like methods
167
176
 
168
- // disallow this keywords outside of classes or class-like objects - checked by TS compiler
169
- 'no-invalid-this': 'off',
177
+ // disallow this keywords outside of classes or class-like objects - checked by TS compiler
178
+ 'no-invalid-this': 'off',
170
179
 
171
- 'no-iterator': 'error', // disallow usage of __iterator__ property
180
+ 'no-iterator': 'error', // disallow usage of __iterator__ property
172
181
 
173
- // disallow use of labels for anything other than loops and switches
174
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
182
+ // disallow use of labels for anything other than loops and switches
183
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
175
184
 
176
- 'no-lone-blocks': 'error', // disallow unnecessary nested blocks
185
+ 'no-lone-blocks': 'error', // disallow unnecessary nested blocks
177
186
 
178
- 'no-loop-func': 'error', // disallow creation of functions within loops
187
+ 'no-loop-func': 'error', // disallow creation of functions within loops
179
188
 
180
- // disallow use of multiple spaces
181
- 'no-multi-spaces': [
182
- 'error',
183
- {
184
- ignoreEOLComments: false,
185
- },
186
- ],
189
+ // disallow use of multiple spaces
190
+ 'no-multi-spaces': [
191
+ 'error',
192
+ {
193
+ ignoreEOLComments: false,
194
+ },
195
+ ],
187
196
 
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
- ],
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
- 'no-proto': 'error', // disallow usage of __proto__ property
237
+ 'no-proto': 'error', // disallow usage of __proto__ property
229
238
 
230
- 'no-redeclare': 'error', // disallow declaring the same variable more than once
239
+ 'no-redeclare': 'error', // disallow declaring the same variable more than once
231
240
 
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
- ],
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
- // disallow use of assignment in return statement
286
- 'no-return-assign': ['error', 'always'],
294
+ // disallow use of assignment in return statement
295
+ 'no-return-assign': ['error', 'always'],
287
296
 
288
- 'no-return-await': 'error', // disallow redundant `return await`
297
+ 'no-return-await': 'error', // disallow redundant `return await`
289
298
 
290
- 'no-script-url': 'error', // disallow use of `javascript:` urls.
299
+ 'no-script-url': 'error', // disallow use of `javascript:` urls.
291
300
 
292
- // disallow self assignment
293
- 'no-self-assign': [
294
- 'error',
295
- {
296
- props: true,
297
- },
298
- ],
301
+ // disallow self assignment
302
+ 'no-self-assign': [
303
+ 'error',
304
+ {
305
+ props: true,
306
+ },
307
+ ],
299
308
 
300
- 'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same
309
+ 'no-self-compare': 'error', // disallow comparisons where both sides are exactly the same
301
310
 
302
- 'no-sequences': 'error', // disallow use of comma operator
311
+ 'no-sequences': 'error', // disallow use of comma operator
303
312
 
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
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
- // disallow unmodified conditions of loops
308
- 'no-unmodified-loop-condition': 'off',
316
+ // disallow unmodified conditions of loops
317
+ 'no-unmodified-loop-condition': 'off',
309
318
 
310
- // disallow usage of expressions in statement position - handle by typescript-eslint
311
- 'no-unused-expressions': 0,
319
+ // disallow usage of expressions in statement position - handle by typescript-eslint
320
+ 'no-unused-expressions': 0,
312
321
 
313
- 'no-unused-labels': 'error', // disallow unused labels
322
+ 'no-unused-labels': 'error', // disallow unused labels
314
323
 
315
- 'no-useless-call': 'off', // disallow unnecessary .call() and .apply()
324
+ 'no-useless-call': 'off', // disallow unnecessary .call() and .apply()
316
325
 
317
- 'no-useless-catch': 'error', // Disallow unnecessary catch clauses
326
+ 'no-useless-catch': 'error', // Disallow unnecessary catch clauses
318
327
 
319
- 'no-useless-concat': 'error', // disallow useless string concatenation
328
+ 'no-useless-concat': 'error', // disallow useless string concatenation
320
329
 
321
- 'no-useless-escape': 'error', // disallow unnecessary string escaping
330
+ 'no-useless-escape': 'error', // disallow unnecessary string escaping
322
331
 
323
- 'no-useless-return': 'error', // disallow redundant return; keywords
332
+ 'no-useless-return': 'error', // disallow redundant return; keywords
324
333
 
325
- 'no-void': 'error', // disallow use of void operator
334
+ 'no-void': 'error', // disallow use of void operator
326
335
 
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
- ],
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
- 'no-with': 'error', // disallow use of the with statement
342
+ 'no-with': 'error', // disallow use of the with statement
334
343
 
335
- // require using Error objects as Promise rejection reasons
336
- 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
344
+ // require using Error objects as Promise rejection reasons
345
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
337
346
 
338
- // Suggest using named capture group in regular expression
339
- 'prefer-named-capture-group': 'off',
347
+ // Suggest using named capture group in regular expression
348
+ 'prefer-named-capture-group': 'off',
340
349
 
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',
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
- // Disallow use of the RegExp constructor in favor of regular expression literals
346
- 'prefer-regex-literals': [
347
- 'error',
348
- {
349
- disallowRedundantWrapping: true,
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
- radix: 'error', // require use of the second argument for parseInt()
362
+ radix: 'error', // require use of the second argument for parseInt()
354
363
 
355
- // require `await` in `async function` (note: this is a horrible rule that should never be used)
356
- 'require-await': 'off',
364
+ // require `await` in `async function` (note: this is a horrible rule that should never be used)
365
+ 'require-await': 'off',
357
366
 
358
- // Enforce the use of u flag on RegExp
359
- 'require-unicode-regexp': 'off',
367
+ // Enforce the use of u flag on RegExp
368
+ 'require-unicode-regexp': 'off',
360
369
 
361
- 'vars-on-top': 'error', // requires to declare all vars on top of their containing scope
370
+ 'vars-on-top': 'error', // requires to declare all vars on top of their containing scope
362
371
 
363
- // require immediate function invocation to be wrapped in parentheses
364
- 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
372
+ // require immediate function invocation to be wrapped in parentheses
373
+ 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
365
374
 
366
- yoda: 'error', // require or disallow Yoda conditions
375
+ yoda: 'error', // require or disallow Yoda conditions
367
376
 
368
- /* Enforce Errors rules */
377
+ /* Enforce Errors rules */
369
378
 
370
- 'for-direction': 'error', // Enforce “for” loop update clause moving the counter in the right direction
379
+ 'for-direction': 'error', // Enforce “for” loop update clause moving the counter in the right direction
371
380
 
372
- 'getter-return': ['error', { allowImplicit: true }], // Enforces that a return statement is present in property getters
381
+ 'getter-return': ['error', { allowImplicit: true }], // Enforces that a return statement is present in property getters
373
382
 
374
- 'no-async-promise-executor': 'error', // disallow using an async function as a Promise executor
383
+ 'no-async-promise-executor': 'error', // disallow using an async function as a Promise executor
375
384
 
376
- 'no-await-in-loop': 0, // Disallow await inside of loops
385
+ 'no-await-in-loop': 0, // Disallow await inside of loops
377
386
 
378
- 'no-compare-neg-zero': 'error', // Disallow comparisons to negative zero
387
+ 'no-compare-neg-zero': 'error', // Disallow comparisons to negative zero
379
388
 
380
- 'no-cond-assign': ['error', 'always'], // disallow assignment in conditional expressions
389
+ 'no-cond-assign': ['error', 'always'], // disallow assignment in conditional expressions
381
390
 
382
- 'no-console': 'warn', // disallow use of console
391
+ 'no-console': 'warn', // disallow use of console
383
392
 
384
- 'no-constant-binary-expression': 2, // Disallows expressions where the operation doesn't affect the value
393
+ 'no-constant-binary-expression': 2, // Disallows expressions where the operation doesn't affect the value
385
394
 
386
- 'no-constant-condition': 'warn', // disallow use of constant expressions in conditions
395
+ 'no-constant-condition': 'warn', // disallow use of constant expressions in conditions
387
396
 
388
- 'no-control-regex': 'error', // disallow control characters in regular expressions
397
+ 'no-control-regex': 'error', // disallow control characters in regular expressions
389
398
 
390
- 'no-debugger': 'error', // disallow use of debugger
399
+ 'no-debugger': 'error', // disallow use of debugger
391
400
 
392
- 'no-dupe-args': 'error', // disallow duplicate arguments in functions
401
+ 'no-dupe-args': 'error', // disallow duplicate arguments in functions
393
402
 
394
- 'no-dupe-else-if': 'error', // Disallow duplicate conditions in if-else-if chains
403
+ 'no-dupe-else-if': 'error', // Disallow duplicate conditions in if-else-if chains
395
404
 
396
- 'no-dupe-keys': 'error', // disallow duplicate keys when creating object literals
405
+ 'no-dupe-keys': 'error', // disallow duplicate keys when creating object literals
397
406
 
398
- 'no-duplicate-case': 'error', // disallow a duplicate case label.
407
+ 'no-duplicate-case': 'error', // disallow a duplicate case label.
399
408
 
400
- 'no-empty': 'error', // disallow empty statements
409
+ 'no-empty': 'error', // disallow empty statements
401
410
 
402
- // disallow the use of empty character classes in regular expressions
403
- 'no-empty-character-class': 'error',
411
+ // disallow the use of empty character classes in regular expressions
412
+ 'no-empty-character-class': 'error',
404
413
 
405
- // disallow assigning to the exception in a catch block
406
- 'no-ex-assign': 'error',
414
+ // disallow assigning to the exception in a catch block
415
+ 'no-ex-assign': 'error',
407
416
 
408
- // disallow double-negation boolean casts in a boolean context
409
- 'no-extra-boolean-cast': 'error',
417
+ // disallow double-negation boolean casts in a boolean context
418
+ 'no-extra-boolean-cast': 'error',
410
419
 
411
- 'no-func-assign': 'error', // disallow overwriting functions written as function declarations
420
+ 'no-func-assign': 'error', // disallow overwriting functions written as function declarations
412
421
 
413
- 'no-import-assign': 'error', // Disallow assigning to imported bindings
422
+ 'no-import-assign': 'error', // Disallow assigning to imported bindings
414
423
 
415
- 'no-inner-declarations': 'error', // disallow function or variable declarations in nested blocks
424
+ 'no-inner-declarations': 'error', // disallow function or variable declarations in nested blocks
416
425
 
417
- 'no-invalid-regexp': 'error', // disallow invalid regular expression strings in the RegExp constructor
426
+ 'no-invalid-regexp': 'error', // disallow invalid regular expression strings in the RegExp constructor
418
427
 
419
- 'no-irregular-whitespace': 'error', // disallow irregular whitespace outside of strings and comments
428
+ 'no-irregular-whitespace': 'error', // disallow irregular whitespace outside of strings and comments
420
429
 
421
- 'no-loss-of-precision': 'error', // Disallow Number Literals That Lose Precision
430
+ 'no-loss-of-precision': 'error', // Disallow Number Literals That Lose Precision
422
431
 
423
- // Disallow characters which are made with multiple code points in character class syntax
424
- 'no-misleading-character-class': 'error',
432
+ // Disallow characters which are made with multiple code points in character class syntax
433
+ 'no-misleading-character-class': 'error',
425
434
 
426
- // disallow the use of object properties of the global object (Math and JSON) as functions
427
- 'no-obj-calls': 'error',
435
+ // disallow the use of object properties of the global object (Math and JSON) as functions
436
+ 'no-obj-calls': 'error',
428
437
 
429
- // Disallow returning values from Promise executor functions
430
- 'no-promise-executor-return': 'error',
438
+ // Disallow returning values from Promise executor functions
439
+ 'no-promise-executor-return': 'error',
431
440
 
432
- // disallow use of Object.prototypes builtins directly
433
- 'no-prototype-builtins': 'error',
441
+ // disallow use of Object.prototypes builtins directly
442
+ 'no-prototype-builtins': 'error',
434
443
 
435
- 'no-regex-spaces': 'error', // disallow multiple spaces in a regular expression literal
444
+ 'no-regex-spaces': 'error', // disallow multiple spaces in a regular expression literal
436
445
 
437
- 'no-setter-return': 'error', // Disallow returning values from setters
446
+ 'no-setter-return': 'error', // Disallow returning values from setters
438
447
 
439
- 'no-sparse-arrays': 'error', // disallow sparse arrays
448
+ 'no-sparse-arrays': 'error', // disallow sparse arrays
440
449
 
441
- // Disallow template literal placeholder syntax in regular strings
442
- 'no-template-curly-in-string': 'error',
450
+ // Disallow template literal placeholder syntax in regular strings
451
+ 'no-template-curly-in-string': 'error',
443
452
 
444
- // Avoid code that looks like two expressions but is actually one
445
- 'no-unexpected-multiline': 'error',
453
+ // Avoid code that looks like two expressions but is actually one
454
+ 'no-unexpected-multiline': 'error',
446
455
 
447
- // disallow unreachable statements after a return, throw, continue, or break statement
448
- 'no-unreachable': 'error',
456
+ // disallow unreachable statements after a return, throw, continue, or break statement
457
+ 'no-unreachable': 'error',
449
458
 
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
- ],
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
- 'no-unsafe-finally': 'error', // disallow return/throw/break/continue inside finally blocks
468
+ 'no-unsafe-finally': 'error', // disallow return/throw/break/continue inside finally blocks
460
469
 
461
- // disallow negating the left operand of relational operators
462
- 'no-unsafe-negation': 'error',
470
+ // disallow negating the left operand of relational operators
471
+ 'no-unsafe-negation': 'error',
463
472
 
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
- ],
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
- 'no-unused-private-class-members': 1, // Disallow Unused Private Class Members
479
+ 'no-unused-private-class-members': 1, // Disallow Unused Private Class Members
471
480
 
472
- 'no-useless-backreference': 'error', // Disallow useless backreferences in regular expressions
481
+ 'no-useless-backreference': 'error', // Disallow useless backreferences in regular expressions
473
482
 
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,
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
- 'use-isnan': 'error', // disallow comparisons with the value NaN
487
+ 'use-isnan': 'error', // disallow comparisons with the value NaN
479
488
 
480
- // ensure that the results of typeof are compared against a valid string
481
- 'valid-typeof': ['error', { requireStringLiterals: true }],
489
+ // ensure that the results of typeof are compared against a valid string
490
+ 'valid-typeof': ['error', { requireStringLiterals: true }],
482
491
 
483
- /* Enforce es6 rules */
484
- // enforces no braces where they can be omitted
485
- 'arrow-body-style': ['error', 'always'],
492
+ /* Enforce es6 rules */
493
+ // enforces no braces where they can be omitted
494
+ 'arrow-body-style': ['error', 'always'],
486
495
 
487
- 'arrow-parens': ['error', 'always'], // require parens in arrow function arguments
496
+ 'arrow-parens': ['error', 'always'], // require parens in arrow function arguments
488
497
 
489
- // require space before/after arrow function's arrow
490
- 'arrow-spacing': ['error', { before: true, after: true }],
498
+ // require space before/after arrow function's arrow
499
+ 'arrow-spacing': ['error', { before: true, after: true }],
491
500
 
492
- 'constructor-super': 'error', // verify super() callings in constructors
501
+ 'constructor-super': 'error', // verify super() callings in constructors
493
502
 
494
- // enforce the spacing around the * in generator functions
495
- 'generator-star-spacing': ['error', { before: false, after: true }],
503
+ // enforce the spacing around the * in generator functions
504
+ 'generator-star-spacing': ['error', { before: false, after: true }],
496
505
 
497
- 'no-class-assign': 'error', // disallow modifying variables of class declarations
506
+ 'no-class-assign': 'error', // disallow modifying variables of class declarations
498
507
 
499
- // disallow arrow functions where they could be confused with comparisons
500
- 'no-confusing-arrow': [
501
- 'error',
502
- {
503
- allowParens: true,
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
- 'no-const-assign': 'error', // disallow modifying variables that are declared using const
516
+ 'no-const-assign': 'error', // disallow modifying variables that are declared using const
508
517
 
509
- 'no-dupe-class-members': 0, // disallow duplicate class members - handle by typescript-eslint
518
+ 'no-dupe-class-members': 0, // disallow duplicate class members - handle by typescript-eslint
510
519
 
511
- 'no-duplicate-imports': 2, // disallow importing from the same path more than once
520
+ 'no-duplicate-imports': 2, // disallow importing from the same path more than once
512
521
 
513
- 'no-new-symbol': 'error', // disallow symbol constructor
522
+ 'no-new-symbol': 'error', // disallow symbol constructor
514
523
 
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
- ],
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
- // disallow specific imports
527
- 'no-restricted-imports': [
528
- 'off',
529
- {
530
- paths: [],
531
- patterns: [],
532
- },
533
- ],
535
+ // disallow specific imports
536
+ 'no-restricted-imports': [
537
+ 'off',
538
+ {
539
+ paths: [],
540
+ patterns: [],
541
+ },
542
+ ],
534
543
 
535
- 'no-this-before-super': 'error', // disallow to use this/super before super() calling in constructors.
544
+ 'no-this-before-super': 'error', // disallow to use this/super before super() calling in constructors.
536
545
 
537
- 'no-useless-computed-key': 'error', // disallow useless computed property keys
546
+ 'no-useless-computed-key': 'error', // disallow useless computed property keys
538
547
 
539
- 'no-useless-constructor': 0, // disallow unnecessary constructor - handle by typescript-eslint
548
+ 'no-useless-constructor': 0, // disallow unnecessary constructor - handle by typescript-eslint
540
549
 
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
+ // 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
- 'no-var': 'error', // require let or const instead of var
560
+ 'no-var': 'error', // require let or const instead of var
552
561
 
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
+ // 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
- // suggest using arrow functions as callbacks
564
- 'prefer-arrow-callback': [
565
- 'error',
566
- {
567
- allowNamedFunctions: false,
568
- allowUnboundThis: true,
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
- // 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
- ],
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
- // Prefer destructuring from arrays and objects
582
- 'prefer-destructuring': [
583
- 'error',
584
- {
585
- VariableDeclarator: {
586
- array: false,
587
- object: true,
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
- AssignmentExpression: {
590
- array: true,
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
- 'prefer-reflect': 'off', // suggest using Reflect methods where applicable
608
+ 'prefer-numeric-literals': 'error', // disallow parseInt() in favor of binary, octal, and hexadecimal literals
602
609
 
603
- 'prefer-rest-params': 'error', // use rest parameters instead of arguments
610
+ 'prefer-reflect': 'off', // suggest using Reflect methods where applicable
604
611
 
605
- 'prefer-spread': 'error', // suggest using the spread syntax instead of .apply()
612
+ 'prefer-rest-params': 'error', // use rest parameters instead of arguments
606
613
 
607
- 'prefer-template': 'error', // suggest using template literals instead of string concatenation
614
+ 'prefer-spread': 'error', // suggest using the spread syntax instead of .apply()
608
615
 
609
- 'require-yield': 'error', // disallow generator functions that do not have yield
616
+ 'prefer-template': 'error', // suggest using template literals instead of string concatenation
610
617
 
611
- 'rest-spread-spacing': ['error', 'never'], // enforce spacing between object rest-spread
618
+ 'require-yield': 'error', // disallow generator functions that do not have yield
612
619
 
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
- ],
620
+ 'rest-spread-spacing': ['error', 'never'], // enforce spacing between object rest-spread
623
621
 
624
- 'symbol-description': 'error', // require a Symbol description
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
- 'template-curly-spacing': 'error', // enforce usage of spacing in template strings
633
+ 'symbol-description': 'error', // require a Symbol description
627
634
 
628
- 'yield-star-spacing': ['error', 'after'], // enforce spacing around the * in yield* expressions
635
+ 'template-curly-spacing': 'error', // enforce usage of spacing in template strings
629
636
 
630
- /* Enforce node rules://eslint - https://eslint.org/docs/latest/rules/ */
637
+ 'yield-star-spacing': ['error', 'after'], // enforce spacing around the * in yield* expressions
631
638
 
632
- 'callback-return': 'off', // enforce return after a callback
639
+ /* Enforce node rules://eslint - https://eslint.org/docs/latest/rules/ */
633
640
 
634
- 'global-require': 'error', // require all requires be top-level
641
+ 'callback-return': 'off', // enforce return after a callback
635
642
 
636
- 'handle-callback-err': 'off', // enforces error handling in callbacks (node environment)
643
+ 'global-require': 'error', // require all requires be top-level
637
644
 
638
- 'no-buffer-constructor': 'error', // disallow use of the Buffer() constructor
645
+ 'handle-callback-err': 'off', // enforces error handling in callbacks (node environment)
639
646
 
640
- 'no-mixed-requires': ['off', false], // disallow mixing regular variable and require declarations
647
+ 'no-buffer-constructor': 'error', // disallow use of the Buffer() constructor
641
648
 
642
- 'no-new-require': 'error', // disallow use of new operator with the require function
649
+ 'no-mixed-requires': ['off', false], // disallow mixing regular variable and require declarations
643
650
 
644
- 'no-path-concat': 'error', // disallow string concatenation with __dirname and __filename
651
+ 'no-new-require': 'error', // disallow use of new operator with the require function
645
652
 
646
- 'no-process-env': 'off', // disallow use of process.env
653
+ 'no-path-concat': 'error', // disallow string concatenation with __dirname and __filename
647
654
 
648
- 'no-process-exit': 'off', // disallow process.exit()
655
+ 'no-process-env': 'off', // disallow use of process.env
649
656
 
650
- 'no-restricted-modules': 'off', // restrict usage of specified node modules
657
+ 'no-process-exit': 'off', // disallow process.exit()
651
658
 
652
- 'no-sync': 'off', // disallow use of synchronous methods (off by default)
659
+ 'no-restricted-modules': 'off', // restrict usage of specified node modules
653
660
 
654
- /* Enforce strict rules */
661
+ 'no-sync': 'off', // disallow use of synchronous methods (off by default)
655
662
 
656
- strict: ['error', 'never'], // babel inserts `'use strict';` for us
663
+ /* Enforce strict rules */
657
664
 
658
- /* Enforce style rules */
665
+ strict: ['error', 'never'], // babel inserts `'use strict';` for us
659
666
 
660
- 'no-ternary': ['error'], // disallow the use of ternary operators
667
+ /* Enforce style rules */
661
668
 
662
- // disallow trailing whitespace at the end of lines
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
- // 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
- ],
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
- // 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 }],
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
- // disallow whitespace before properties
687
- '@stylistic-eslint/no-whitespace-before-property': 2,
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
- // enforce the location of single-line statements
690
- 'nonblock-statement-body-position': [
691
- 'error',
692
- 'beside',
693
- { overrides: {} },
694
- ],
695
+ // disallow whitespace before properties
696
+ '@stylistic-eslint/no-whitespace-before-property': 2,
695
697
 
696
- '@stylistic-eslint/object-curly-spacing': ['error', 'always'], // require padding inside curly braces
698
+ // enforce the location of single-line statements
699
+ 'nonblock-statement-body-position': [
700
+ 'error',
701
+ 'beside',
702
+ { overrides: {} },
703
+ ],
697
704
 
698
- // enforce line breaks between braces
699
- 'object-curly-newline': [
700
- 0,
701
- {
702
- ObjectExpression: {
703
- minProperties: 4,
704
- multiline: true,
705
- consistent: true,
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
- 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
+ ],
732
733
 
733
- 'one-var': ['error', 'never'], // allow just one var statement per function
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
- 'one-var-declaration-per-line': ['error', 'always'], // require a newline around variable declaration
742
+ 'one-var': ['error', 'never'], // allow just one var statement per function
736
743
 
737
- // require assignment operator shorthand where possible or prohibit it entirely
738
- 'operator-assignment': ['error', 'always'],
744
+ 'one-var-declaration-per-line': ['error', 'always'], // require a newline around variable declaration
739
745
 
740
- '@stylistic-eslint/operator-linebreak': 0,
746
+ // require assignment operator shorthand where possible or prohibit it entirely
747
+ 'operator-assignment': ['error', 'always'],
741
748
 
742
- // disallow padding within blocks
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
- // Require or disallow padding lines between statements
756
- '@stylistic-eslint/padding-line-between-statements': 'off',
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
- // Disallow the use of Math.pow in favor of the ** operator
759
- 'prefer-exponentiation-operator': 'error',
764
+ // Require or disallow padding lines between statements
765
+ '@stylistic-eslint/padding-line-between-statements': 'off',
760
766
 
761
- 'prefer-object-spread': 'error', // Prefer use of an object spread over Object.assign
767
+ // Disallow the use of Math.pow in favor of the ** operator
768
+ 'prefer-exponentiation-operator': 'error',
762
769
 
763
- // require quotes around object literal property names
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
- // specify whether double or single quotes should be used
771
- '@stylistic-eslint/quotes': ['error', 'single', { avoidEscape: true }],
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
- // require or disallow use of semicolons instead of ASI
774
- '@stylistic-eslint/semi': ['error', 'always'],
779
+ // specify whether double or single quotes should be used
780
+ '@stylistic-eslint/quotes': ['error', 'single', { avoidEscape: true }],
775
781
 
776
- '@stylistic-eslint/no-extra-semi': 'error',
782
+ // require or disallow use of semicolons instead of ASI
783
+ '@stylistic-eslint/semi': ['error', 'always'],
777
784
 
778
- // enforce spacing before and after semicolons
779
- '@stylistic-eslint/semi-spacing': [
780
- 'error',
781
- { before: false, after: true },
782
- ],
785
+ '@stylistic-eslint/no-extra-semi': 'error',
783
786
 
784
- '@stylistic-eslint/semi-style': ['error', 'last'], // Enforce location of semicolons
787
+ // enforce spacing before and after semicolons
788
+ '@stylistic-eslint/semi-spacing': [
789
+ 'error',
790
+ { before: false, after: true },
791
+ ],
785
792
 
786
- // requires object keys to be sorted
787
- 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
793
+ '@stylistic-eslint/semi-style': ['error', 'last'], // Enforce location of semicolons
788
794
 
789
- 'sort-vars': 'off', // sort variables within the same declaration block
795
+ // requires object keys to be sorted
796
+ 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
790
797
 
791
- // require or disallow space before blocks
792
- '@stylistic-eslint/space-before-blocks': 'error',
798
+ 'sort-vars': 'off', // sort variables within the same declaration block
793
799
 
794
- // require or disallow space before function opening parenthesis
795
- '@stylistic-eslint/space-before-function-paren': [
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
- // require or disallow spaces inside parentheses
805
- '@stylistic-eslint/space-in-parens': ['error', 'never'],
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
- '@stylistic-eslint/space-infix-ops': 'error', // require spaces around operators
813
+ // require or disallow spaces inside parentheses
814
+ '@stylistic-eslint/space-in-parens': ['error', 'never'],
808
815
 
809
- // Require or disallow spaces before/after unary operators
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
- // require or disallow a space immediately following the // or /* in a comment
820
- '@stylistic-eslint/spaced-comment': [
821
- 'error',
822
- 'always',
823
- {
824
- line: {
825
- exceptions: ['-', '+'],
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
- block: {
829
- exceptions: ['-', '+'],
830
- markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
831
- balanced: true,
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
- // Enforce spacing around colons of switch statements
837
- '@stylistic-eslint/switch-colon-spacing': [
838
- 'error',
839
- { after: true, before: false },
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
- // Require or disallow spacing between template tags and their literals
843
- '@stylistic-eslint/template-tag-spacing': ['error', 'never'],
844
-
845
- 'unicode-bom': ['error', 'never'], // require or disallow the Unicode Byte Order Mark
846
-
847
- '@stylistic-eslint/wrap-regex': 'off', // require regex literals to be wrapped in parentheses
848
-
849
- /* Enforce variables rules */
850
- 'init-declarations': 'off',
851
- 'no-array-constructor': 'off', // disallow use of the Array constructor - handle by typescript-eslint
852
- 'no-catch-shadow': 'off',
853
- 'no-delete-var': 'error',
854
- 'no-label-var': 'error',
855
- 'no-restricted-globals': [
856
- 'error',
857
- {
858
- name: 'isFinite',
859
- message:
860
- 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
861
- },
862
- {
863
- name: 'isNaN',
864
- message:
865
- 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
866
- },
867
- ].concat(confusingBrowserGlobals),
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
- 'no-shadow': 0, // disallow declaration of variables already declared in the outer scope
878
+ 'no-shadow': 0, // disallow declaration of variables already declared in the outer scope
870
879
 
871
- 'no-shadow-restricted-names': 'error', // disallow shadowing of names such as arguments
880
+ 'no-shadow-restricted-names': 'error', // disallow shadowing of names such as arguments
872
881
 
873
- 'no-undef': 'error', // disallow use of undeclared variables unless mentioned in a /*global */ block
882
+ 'no-undef': 'error', // disallow use of undeclared variables unless mentioned in a /*global */ block
874
883
 
875
- 'no-undef-init': 'error', // disallow use of undefined when initializing variables
884
+ 'no-undef-init': 'error', // disallow use of undefined when initializing variables
876
885
 
877
- // Alternative with no-undef-init , no-shadow-restricted-names, no-global-assign activated
878
- 'no-undefined': 'off', // disallow use of undefined variable
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
- // disallow declaration of variables that are not used in the code - handle by typescript-eslint
881
- 'no-unused-vars': 'off',
889
+ // disallow declaration of variables that are not used in the code - handle by typescript-eslint
890
+ 'no-unused-vars': 'off',
882
891
 
883
- // disallow use of variables before they are defined - handle by typescript-eslint
884
- 'no-use-before-define': 'off',
892
+ // disallow use of variables before they are defined - handle by typescript-eslint
893
+ 'no-use-before-define': 'off',
885
894
 
886
- 'no-restricted-syntax': [
887
- 'error',
888
- {
889
- selector:
890
- "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
891
- message: 'setTimeout must always be invoked with two arguments.',
892
- },
893
- {
894
- selector: 'LabeledStatement',
895
- message:
896
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
897
- },
898
- {
899
- selector: 'WithStatement',
900
- message:
901
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
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
- '@stylistic-eslint/comma-dangle': [
906
- 'error',
907
- {
908
- arrays: 'always-multiline',
909
- enums: 'always-multiline',
910
- exports: 'always-multiline',
911
- functions: 'always-multiline',
912
- generics: 'always-multiline',
913
- imports: 'always-multiline',
914
- objects: 'always-multiline',
915
- tuples: 'always-multiline',
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
- '@stylistic-eslint/max-len': [
920
- 'error',
921
- {
922
- code: 100,
923
- comments: 110,
924
- ignoreTemplateLiterals: true,
925
- ignoreStrings: true,
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
- selector: 'variable', // variable with leadingUnderscore: 'allow',
950
- format: null,
951
- prefix: ['__'],
952
- filter: {
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
- selector: 'variable', // _id or _id.index... variables
959
- custom: {
960
- regex: '^_id(\\.[a-z]+([A-Z][a-z]+)*)*',
961
- match: true,
943
+ {
944
+ selector: 'default',
945
+ format: ['camelCase'],
946
+ modifiers: ['unused'],
947
+ leadingUnderscore: 'allow',
962
948
  },
963
- format: null,
964
- },
965
- {
966
- selector: 'enumMember',
967
- format: ['PascalCase'],
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
- selector: 'memberLike', // leadingUnderscore: 'allow',
1001
- modifiers: ['private'],
1002
- format: ['camelCase'],
1003
- prefix: ['__'],
1004
- filter: {
1005
- regex: '^__',
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
- selector: 'memberLike', // all that is not including _id or __ properties
1011
- format: ['camelCase', 'PascalCase'],
1012
- filter: {
1013
- regex: "^(?!.*(__|\\.|'*_id)).*$",
1014
- match: true,
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
- selector: 'memberLike', // _id or _id.index... properties
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
- selector: 'objectLiteralProperty', // object propertie .camelCase properties
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
- selector: 'objectLiteralProperty', // object propertie /camelCase properties
1045
- format: null,
1046
- filter: {
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
- selector: 'property',
1053
- filter: {
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
- format: null,
1058
- },
1059
- {
1060
- selector: 'property', // Properties $operator
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
- format: null,
1066
- },
1067
- {
1068
- selector: 'property',
1069
- filter: {
1070
- regex:
1071
- '(?<snake_extendedCamelCase>^([a-zA-Z0-9]+)(_([a-zA-Z0-9]+))*)',
1072
- match: true,
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
- selector: 'typeLike',
1087
- format: ['PascalCase'],
1088
- },
1089
- {
1090
- selector: 'import',
1091
- format: null,
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
- '@typescript-eslint/strict-boolean-expressions': [
1096
- 'error',
1097
- {
1098
- allowString: false,
1099
- allowNumber: false,
1100
- allowNullableObject: false,
1101
- allowNullableBoolean: true,
1102
- allowNullableString: false,
1103
- allowNullableNumber: false,
1104
- allowAny: false,
1105
- allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
1106
- },
1107
- ],
1108
- '@stylistic-eslint/no-extra-parens': [
1109
- 'off',
1110
- 'all',
1111
- {
1112
- conditionalAssign: true,
1113
- nestedBinaryExpressions: false,
1114
- returnAssign: false,
1115
- ignoreJSX: 'all', // delegate to eslint-plugin-react
1116
- enforceForArrowConditionals: false,
1117
- },
1118
- ],
1119
- '@typescript-eslint/no-empty-function': [
1120
- 'error',
1121
- {
1122
- allow: ['arrowFunctions', 'functions', 'methods'],
1123
- },
1124
- ],
1125
- '@stylistic-eslint/no-magic-numbers': [
1126
- 'off',
1127
- {
1128
- ignore: [],
1129
- ignoreArrayIndexes: true,
1130
- enforceConst: true,
1131
- detectObjects: false,
1132
- },
1133
- ],
1134
- '@typescript-eslint/no-unused-expressions': [
1135
- 'error',
1136
- {
1137
- allowShortCircuit: false,
1138
- allowTernary: false,
1139
- allowTaggedTemplates: false,
1140
- },
1141
- ],
1142
- '@typescript-eslint/no-unused-vars': [
1143
- 'error',
1144
- { vars: 'all', args: 'after-used', ignoreRestSiblings: true },
1145
- ],
1146
- '@typescript-eslint/no-use-before-define': [
1147
- 'error',
1148
- { functions: true, classes: true, variables: true },
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
- '@stylistic-eslint/adjacent-overload-signatures': 'off',
1152
- '@typescript-eslint/array-type': ['error'],
1153
- '@typescript-eslint/await-thenable': ['error'],
1154
- '@typescript-eslint/ban-ts-comment': [
1155
- 'error',
1156
- {
1157
- 'ts-expect-error': 'allow-with-description',
1158
- minimumDescriptionLength: 3,
1159
- },
1160
- ],
1161
- '@typescript-eslint/ban-tslint-comment': ['error'],
1162
- '@typescript-eslint/no-restricted-types': 2,
1163
- '@typescript-eslint/no-empty-object-type': 2,
1164
- '@typescript-eslint/no-unsafe-function-type': 2,
1165
- '@typescript-eslint/no-wrapper-object-types': 2,
1166
- '@stylistic-eslint/brace-style': 'off',
1167
- '@stylistic-eslint/class-literal-property-style': 'off',
1168
- '@stylistic-eslint/comma-spacing': [
1169
- 'error',
1170
- { before: false, after: true },
1171
- ],
1172
- '@typescript-eslint/consistent-generic-constructors': ['error'],
1173
- '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
1174
- '@typescript-eslint/consistent-type-assertions': ['error'],
1175
- '@typescript-eslint/consistent-type-definitions': 'off',
1176
- '@typescript-eslint/consistent-type-exports': 'off',
1177
- '@typescript-eslint/consistent-type-imports': 'off',
1178
- // Activate explicit-module-boundary-type as an alternative
1179
- '@typescript-eslint/explicit-function-return-type': 'off',
1180
- '@typescript-eslint/explicit-member-accessibility': ['error'],
1181
- '@typescript-eslint/explicit-module-boundary-types': 2,
1182
- '@/func-call-spacing': ['error', 'never'],
1183
- '@stylistic-eslint/indent': 0,
1184
- '@stylistic-eslint/member-delimiter-style': ['error'],
1185
- '@typescript-eslint/member-ordering': ['error'],
1186
- '@typescript-eslint/method-signature-style': ['error'],
1187
- '@typescript-eslint/no-array-constructor': 'error',
1188
- '@typescript-eslint/no-base-to-string': ['error'],
1189
- '@typescript-eslint/no-confusing-non-null-assertion': ['error'],
1190
- '@typescript-eslint/no-confusing-void-expression': ['error'],
1191
- '@typescript-eslint/no-duplicate-enum-values': ['error'],
1192
- '@typescript-eslint/no-dupe-class-members': 0, // automatically checked by the TypeScript compiler
1193
- '@typescript-eslint/no-dynamic-delete': ['error'],
1194
- '@typescript-eslint/no-empty-interface': ['error'],
1195
- '@typescript-eslint/no-explicit-any': [2],
1196
- '@typescript-eslint/no-extra-non-null-assertion': ['error'],
1197
- '@typescript-eslint/no-extraneous-class': ['error'],
1198
- '@typescript-eslint/no-floating-promises': ['error'],
1199
- '@typescript-eslint/no-for-in-array': ['error'],
1200
- '@typescript-eslint/no-implied-eval': 'error',
1201
- '@typescript-eslint/no-inferrable-types': ['error'],
1202
- '@typescript-eslint/no-invalid-void-type': ['error'],
1203
- '@typescript-eslint/no-meaningless-void-operator': ['error'],
1204
- '@typescript-eslint/no-misused-new': ['error'],
1205
- '@typescript-eslint/no-misused-promises': ['error'],
1206
- '@typescript-eslint/no-namespace': ['error'],
1207
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': ['error'],
1208
- '@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
1209
- '@typescript-eslint/no-non-null-assertion': ['error'],
1210
- '@typescript-eslint/no-redundant-type-constituents': 'error',
1211
- '@typescript-eslint/no-require-imports': 'off',
1212
- '@typescript-eslint/no-this-alias': ['error'],
1213
- '@typescript-eslint/only-throw-error': 'error',
1214
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
1215
- '@typescript-eslint/no-unnecessary-condition': ['error'],
1216
- '@typescript-eslint/no-unnecessary-qualifier': ['error'],
1217
- '@typescript-eslint/no-unnecessary-type-arguments': ['error'],
1218
- '@typescript-eslint/no-unnecessary-type-assertion': ['error'],
1219
- '@typescript-eslint/no-unnecessary-type-constraint': ['error'],
1220
- '@typescript-eslint/no-unsafe-argument': 'off',
1221
- '@typescript-eslint/no-unsafe-assignment': 0,
1222
- '@typescript-eslint/no-unsafe-call': ['warn'],
1223
- '@typescript-eslint/no-unsafe-member-access': [1],
1224
- '@typescript-eslint/no-unsafe-return': ['warn'],
1225
- '@typescript-eslint/no-useless-empty-export': 'off',
1226
- '@typescript-eslint/no-useless-constructor': 'error',
1227
- '@typescript-eslint/no-var-requires': 'off',
1228
- '@typescript-eslint/non-nullable-type-assertion-style': ['error'],
1229
- '@typescript-eslint/parameter-properties': 'off',
1230
- '@typescript-eslint/prefer-as-const': ['error'],
1231
- '@typescript-eslint/prefer-enum-initializers': ['error'],
1232
- '@typescript-eslint/prefer-for-of': ['error'],
1233
- '@typescript-eslint/prefer-function-type': ['error'],
1234
- '@typescript-eslint/prefer-includes': ['error'],
1235
- '@typescript-eslint/prefer-literal-enum-member': ['error'],
1236
- '@typescript-eslint/prefer-namespace-keyword': ['error'],
1237
- '@typescript-eslint/prefer-nullish-coalescing': ['error'],
1238
- '@typescript-eslint/prefer-optional-chain': ['error'],
1239
- '@typescript-eslint/prefer-readonly-parameter-types': 'off', // ['error'],
1240
- '@typescript-eslint/prefer-readonly': 'off',
1241
- '@typescript-eslint/prefer-reduce-type-parameter': ['error'],
1242
- '@typescript-eslint/prefer-regexp-exec': ['error'],
1243
- '@typescript-eslint/prefer-return-this-type': ['error'],
1244
- '@typescript-eslint/prefer-string-starts-ends-with': ['error'],
1245
- '@typescript-eslint/promise-function-async': ['error'],
1246
- '@typescript-eslint/require-array-sort-compare': ['error'],
1247
- '@typescript-eslint/restrict-plus-operands': ['error'],
1248
- '@typescript-eslint/restrict-template-expressions': ['error'],
1249
- '@typescript-eslint/switch-exhaustiveness-check': ['error'],
1250
- '@typescript-eslint/triple-slash-reference': ['error'],
1251
- '@stylistic-eslint/type-annotation-spacing': ['error'],
1252
- '@typescript-eslint/typedef': 'off',
1253
- '@typescript-eslint/unbound-method': ['error'],
1254
- '@typescript-eslint/unified-signatures': ['error'],
1255
-
1256
- 'brace-style': 'off',
1257
- 'func-style': ['error', 'declaration'],
1258
-
1259
- 'no-continue': 1,
1260
-
1261
- 'jsdoc/require-param-description': 0,
1262
- 'jsdoc/require-param-type': 0,
1263
- 'jsdoc/require-param': 0,
1264
- 'jsdoc/require-returns-type': 0,
1265
- 'jsdoc/require-returns': 0,
1266
- 'jsdoc/require-yields': 0,
1267
-
1268
- camelcase: 'off',
1269
-
1270
- indent: 'off',
1271
-
1272
- 'sonarjs/no-duplicate-string': 'error',
1273
- // Lot of new rules, we disable them for now
1274
- 'sonarjs/concise-regex': 0,
1275
- 'sonarjs/default-param-last': 0,
1276
- 'sonarjs/deprecation': 0,
1277
- 'sonarjs/duplicates-in-character-class': 0,
1278
- 'sonarjs/function-return-type': 0,
1279
- 'sonarjs/hashing': 0,
1280
- 'sonarjs/no-base-to-string': 0,
1281
- 'sonarjs/no-commented-code': 0,
1282
- 'sonarjs/no-dead-store': 0,
1283
- 'sonarjs/no-duplicate-string': 1,
1284
- 'sonarjs/no-empty-function': 0,
1285
- 'sonarjs/no-hardcoded-credentials': 0,
1286
- 'sonarjs/no-ignored-exceptions': 0,
1287
- 'sonarjs/no-incomplete-assertions': 0,
1288
- 'sonarjs/no-misused-promises': 0,
1289
- 'sonarjs/no-nested-functions': 0,
1290
- 'sonarjs/no-redundant-optional': 0,
1291
- 'sonarjs/no-redundant-type-constituents': 0,
1292
- 'sonarjs/no-useless-intersection': 0,
1293
- 'sonarjs/prefer-for-of': 0,
1294
- 'sonarjs/pseudo-random': 0,
1295
- 'sonarjs/redundant-type-aliases': 0,
1296
- 'sonarjs/single-character-alternation': 0,
1297
- 'sonarjs/slow-regex': 0,
1298
- 'sonarjs/sonar-no-control-regex': 0,
1299
- 'sonarjs/sonar-no-unused-vars': 0,
1300
- 'sonarjs/todo-tag': 0,
1301
- },
1302
- },
1303
- {
1304
- files: ['**/*.js', '**/*.ts', '**/*.tsx'],
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
- // Additional for projects or packages files
1373
- {
1374
- files: [
1375
- 'packages/**/*.ts',
1376
- 'packages/**/*.tsx',
1377
- 'projects/**/*.js',
1378
- 'projects/**/*.ts',
1379
- 'projects/**/*.tsx',
1380
- 'vite.config.ts',
1381
- ],
1382
- plugins: {
1383
- n,
1384
- '@typescript-eslint': typescript,
1385
- '@stylistic-eslint': stylistic,
1386
- jsdoc,
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
- ignores: ['**/*.test.ts'],
1389
- rules: {
1390
- '@stylistic-eslint/function-paren-newline': [
1391
- 'error',
1392
- 'multiline-arguments',
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
- // Additional config for test files
1419
- {
1420
- files: ['**/*.test.tsx', '**/*.test.ts'],
1421
- plugins: {
1422
- sonarjs,
1423
- jsdoc,
1378
+ {
1379
+ files: ['**/*.tsx'],
1380
+ rules: {
1381
+ 'func-style': 0,
1382
+ },
1424
1383
  },
1425
- rules: {
1426
- 'jsdoc/require-jsdoc': 2,
1427
- 'jsdoc/check-tag-names': 0,
1428
- 'sonarjs/no-duplicate-string': 1,
1429
- 'no-undef': 0,
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
- files: [
1434
- '**/__mocks__/**/*.ts',
1435
- 'src/backend/mongodb/seeds/collections/*.ts',
1436
- ],
1437
- rules: {
1438
- 'jsdoc/require-jsdoc': 0,
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
- // Additionnal for css files
1442
- {
1443
- files: ['**/*.css.ts'],
1444
- plugins: {
1445
- '@typescript-eslint': typescript,
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
- rules: {
1448
- '@typescript-eslint/no-unsafe-call': 0,
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
- files: ['stories/**'],
1453
- rules: {
1454
- 'implicit-arrow-linebreak': 0,
1455
- 'arrow-body-style': 0,
1466
+ {
1467
+ files: ['stories/**'],
1468
+ rules: {
1469
+ 'implicit-arrow-linebreak': 0,
1470
+ 'arrow-body-style': 0,
1471
+ },
1456
1472
  },
1457
- },
1458
- {
1459
- files: [
1460
- '**/__tests__/**/*.{ts,tsx,js,jsx}',
1461
- '**/?(*.)+(spec|test).{ts,tsx,js,jsx}',
1462
- ],
1463
- rules: {
1464
- 'arrow-body-style': 'off',
1465
- 'func-style': 'off',
1466
- 'no-ternary': 'off',
1467
- 'no-promise-executor-return': 'off',
1468
- 'no-duplicate-imports': 'off',
1469
- '@typescript-eslint/promise-function-async': 'off',
1470
- '@typescript-eslint/no-floating-promises': 'off',
1471
- '@typescript-eslint/only-throw-error': 'off',
1472
- '@typescript-eslint/no-confusing-void-expression': 'off',
1473
- '@typescript-eslint/no-unsafe-member-access': 'off',
1474
- '@typescript-eslint/no-unsafe-call': 'off',
1475
- '@typescript-eslint/no-unsafe-return': 'off',
1476
- '@typescript-eslint/no-unnecessary-type-assertion': 'off',
1477
- '@typescript-eslint/prefer-nullish-coalescing': 'off',
1478
- '@typescript-eslint/strict-boolean-expressions': 'off',
1479
- '@typescript-eslint/unbound-method': 'off',
1480
- 'jsdoc/require-jsdoc': 'off',
1481
- 'prefer-destructuring': 'off',
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();