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