@viclafouch/eslint-config-viclafouch 4.17.1-beta.2 → 4.17.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +6 -0
- package/package.json +3 -4
- package/rules/best-practices.mjs +121 -57
- package/rules/errors.mjs +16 -9
- package/rules/es6.mjs +63 -29
- package/rules/imports.mjs +10 -9
- package/rules/node.mjs +2 -1
- package/rules/react-hooks.mjs +2 -1
- package/rules/react.mjs +7 -6
- package/rules/style.mjs +31 -1
- package/rules/typescript.mjs +16 -9
- package/rules/variables.mjs +13 -11
package/index.mjs
CHANGED
|
@@ -10,6 +10,12 @@ import variablesConfig from './rules/variables.mjs'
|
|
|
10
10
|
* @type {import("eslint").Linter.Config}
|
|
11
11
|
*/
|
|
12
12
|
export default [
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'],
|
|
15
|
+
linterOptions: {
|
|
16
|
+
reportUnusedDisableDirectives: 'error'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
13
19
|
bestPracticesConfig,
|
|
14
20
|
nodeConfig,
|
|
15
21
|
errorConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viclafouch/eslint-config-viclafouch",
|
|
3
|
-
"version": "4.17.1-beta.
|
|
3
|
+
"version": "4.17.1-beta.4",
|
|
4
4
|
"description": "ESLint and Prettier Config from Victor de la Fouchardiere",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
"homepage": "https://github.com/viclafouch/eslint-config-viclafouch#readme",
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"eslint": ">= 9",
|
|
29
|
-
"prettier": "
|
|
30
|
-
"typescript": "
|
|
29
|
+
"prettier": ">= 3",
|
|
30
|
+
"typescript": ">= 5"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/core": "^7.26.0",
|
|
34
34
|
"@babel/eslint-parser": "^7.25.9",
|
|
35
35
|
"@next/eslint-plugin-next": "^15.1.0",
|
|
36
|
-
"@rushstack/eslint-patch": "^1.10.4",
|
|
37
36
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
38
37
|
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
39
38
|
"@typescript-eslint/parser": "^8.18.0",
|
package/rules/best-practices.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import globals from 'globals'
|
|
|
4
4
|
* @type {import("eslint").Linter.Config}
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
7
|
+
name: 'best-practices',
|
|
7
8
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
8
9
|
languageOptions: {
|
|
9
10
|
globals: {
|
|
@@ -11,7 +12,7 @@ export default {
|
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
rules: {
|
|
14
|
-
//
|
|
15
|
+
// Enforces getter/setter pairs in objects
|
|
15
16
|
// https://eslint.org/docs/rules/accessor-pairs
|
|
16
17
|
'accessor-pairs': 'off',
|
|
17
18
|
|
|
@@ -19,19 +20,34 @@ export default {
|
|
|
19
20
|
// https://eslint.org/docs/rules/curly
|
|
20
21
|
curly: ['error', 'all'],
|
|
21
22
|
|
|
22
|
-
//
|
|
23
|
+
// Enforces return statements in callbacks of array's methods
|
|
23
24
|
// https://eslint.org/docs/rules/array-callback-return
|
|
24
|
-
'array-callback-return': [
|
|
25
|
+
'array-callback-return': [
|
|
26
|
+
'error',
|
|
27
|
+
{ allowImplicit: true, checkForEach: true }
|
|
28
|
+
],
|
|
29
|
+
|
|
30
|
+
// Enforce for loop update clause moving the counter in the right direction
|
|
31
|
+
// https://eslint.org/docs/latest/rules/for-direction
|
|
32
|
+
'for-direction': 'error',
|
|
33
|
+
|
|
34
|
+
// Enforce return statements in getters
|
|
35
|
+
// https://eslint.org/docs/latest/rules/getter-return
|
|
36
|
+
'getter-return': 'error',
|
|
37
|
+
|
|
38
|
+
// Disallow returning values from setters
|
|
39
|
+
// https://eslint.org/docs/latest/rules/no-setter-return
|
|
40
|
+
'no-setter-return': 'error',
|
|
25
41
|
|
|
26
|
-
//
|
|
42
|
+
// Rreat var statements as if they were block scoped
|
|
27
43
|
// https://eslint.org/docs/rules/block-scoped-var
|
|
28
44
|
'block-scoped-var': 'error',
|
|
29
45
|
|
|
30
|
-
//
|
|
46
|
+
// Specify the maximum cyclomatic complexity allowed in a program
|
|
31
47
|
// https://eslint.org/docs/rules/complexity
|
|
32
|
-
complexity: ['
|
|
48
|
+
complexity: ['error', 20],
|
|
33
49
|
|
|
34
|
-
//
|
|
50
|
+
// Enforce that class methods use "this"
|
|
35
51
|
// https://eslint.org/docs/rules/class-methods-use-this
|
|
36
52
|
'class-methods-use-this': [
|
|
37
53
|
'error',
|
|
@@ -40,13 +56,25 @@ export default {
|
|
|
40
56
|
}
|
|
41
57
|
],
|
|
42
58
|
|
|
43
|
-
//
|
|
59
|
+
// Require return statements to either always or never specify values
|
|
44
60
|
// https://eslint.org/docs/rules/consistent-return
|
|
45
61
|
'consistent-return': 'error',
|
|
46
62
|
|
|
47
|
-
//
|
|
63
|
+
// Disallow comparing against -0
|
|
64
|
+
// https://eslint.org/docs/latest/rules/no-compare-neg-zero
|
|
65
|
+
'no-compare-neg-zero': 'error',
|
|
66
|
+
|
|
67
|
+
// Disallow sparse arrays
|
|
68
|
+
// https://eslint.org/docs/latest/rules/no-sparse-arrays
|
|
69
|
+
'no-sparse-arrays': 'error',
|
|
70
|
+
|
|
71
|
+
// Disallow expressions where the operation doesn't affect the value
|
|
72
|
+
// https://eslint.org/docs/latest/rules/no-constant-binary-expression
|
|
73
|
+
'no-constant-binary-expression': 'error',
|
|
74
|
+
|
|
75
|
+
// Require default case in switch statements
|
|
48
76
|
// https://eslint.org/docs/rules/default-case
|
|
49
|
-
'default-case': ['error'
|
|
77
|
+
'default-case': ['error'],
|
|
50
78
|
|
|
51
79
|
// Enforce default clauses in switch statements to be last
|
|
52
80
|
// https://eslint.org/docs/rules/default-case-last
|
|
@@ -55,23 +83,27 @@ export default {
|
|
|
55
83
|
// https://eslint.org/docs/rules/default-param-last
|
|
56
84
|
'default-param-last': 'error',
|
|
57
85
|
|
|
58
|
-
//
|
|
86
|
+
// Encourages use of dot notation whenever possible
|
|
59
87
|
// https://eslint.org/docs/rules/dot-notation
|
|
60
88
|
'dot-notation': ['error', { allowKeywords: true }],
|
|
61
89
|
|
|
62
|
-
//
|
|
90
|
+
// Require the use of === and !==
|
|
91
|
+
// https://eslint.org/docs/latest/rules/eqeqeq
|
|
92
|
+
eqeqeq: ['error', 'always'],
|
|
93
|
+
|
|
94
|
+
// Enforces consistent newlines before or after dots
|
|
63
95
|
// https://eslint.org/docs/rules/dot-location
|
|
64
96
|
'dot-location': ['error', 'property'],
|
|
65
97
|
|
|
66
|
-
//
|
|
98
|
+
// Make sure for-in loops have an if statement
|
|
67
99
|
// https://eslint.org/docs/rules/guard-for-in
|
|
68
100
|
'guard-for-in': 'error',
|
|
69
101
|
|
|
70
|
-
//
|
|
102
|
+
// Disallow the use of alert, confirm, and prompt
|
|
71
103
|
// https://eslint.org/docs/rules/no-alert
|
|
72
104
|
'no-alert': 'error',
|
|
73
105
|
|
|
74
|
-
//
|
|
106
|
+
// Disallow lexical declarations in case/default clauses
|
|
75
107
|
// https://eslint.org/docs/rules/no-case-declarations
|
|
76
108
|
'no-case-declarations': 'error',
|
|
77
109
|
|
|
@@ -79,11 +111,11 @@ export default {
|
|
|
79
111
|
// https://eslint.org/docs/rules/no-constructor-return
|
|
80
112
|
'no-constructor-return': 'error',
|
|
81
113
|
|
|
82
|
-
//
|
|
114
|
+
// Disallow else after a return in an if
|
|
83
115
|
// https://eslint.org/docs/rules/no-else-return
|
|
84
116
|
'no-else-return': ['error', { allowElseIf: false }],
|
|
85
117
|
|
|
86
|
-
//
|
|
118
|
+
// Disallow empty functions, except for standalone funcs/arrows
|
|
87
119
|
// https://eslint.org/docs/rules/no-empty-function
|
|
88
120
|
'no-empty-function': [
|
|
89
121
|
'error',
|
|
@@ -92,63 +124,75 @@ export default {
|
|
|
92
124
|
}
|
|
93
125
|
],
|
|
94
126
|
|
|
95
|
-
//
|
|
127
|
+
// Disallow empty destructuring patterns
|
|
96
128
|
// https://eslint.org/docs/rules/no-empty-pattern
|
|
97
129
|
'no-empty-pattern': 'error',
|
|
98
130
|
|
|
99
|
-
//
|
|
131
|
+
// Disallow comparisons to null without a type-checking operator
|
|
100
132
|
// https://eslint.org/docs/rules/no-eq-null
|
|
101
133
|
'no-eq-null': 'off',
|
|
102
134
|
|
|
103
|
-
//
|
|
135
|
+
// Disallow adding to native types
|
|
104
136
|
// https://eslint.org/docs/rules/no-extend-native
|
|
105
137
|
'no-extend-native': 'error',
|
|
106
138
|
|
|
107
|
-
//
|
|
139
|
+
// Disallow Unnecessary Labels
|
|
108
140
|
// https://eslint.org/docs/rules/no-extra-label
|
|
109
141
|
'no-extra-label': 'error',
|
|
110
142
|
|
|
111
|
-
//
|
|
143
|
+
// Disallow fallthrough of case statements
|
|
112
144
|
// https://eslint.org/docs/rules/no-fallthrough
|
|
113
145
|
'no-fallthrough': 'error',
|
|
114
146
|
|
|
115
|
-
//
|
|
147
|
+
// Disallow the use of leading or trailing decimal points in numeric literals
|
|
116
148
|
// https://eslint.org/docs/rules/no-floating-decimal
|
|
117
149
|
'no-floating-decimal': 'error',
|
|
118
150
|
|
|
119
|
-
//
|
|
151
|
+
// Disallow reassignments of native objects or read-only globals
|
|
120
152
|
// https://eslint.org/docs/rules/no-global-assign
|
|
121
153
|
'no-global-assign': ['error', { exceptions: [] }],
|
|
122
154
|
|
|
123
|
-
//
|
|
155
|
+
// Deprecated in favor of no-global-assign
|
|
124
156
|
// https://eslint.org/docs/rules/no-native-reassign
|
|
125
157
|
'no-native-reassign': 'off',
|
|
126
158
|
|
|
127
|
-
//
|
|
159
|
+
// Disallow implicit type conversions
|
|
128
160
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
129
161
|
'no-implicit-coercion': 'error',
|
|
130
162
|
|
|
131
|
-
//
|
|
163
|
+
// Disallow reassigning function declarations
|
|
164
|
+
// https://eslint.org/docs/latest/rules/no-func-assign
|
|
165
|
+
'no-func-assign': 'error',
|
|
166
|
+
|
|
167
|
+
// Disallow assigning to imported bindings
|
|
168
|
+
// https://eslint.org/docs/latest/rules/no-import-assign
|
|
169
|
+
'no-import-assign': 'error',
|
|
170
|
+
|
|
171
|
+
// Disallow var and named functions in global scope
|
|
132
172
|
// https://eslint.org/docs/rules/no-implicit-globals
|
|
133
173
|
'no-implicit-globals': 'off',
|
|
134
174
|
|
|
135
|
-
//
|
|
175
|
+
// Disallow this keywords outside of classes or class-like objects
|
|
136
176
|
// https://eslint.org/docs/rules/no-invalid-this
|
|
137
177
|
'no-invalid-this': 'off',
|
|
138
178
|
|
|
139
|
-
//
|
|
179
|
+
// Disallow variable or function declarations in nested blocks
|
|
180
|
+
// https://eslint.org/docs/latest/rules/no-inner-declarations
|
|
181
|
+
'no-inner-declarations': ['error', 'both'],
|
|
182
|
+
|
|
183
|
+
// Disallow usage of __iterator__ property
|
|
140
184
|
// https://eslint.org/docs/rules/no-iterator
|
|
141
185
|
'no-iterator': 'error',
|
|
142
186
|
|
|
143
|
-
//
|
|
187
|
+
// Disallow use of labels for anything other than loops and switches
|
|
144
188
|
// https://eslint.org/docs/rules/no-labels
|
|
145
189
|
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
146
190
|
|
|
147
|
-
//
|
|
191
|
+
// Disallow unnecessary nested blocks
|
|
148
192
|
// https://eslint.org/docs/rules/no-lone-blocks
|
|
149
193
|
'no-lone-blocks': 'error',
|
|
150
194
|
|
|
151
|
-
//
|
|
195
|
+
// Disallow use of multiple spaces
|
|
152
196
|
// https://eslint.org/docs/rules/no-multi-spaces
|
|
153
197
|
'no-multi-spaces': [
|
|
154
198
|
'error',
|
|
@@ -157,30 +201,30 @@ export default {
|
|
|
157
201
|
}
|
|
158
202
|
],
|
|
159
203
|
|
|
160
|
-
//
|
|
204
|
+
// Disallow use of multiline strings
|
|
161
205
|
// https://eslint.org/docs/rules/no-multi-str
|
|
162
206
|
'no-multi-str': 'error',
|
|
163
207
|
|
|
164
|
-
//
|
|
208
|
+
// Disallow use of new operator when not part of the assignment or comparison
|
|
165
209
|
// https://eslint.org/docs/rules/no-new
|
|
166
210
|
'no-new': 'error',
|
|
167
211
|
|
|
168
|
-
//
|
|
212
|
+
// Disallows creating new instances of String, Number, and Boolean
|
|
169
213
|
// https://eslint.org/docs/rules/no-new-wrappers
|
|
170
214
|
'no-new-wrappers': 'error',
|
|
171
215
|
|
|
172
|
-
//
|
|
216
|
+
// Disallow use of (old style) octal literals
|
|
173
217
|
// https://eslint.org/docs/rules/no-octal
|
|
174
218
|
'no-octal': 'error',
|
|
175
219
|
|
|
176
|
-
//
|
|
177
|
-
//
|
|
220
|
+
// Disallow use of octal escape sequences in string literals, such as
|
|
221
|
+
// Var foo = 'Copyright \251';
|
|
178
222
|
// https://eslint.org/docs/rules/no-octal-escape
|
|
179
223
|
'no-octal-escape': 'error',
|
|
180
224
|
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
225
|
+
// Disallow reassignment of function parameters
|
|
226
|
+
// Disallow parameter object manipulation except for specific exclusions
|
|
227
|
+
// Rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
184
228
|
'no-param-reassign': [
|
|
185
229
|
'error',
|
|
186
230
|
{
|
|
@@ -192,11 +236,11 @@ export default {
|
|
|
192
236
|
}
|
|
193
237
|
],
|
|
194
238
|
|
|
195
|
-
//
|
|
239
|
+
// Disallow declaring the same variable more than once
|
|
196
240
|
// https://eslint.org/docs/rules/no-redeclare
|
|
197
241
|
'no-redeclare': 'error',
|
|
198
242
|
|
|
199
|
-
//
|
|
243
|
+
// Disallow certain object properties
|
|
200
244
|
// https://eslint.org/docs/rules/no-restricted-properties
|
|
201
245
|
'no-restricted-properties': [
|
|
202
246
|
'error',
|
|
@@ -242,11 +286,15 @@ export default {
|
|
|
242
286
|
}
|
|
243
287
|
],
|
|
244
288
|
|
|
245
|
-
//
|
|
289
|
+
// Disallow use of assignment in return statement
|
|
246
290
|
// https://eslint.org/docs/rules/no-return-assign
|
|
247
291
|
'no-return-assign': ['error', 'always'],
|
|
248
292
|
|
|
249
|
-
//
|
|
293
|
+
// Disallow ternary operators when simpler alternatives exist
|
|
294
|
+
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
295
|
+
'no-unneeded-ternary': 'error',
|
|
296
|
+
|
|
297
|
+
// Disallow assignments where both sides are exactly the same
|
|
250
298
|
// https://eslint.org/docs/rules/no-self-assign
|
|
251
299
|
'no-self-assign': [
|
|
252
300
|
'error',
|
|
@@ -255,19 +303,35 @@ export default {
|
|
|
255
303
|
}
|
|
256
304
|
],
|
|
257
305
|
|
|
258
|
-
//
|
|
306
|
+
// Disallow comparisons where both sides are exactly the same
|
|
259
307
|
// https://eslint.org/docs/rules/no-self-compare
|
|
260
308
|
'no-self-compare': 'error',
|
|
261
309
|
|
|
262
|
-
//
|
|
310
|
+
// Restrict what can be thrown as an exception
|
|
263
311
|
// https://eslint.org/docs/rules/no-throw-literal
|
|
264
312
|
'no-throw-literal': 'error',
|
|
265
313
|
|
|
266
|
-
//
|
|
314
|
+
// Disallow unmodified conditions of loops
|
|
267
315
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
268
|
-
'no-unmodified-loop-condition': '
|
|
316
|
+
'no-unmodified-loop-condition': 'error',
|
|
317
|
+
|
|
318
|
+
// Disallow negating the left operand of relational operators
|
|
319
|
+
// https://eslint.org/docs/latest/rules/no-unsafe-negation
|
|
320
|
+
'no-unsafe-negation': 'error',
|
|
321
|
+
|
|
322
|
+
// Enforce comparing typeof expressions against valid strings
|
|
323
|
+
// https://eslint.org/docs/latest/rules/valid-typeof
|
|
324
|
+
'valid-typeof': 'error',
|
|
325
|
+
|
|
326
|
+
// Require calls to isNaN() when checking for NaN
|
|
327
|
+
// https://eslint.org/docs/latest/rules/use-isnan
|
|
328
|
+
'use-isnan': 'error',
|
|
329
|
+
|
|
330
|
+
// Disallow unreachable code after return, throw, continue, and break statements
|
|
331
|
+
// https://eslint.org/docs/latest/rules/no-unreachable
|
|
332
|
+
'no-unreachable': 'error',
|
|
269
333
|
|
|
270
|
-
//
|
|
334
|
+
// Disallow usage of expressions in statement position
|
|
271
335
|
// https://eslint.org/docs/rules/no-unused-expressions
|
|
272
336
|
'no-unused-expressions': [
|
|
273
337
|
'error',
|
|
@@ -278,11 +342,11 @@ export default {
|
|
|
278
342
|
}
|
|
279
343
|
],
|
|
280
344
|
|
|
281
|
-
//
|
|
345
|
+
// Disallow unused labels
|
|
282
346
|
// https://eslint.org/docs/rules/no-unused-labels
|
|
283
347
|
'no-unused-labels': 'error',
|
|
284
348
|
|
|
285
|
-
//
|
|
349
|
+
// Disallow unnecessary .call() and .apply()
|
|
286
350
|
// https://eslint.org/docs/rules/no-useless-call
|
|
287
351
|
'no-useless-call': 'off',
|
|
288
352
|
|
|
@@ -290,19 +354,19 @@ export default {
|
|
|
290
354
|
// https://eslint.org/docs/rules/no-useless-catch
|
|
291
355
|
'no-useless-catch': 'error',
|
|
292
356
|
|
|
293
|
-
//
|
|
357
|
+
// Disallow useless string concatenation
|
|
294
358
|
// https://eslint.org/docs/rules/no-useless-concat
|
|
295
359
|
'no-useless-concat': 'error',
|
|
296
360
|
|
|
297
|
-
//
|
|
361
|
+
// Disallow unnecessary string escaping
|
|
298
362
|
// https://eslint.org/docs/rules/no-useless-escape
|
|
299
363
|
'no-useless-escape': 'error',
|
|
300
364
|
|
|
301
|
-
//
|
|
365
|
+
// Disallow redundant return; keywords
|
|
302
366
|
// https://eslint.org/docs/rules/no-useless-return
|
|
303
367
|
'no-useless-return': 'error',
|
|
304
368
|
|
|
305
|
-
//
|
|
369
|
+
// Require using Error objects as Promise rejection reasons
|
|
306
370
|
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
307
371
|
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
308
372
|
|
|
@@ -318,7 +382,7 @@ export default {
|
|
|
318
382
|
}
|
|
319
383
|
],
|
|
320
384
|
|
|
321
|
-
//
|
|
385
|
+
// Require use of the second argument for parseInt()
|
|
322
386
|
// https://eslint.org/docs/rules/radix
|
|
323
387
|
radix: 'error',
|
|
324
388
|
|
package/rules/errors.mjs
CHANGED
|
@@ -2,38 +2,45 @@
|
|
|
2
2
|
* @type {import("eslint").Linter.Config}
|
|
3
3
|
*/
|
|
4
4
|
export default {
|
|
5
|
+
name: 'errors',
|
|
5
6
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
6
7
|
rules: {
|
|
7
8
|
// Disallow await inside of loops
|
|
8
9
|
// https://eslint.org/docs/rules/no-await-in-loop
|
|
9
10
|
'no-await-in-loop': 'error',
|
|
10
11
|
|
|
11
|
-
//
|
|
12
|
+
// Disallow assignment in conditional expressions
|
|
13
|
+
// https://eslint.org/docs/latest/rules/no-cond-assign
|
|
12
14
|
'no-cond-assign': ['error', 'always'],
|
|
13
15
|
|
|
14
|
-
//
|
|
16
|
+
// Disallow use of console
|
|
15
17
|
'no-console': 'warn',
|
|
16
18
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
+
// Disallow use of constant expressions in conditions
|
|
20
|
+
// https://eslint.org/docs/latest/rules/no-constant-condition
|
|
21
|
+
'no-constant-condition': 'error',
|
|
19
22
|
|
|
20
|
-
//
|
|
23
|
+
// Disallow use of debugger
|
|
24
|
+
// https://eslint.org/docs/latest/rules/no-debugger
|
|
21
25
|
'no-debugger': 'error',
|
|
22
26
|
|
|
23
27
|
// Disallow duplicate conditions in if-else-if chains
|
|
24
28
|
// https://eslint.org/docs/rules/no-dupe-else-if
|
|
25
29
|
'no-dupe-else-if': 'error',
|
|
26
30
|
|
|
27
|
-
//
|
|
31
|
+
// Disallow duplicate case labels
|
|
32
|
+
// https://eslint.org/docs/latest/rules/no-duplicate-case
|
|
28
33
|
'no-duplicate-case': 'error',
|
|
29
34
|
|
|
30
|
-
//
|
|
35
|
+
// Disallow duplicate keys when creating object literals
|
|
36
|
+
// https://eslint.org/docs/latest/rules/no-dupe-keys
|
|
31
37
|
'no-dupe-keys': 'error',
|
|
32
38
|
|
|
33
|
-
//
|
|
39
|
+
// Disallow reassigning exceptions in catch clauses
|
|
40
|
+
// https://eslint.org/docs/latest/rules/no-ex-assign
|
|
34
41
|
'no-ex-assign': 'error',
|
|
35
42
|
|
|
36
|
-
//
|
|
43
|
+
// Disallow unnecessary semicolons
|
|
37
44
|
'no-extra-semi': 'error'
|
|
38
45
|
}
|
|
39
46
|
}
|
package/rules/es6.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import pluginPromise from 'eslint-plugin-promise'
|
|
|
4
4
|
* @type {import("eslint").Linter.Config}
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
7
|
+
name: 'es6',
|
|
7
8
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
8
9
|
plugins: {
|
|
9
10
|
promise: pluginPromise
|
|
@@ -14,30 +15,34 @@ export default {
|
|
|
14
15
|
jsx: true
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
|
-
ecmaVersion:
|
|
18
|
+
ecmaVersion: 'latest',
|
|
18
19
|
sourceType: 'module'
|
|
19
20
|
},
|
|
20
21
|
rules: {
|
|
21
|
-
//
|
|
22
|
+
// Require braces around arrow function bodies
|
|
22
23
|
// https://eslint.org/docs/rules/arrow-body-style
|
|
23
24
|
'arrow-body-style': ['error', 'always'],
|
|
24
25
|
|
|
25
|
-
//
|
|
26
|
+
// Require parens in arrow function arguments
|
|
26
27
|
// https://eslint.org/docs/rules/arrow-parens
|
|
27
28
|
'arrow-parens': ['error', 'always'],
|
|
28
29
|
|
|
29
|
-
//
|
|
30
|
+
// Require space before/after arrow function's arrow
|
|
30
31
|
// https://eslint.org/docs/rules/arrow-spacing
|
|
31
32
|
'arrow-spacing': ['error', { before: true, after: true }],
|
|
32
33
|
|
|
33
|
-
//
|
|
34
|
+
// Verify super() callings in constructors
|
|
34
35
|
'constructor-super': 'error',
|
|
35
36
|
|
|
36
|
-
//
|
|
37
|
+
// Disallow modifying variables of class declarations
|
|
37
38
|
// https://eslint.org/docs/rules/no-class-assign
|
|
38
39
|
'no-class-assign': 'error',
|
|
39
40
|
|
|
40
|
-
//
|
|
41
|
+
// Disallow duplicate class members
|
|
42
|
+
// https://eslint.org/docs/latest/rules/no-dupe-class-members
|
|
43
|
+
'no-dupe-class-members': 'error',
|
|
44
|
+
|
|
45
|
+
// Disallow arrow functions where they could be confused with comparisons
|
|
41
46
|
// https://eslint.org/docs/rules/no-confusing-arrow
|
|
42
47
|
'no-confusing-arrow': [
|
|
43
48
|
'error',
|
|
@@ -46,39 +51,60 @@ export default {
|
|
|
46
51
|
}
|
|
47
52
|
],
|
|
48
53
|
|
|
49
|
-
//
|
|
54
|
+
// Disallow modifying variables that are declared using const
|
|
55
|
+
// https://eslint.org/docs/latest/rules/no-const-assign
|
|
50
56
|
'no-const-assign': 'error',
|
|
51
57
|
|
|
52
|
-
//
|
|
58
|
+
// Disallow importing from the same path more than once
|
|
53
59
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
54
|
-
//
|
|
60
|
+
// Replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
55
61
|
'no-duplicate-imports': 'off',
|
|
56
62
|
|
|
63
|
+
// Disallow new operators with global non-constructor functions
|
|
64
|
+
// https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
|
|
65
|
+
'no-new-native-nonconstructor': 'error',
|
|
66
|
+
|
|
67
|
+
// Disallow returning values from Promise executor functions
|
|
68
|
+
// https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
69
|
+
'no-promise-executor-return': 'error',
|
|
70
|
+
|
|
71
|
+
// Disallow invalid regular expression strings in RegExp constructors
|
|
72
|
+
// https://eslint.org/docs/latest/rules/no-invalid-regexp
|
|
73
|
+
'no-invalid-regexp': 'error',
|
|
74
|
+
|
|
57
75
|
// Disallow specified names in exports
|
|
58
76
|
// https://eslint.org/docs/rules/no-restricted-exports
|
|
59
77
|
'no-restricted-exports': [
|
|
60
78
|
'error',
|
|
61
79
|
{
|
|
62
80
|
restrictedNamedExports: [
|
|
63
|
-
'default', //
|
|
64
|
-
'then' //
|
|
81
|
+
'default', // Use `export default` to provide a default export
|
|
82
|
+
'then' // This will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
|
|
65
83
|
]
|
|
66
84
|
}
|
|
67
85
|
],
|
|
68
86
|
|
|
69
|
-
//
|
|
87
|
+
// Disallow this/super before calling super() in constructors
|
|
70
88
|
// https://eslint.org/docs/rules/no-this-before-super
|
|
71
89
|
'no-this-before-super': 'error',
|
|
72
90
|
|
|
73
|
-
//
|
|
91
|
+
// Disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
92
|
+
// https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
|
|
93
|
+
'no-unsafe-optional-chaining': 'error',
|
|
94
|
+
|
|
95
|
+
// Disallow control flow statements in finally blocks
|
|
96
|
+
// https://eslint.org/docs/latest/rules/no-unsafe-finally
|
|
97
|
+
'no-unsafe-finally': 'error',
|
|
98
|
+
|
|
99
|
+
// Disallow useless computed property keys
|
|
74
100
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
75
101
|
'no-useless-computed-key': 'error',
|
|
76
102
|
|
|
77
|
-
//
|
|
103
|
+
// Disallow unnecessary constructor
|
|
78
104
|
// https://eslint.org/docs/rules/no-useless-constructor
|
|
79
105
|
'no-useless-constructor': 'error',
|
|
80
106
|
|
|
81
|
-
//
|
|
107
|
+
// Disallow renaming import, export, and destructured assignments to the same name
|
|
82
108
|
// https://eslint.org/docs/rules/no-useless-rename
|
|
83
109
|
'no-useless-rename': [
|
|
84
110
|
'error',
|
|
@@ -89,10 +115,10 @@ export default {
|
|
|
89
115
|
}
|
|
90
116
|
],
|
|
91
117
|
|
|
92
|
-
//
|
|
118
|
+
// Require let or const instead of var
|
|
93
119
|
'no-var': 'error',
|
|
94
120
|
|
|
95
|
-
//
|
|
121
|
+
// Require method and property shorthand syntax for object literals
|
|
96
122
|
// https://eslint.org/docs/rules/object-shorthand
|
|
97
123
|
'object-shorthand': [
|
|
98
124
|
'error',
|
|
@@ -103,7 +129,7 @@ export default {
|
|
|
103
129
|
}
|
|
104
130
|
],
|
|
105
131
|
|
|
106
|
-
//
|
|
132
|
+
// Suggest using arrow functions as callbacks
|
|
107
133
|
'prefer-arrow-callback': [
|
|
108
134
|
'error',
|
|
109
135
|
{
|
|
@@ -112,7 +138,7 @@ export default {
|
|
|
112
138
|
}
|
|
113
139
|
],
|
|
114
140
|
|
|
115
|
-
//
|
|
141
|
+
// Suggest using of const declaration for variables that are never modified after declared
|
|
116
142
|
'prefer-const': [
|
|
117
143
|
'error',
|
|
118
144
|
{
|
|
@@ -140,31 +166,31 @@ export default {
|
|
|
140
166
|
}
|
|
141
167
|
],
|
|
142
168
|
|
|
143
|
-
//
|
|
169
|
+
// Disallow parseInt() in favor of binary, octal, and hexadecimal literals
|
|
144
170
|
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
145
171
|
'prefer-numeric-literals': 'error',
|
|
146
172
|
|
|
147
|
-
//
|
|
173
|
+
// Suggest using Reflect methods where applicable
|
|
148
174
|
// https://eslint.org/docs/rules/prefer-reflect
|
|
149
175
|
'prefer-reflect': 'off',
|
|
150
176
|
|
|
151
|
-
//
|
|
177
|
+
// Use rest parameters instead of arguments
|
|
152
178
|
// https://eslint.org/docs/rules/prefer-rest-params
|
|
153
179
|
'prefer-rest-params': 'error',
|
|
154
180
|
|
|
155
|
-
//
|
|
181
|
+
// Suggest using the spread syntax instead of .apply()
|
|
156
182
|
// https://eslint.org/docs/rules/prefer-spread
|
|
157
183
|
'prefer-spread': 'error',
|
|
158
184
|
|
|
159
|
-
//
|
|
185
|
+
// Suggest using template literals instead of string concatenation
|
|
160
186
|
// https://eslint.org/docs/rules/prefer-template
|
|
161
187
|
'prefer-template': 'error',
|
|
162
188
|
|
|
163
|
-
//
|
|
189
|
+
// Enforce spacing between object rest-spread
|
|
164
190
|
// https://eslint.org/docs/rules/rest-spread-spacing
|
|
165
191
|
'rest-spread-spacing': ['error', 'never'],
|
|
166
192
|
|
|
167
|
-
//
|
|
193
|
+
// Enforce usage of spacing in template strings
|
|
168
194
|
// https://eslint.org/docs/rules/template-curly-spacing
|
|
169
195
|
'template-curly-spacing': 'error',
|
|
170
196
|
|
|
@@ -174,9 +200,17 @@ export default {
|
|
|
174
200
|
|
|
175
201
|
// Disallow async functions which have no await expression
|
|
176
202
|
// https://eslint.org/docs/latest/rules/require-await
|
|
177
|
-
'require-await':
|
|
203
|
+
'require-await': 'error',
|
|
178
204
|
|
|
179
205
|
// Prefer to use async/await for Promises
|
|
180
|
-
'promise/prefer-await-to-then':
|
|
206
|
+
'promise/prefer-await-to-then': 'error',
|
|
207
|
+
|
|
208
|
+
// Disallow using an async function as a Promise executor
|
|
209
|
+
// https://eslint.org/docs/latest/rules/no-async-promise-executor
|
|
210
|
+
'no-async-promise-executor': 'error',
|
|
211
|
+
|
|
212
|
+
// Disallow template literal placeholder syntax in regular strings
|
|
213
|
+
// https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
214
|
+
'no-template-curly-in-string': 'error'
|
|
181
215
|
}
|
|
182
216
|
}
|
package/rules/imports.mjs
CHANGED
|
@@ -24,6 +24,7 @@ if (tsConfig && tsConfig.config.compilerOptions.paths) {
|
|
|
24
24
|
* @type {import("eslint").Linter.Config}
|
|
25
25
|
*/
|
|
26
26
|
export default {
|
|
27
|
+
name: 'imports',
|
|
27
28
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
28
29
|
languageOptions: {
|
|
29
30
|
sourceType: 'module'
|
|
@@ -43,29 +44,29 @@ export default {
|
|
|
43
44
|
groups: [
|
|
44
45
|
[
|
|
45
46
|
// Anything that starts with react
|
|
46
|
-
//
|
|
47
|
-
//
|
|
47
|
+
// E.g: import { useState } from 'react'
|
|
48
|
+
// E.g: import { useFela } from 'react-fela'
|
|
48
49
|
'^react',
|
|
49
50
|
// Anything that starts with next
|
|
50
|
-
//
|
|
51
|
+
// E.g: import { useRouter } from 'next/router'
|
|
51
52
|
'^(next|@remix)',
|
|
52
53
|
// Anything that starts with a letter
|
|
53
|
-
//
|
|
54
|
+
// E.g: import Downshift from 'downshift'
|
|
54
55
|
'^[a-z]',
|
|
55
56
|
// Anything that starts with an alias (see jsconfig.json)
|
|
56
|
-
//
|
|
57
|
+
// E.g: import ListDropdown from '@shared/components/ListDropdown'
|
|
57
58
|
`^(${pathsNames.join('|')})(/.*|$)`,
|
|
58
59
|
// Anything that starts with @
|
|
59
|
-
//
|
|
60
|
+
// E.g: import { yupResolver } from '@hookform/resolvers/yup'
|
|
60
61
|
'^@',
|
|
61
62
|
// Anything that starts with a dot
|
|
62
|
-
//
|
|
63
|
+
// E.g: import { matchIsDate } from './utils/date
|
|
63
64
|
'^\\.',
|
|
64
65
|
// Side effect imports from lib
|
|
65
|
-
//
|
|
66
|
+
// E.g: import 'react-toastify/dist/ReactToastify.css'
|
|
66
67
|
'^\\u0000',
|
|
67
68
|
// Side effect import that starts with a dot
|
|
68
|
-
//
|
|
69
|
+
// E.g: import './setup-config'
|
|
69
70
|
'^\\u0000\\.'
|
|
70
71
|
]
|
|
71
72
|
]
|
package/rules/node.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import globals from 'globals'
|
|
|
4
4
|
* @type {import("eslint").Linter.Config}
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
7
|
+
name: 'node',
|
|
7
8
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
8
9
|
languageOptions: {
|
|
9
10
|
globals: {
|
|
@@ -12,7 +13,7 @@ export default {
|
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
rules: {
|
|
15
|
-
//
|
|
16
|
+
// Require all requires be top-level
|
|
16
17
|
// https://eslint.org/docs/rules/global-require
|
|
17
18
|
'global-require': 'error'
|
|
18
19
|
}
|
package/rules/react-hooks.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import globals from 'globals'
|
|
|
6
6
|
* @type {import("eslint").Linter.Config}
|
|
7
7
|
*/
|
|
8
8
|
export default {
|
|
9
|
+
name: 'react-hooks',
|
|
9
10
|
plugins: {
|
|
10
11
|
'react-hooks': pluginReactHooks
|
|
11
12
|
},
|
|
@@ -25,7 +26,7 @@ export default {
|
|
|
25
26
|
'react-hooks/exhaustive-deps': 'error',
|
|
26
27
|
|
|
27
28
|
// Prefer to have a convention for naming states
|
|
28
|
-
//
|
|
29
|
+
// E.g: [thing, setThing]
|
|
29
30
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
30
31
|
'react/hook-use-state': 'error'
|
|
31
32
|
}
|
package/rules/react.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import globals from 'globals'
|
|
|
9
9
|
export default [
|
|
10
10
|
jsxA11y.flatConfigs.recommended,
|
|
11
11
|
{
|
|
12
|
+
name: 'react',
|
|
12
13
|
plugins: {
|
|
13
14
|
react: pluginReact
|
|
14
15
|
},
|
|
@@ -37,7 +38,7 @@ export default [
|
|
|
37
38
|
// Forbid the use of Proptypes
|
|
38
39
|
'react/prop-types': 'off',
|
|
39
40
|
|
|
40
|
-
//
|
|
41
|
+
// DefaultProps is deprecated
|
|
41
42
|
'react/require-default-props': [
|
|
42
43
|
'error',
|
|
43
44
|
{
|
|
@@ -195,15 +196,15 @@ export default [
|
|
|
195
196
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
|
|
196
197
|
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
|
|
197
198
|
|
|
198
|
-
//
|
|
199
|
+
// Only .jsx files may have JSX
|
|
199
200
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
200
201
|
'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
|
|
201
202
|
|
|
202
|
-
//
|
|
203
|
+
// Prevent accidental JS comments from being injected into JSX as text
|
|
203
204
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
204
205
|
'react/jsx-no-comment-textnodes': 'error',
|
|
205
206
|
|
|
206
|
-
//
|
|
207
|
+
// Disallow using React.render/ReactDOM.render's return value
|
|
207
208
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
208
209
|
'react/no-render-return-value': 'error',
|
|
209
210
|
|
|
@@ -330,12 +331,12 @@ export default [
|
|
|
330
331
|
],
|
|
331
332
|
|
|
332
333
|
// This rule is turned off with the new JSX transform
|
|
333
|
-
//
|
|
334
|
+
// Since `eslint-plugin-react` is used.
|
|
334
335
|
// Ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform
|
|
335
336
|
'react/jsx-uses-react': 'off',
|
|
336
337
|
|
|
337
338
|
// This rule is turned off with the new JSX transform
|
|
338
|
-
//
|
|
339
|
+
// Since `eslint-plugin-react` is used.
|
|
339
340
|
// Ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform
|
|
340
341
|
'react/react-in-jsx-scope': 'off',
|
|
341
342
|
|
package/rules/style.mjs
CHANGED
|
@@ -2,13 +2,43 @@
|
|
|
2
2
|
* @type {import("eslint").Linter.Config}
|
|
3
3
|
*/
|
|
4
4
|
export default {
|
|
5
|
+
name: 'style',
|
|
5
6
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
6
7
|
rules: {
|
|
8
|
+
// Enforce camelcase naming convention
|
|
9
|
+
// https://eslint.org/docs/latest/rules/camelcase
|
|
10
|
+
camelcase: 'error',
|
|
11
|
+
|
|
12
|
+
// Enforce a maximum number of lines per file
|
|
13
|
+
// https://eslint.org/docs/rules/max-lines
|
|
14
|
+
'max-lines': ['error', 350],
|
|
15
|
+
|
|
16
|
+
// Enforce or disallow capitalization of the first letter of a comment
|
|
17
|
+
// https://eslint.org/docs/rules/capitalized-comments
|
|
18
|
+
'capitalized-comments': ['error', 'always'],
|
|
19
|
+
|
|
20
|
+
// "red" === color is a "Yoda" condition, prefer color === "red" instead
|
|
21
|
+
// https://eslint.org/docs/latest/rules/yoda
|
|
22
|
+
yoda: 'error',
|
|
23
|
+
|
|
24
|
+
// Disallow the unary operators ++ and --
|
|
25
|
+
// https://eslint.org/docs/latest/rules/no-plusplus
|
|
26
|
+
'no-plusplus': 'error',
|
|
27
|
+
|
|
28
|
+
// Disallow inline comments after code
|
|
29
|
+
// https://eslint.org/docs/latest/rules/no-inline-comments
|
|
30
|
+
'no-inline-comments': 'error',
|
|
31
|
+
|
|
32
|
+
// Require or disallow an empty line between class members
|
|
33
|
+
// https://eslint.org/docs/latest/rules/lines-between-class-members
|
|
7
34
|
'lines-between-class-members': ['error', 'always'],
|
|
35
|
+
|
|
36
|
+
// Require or disallow padding lines between statements
|
|
37
|
+
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
8
38
|
'padding-line-between-statements': [
|
|
9
39
|
2,
|
|
10
40
|
// We always want a blank line before a `return` statement or a multi-line
|
|
11
|
-
//
|
|
41
|
+
// Block.
|
|
12
42
|
{
|
|
13
43
|
blankLine: 'always',
|
|
14
44
|
prev: '*',
|
package/rules/typescript.mjs
CHANGED
|
@@ -13,6 +13,7 @@ const { rules: baseES6Rules } = es6Config
|
|
|
13
13
|
export default tseslint.config(
|
|
14
14
|
tseslint.configs.recommended,
|
|
15
15
|
{
|
|
16
|
+
name: 'typescript',
|
|
16
17
|
languageOptions: {
|
|
17
18
|
parserOptions: {
|
|
18
19
|
projectService: true,
|
|
@@ -88,9 +89,6 @@ export default tseslint.config(
|
|
|
88
89
|
'@typescript-eslint/no-useless-constructor':
|
|
89
90
|
baseES6Rules['no-useless-constructor'],
|
|
90
91
|
|
|
91
|
-
// Replace @viclafouch/eslint 'require-await' rule with '@typescript-eslint' version
|
|
92
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
93
|
-
'require-await': 'off',
|
|
94
92
|
'@typescript-eslint/require-await': baseES6Rules['require-await'],
|
|
95
93
|
|
|
96
94
|
// Replace @viclafouch/eslint 'no-return-await' rule with '@typescript-eslint' version
|
|
@@ -151,13 +149,13 @@ export default tseslint.config(
|
|
|
151
149
|
// '@typescript-eslint/ban-types': [
|
|
152
150
|
// 'error',
|
|
153
151
|
// {
|
|
154
|
-
//
|
|
152
|
+
// Types: {
|
|
155
153
|
// // Omit is not strict enought
|
|
156
154
|
// Omit: {
|
|
157
155
|
// // https://twitter.com/erikras/status/1673694889974833152
|
|
158
|
-
//
|
|
156
|
+
// Message:
|
|
159
157
|
// 'Use StrictOmit instead by using reset.d.ts from @viclafouch/eslint-config-viclafouch/reset.d. See https://github.com/viclafouch/eslint-config-viclafouch#better-typing',
|
|
160
|
-
//
|
|
158
|
+
// FixWith: 'StrictOmit'
|
|
161
159
|
// }
|
|
162
160
|
// }
|
|
163
161
|
// }
|
|
@@ -175,23 +173,32 @@ export default tseslint.config(
|
|
|
175
173
|
// Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
|
|
176
174
|
// Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
|
|
177
175
|
'constructor-super': 'off',
|
|
178
|
-
'getter-return': 'off',
|
|
179
176
|
'no-const-assign': 'off',
|
|
177
|
+
// https://eslint.org/docs/latest/rules/no-dupe-args#handled_by_typescript
|
|
180
178
|
'no-dupe-args': 'off',
|
|
179
|
+
// https://eslint.org/docs/latest/rules/no-dupe-class-members#handled_by_typescript
|
|
181
180
|
'no-dupe-class-members': 'off',
|
|
181
|
+
// https://eslint.org/docs/latest/rules/no-dupe-keys#handled_by_typescript
|
|
182
182
|
'no-dupe-keys': 'off',
|
|
183
|
+
// https://eslint.org/docs/latest/rules/no-func-assign#handled_by_typescript
|
|
183
184
|
'no-func-assign': 'off',
|
|
185
|
+
// https://eslint.org/docs/latest/rules/no-import-assign#handled_by_typescript
|
|
184
186
|
'no-import-assign': 'off',
|
|
187
|
+
// https://eslint.org/docs/latest/rules/no-new-native-nonconstructor#handled_by_typescript
|
|
188
|
+
'no-new-native-nonconstructor': 'off',
|
|
185
189
|
'no-new-symbol': 'off',
|
|
186
190
|
'no-obj-calls': 'off',
|
|
187
191
|
'no-redeclare': 'off',
|
|
192
|
+
// https://eslint.org/docs/latest/rules/no-setter-return#handled_by_typescript
|
|
188
193
|
'no-setter-return': 'off',
|
|
194
|
+
// https://eslint.org/docs/latest/rules/no-this-before-super#handled_by_typescript
|
|
189
195
|
'no-this-before-super': 'off',
|
|
190
|
-
// https://
|
|
196
|
+
// https://eslint.org/docs/latest/rules/no-undef#handled_by_typescript
|
|
191
197
|
'no-undef': 'off',
|
|
198
|
+
// https://eslint.org/docs/latest/rules/no-unreachable#handled_by_typescript
|
|
192
199
|
'no-unreachable': 'off',
|
|
200
|
+
// https://eslint.org/docs/latest/rules/no-unsafe-negation#handled_by_typescript
|
|
193
201
|
'no-unsafe-negation': 'off',
|
|
194
|
-
'valid-typeof': 'off',
|
|
195
202
|
// The following rules are enabled in @viclafouch/eslint config, but are recommended to be disabled within TypeScript projects
|
|
196
203
|
// See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
|
|
197
204
|
'import/named': 'off',
|
package/rules/variables.mjs
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
* @type {import("eslint").Linter.Config}
|
|
3
3
|
*/
|
|
4
4
|
export default {
|
|
5
|
+
name: 'variables',
|
|
5
6
|
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
6
7
|
rules: {
|
|
7
|
-
//
|
|
8
|
+
// Enforce or disallow variable initializations at definition
|
|
8
9
|
'init-declarations': 'off',
|
|
9
10
|
|
|
10
|
-
//
|
|
11
|
+
// Disallow the catch clause parameter name being the same as a variable in the outer scope
|
|
11
12
|
'no-catch-shadow': 'off',
|
|
12
13
|
|
|
13
|
-
//
|
|
14
|
+
// Disallow deletion of variables
|
|
15
|
+
// https://eslint.org/docs/latest/rules/no-delete-var
|
|
14
16
|
'no-delete-var': 'error',
|
|
15
17
|
|
|
16
|
-
//
|
|
18
|
+
// Disallow labels that share a name with a variable
|
|
17
19
|
// https://eslint.org/docs/rules/no-label-var
|
|
18
20
|
'no-label-var': 'error',
|
|
19
21
|
|
|
20
|
-
//
|
|
22
|
+
// Disallow declaration of variables already declared in the outer scope
|
|
21
23
|
'no-shadow': 'error',
|
|
22
24
|
|
|
23
25
|
// For code readability, prevent creating unclear naming
|
|
@@ -34,13 +36,13 @@ export default {
|
|
|
34
36
|
// Ref: https://eslint.org/docs/rules/object-shorthand
|
|
35
37
|
'object-shorthand': [2, 'properties'],
|
|
36
38
|
|
|
37
|
-
//
|
|
39
|
+
// Disallow shadowing of names such as arguments
|
|
38
40
|
'no-shadow-restricted-names': 'error',
|
|
39
41
|
|
|
40
|
-
//
|
|
41
|
-
'no-undef': 'error',
|
|
42
|
+
// Disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
43
|
+
'no-undef': ['error', { typeof: true }],
|
|
42
44
|
|
|
43
|
-
//
|
|
45
|
+
// Disallow use of undefined when initializing variables
|
|
44
46
|
'no-undef-init': 'error',
|
|
45
47
|
|
|
46
48
|
// Most common naming that is not always understandable
|
|
@@ -61,7 +63,7 @@ export default {
|
|
|
61
63
|
'str'
|
|
62
64
|
],
|
|
63
65
|
|
|
64
|
-
//
|
|
66
|
+
// Disallow declaration of variables that are not used in the code
|
|
65
67
|
'no-unused-vars': [
|
|
66
68
|
'error',
|
|
67
69
|
{
|
|
@@ -73,7 +75,7 @@ export default {
|
|
|
73
75
|
}
|
|
74
76
|
],
|
|
75
77
|
|
|
76
|
-
//
|
|
78
|
+
// Disallow use of variables before they are defined
|
|
77
79
|
'no-use-before-define': [
|
|
78
80
|
'error',
|
|
79
81
|
{ functions: true, classes: true, variables: true }
|