@mikey-pro/eslint-config 8.0.13 → 8.0.15
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/package.json +1 -1
- package/rules.js +58 -103
package/package.json
CHANGED
package/rules.js
CHANGED
|
@@ -73,6 +73,14 @@ export const baseRules = {
|
|
|
73
73
|
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
|
74
74
|
selector: 'WithStatement',
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
selector: "CallExpression[callee.property.name='reduce'][arguments.length<2]",
|
|
78
|
+
message: 'Provide initialValue to reduce'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
selector: "CallExpression[callee.property.name='forEach']",
|
|
82
|
+
message: 'Use for...of instead'
|
|
83
|
+
}
|
|
76
84
|
],
|
|
77
85
|
'no-shadow': 'off',
|
|
78
86
|
'no-shadow-restricted-names': 'warn',
|
|
@@ -122,7 +130,7 @@ export const baseRules = {
|
|
|
122
130
|
],
|
|
123
131
|
radix: 'warn',
|
|
124
132
|
'filenames/match-regex': 'off',
|
|
125
|
-
'require-atomic-updates': 'error',
|
|
133
|
+
'require-atomic-updates': ['error', { allowProperties: false }],
|
|
126
134
|
'sort-imports': 'off',
|
|
127
135
|
'rest-spread-spacing': 'off',
|
|
128
136
|
semi: 'off',
|
|
@@ -176,7 +184,7 @@ export const baseRules = {
|
|
|
176
184
|
|
|
177
185
|
// Error handling
|
|
178
186
|
'no-await-in-loop': 'warn',
|
|
179
|
-
'no-promise-executor-return': 'error',
|
|
187
|
+
'no-promise-executor-return': ['error', { allowVoid: true }],
|
|
180
188
|
'no-unsafe-optional-chaining': 'error',
|
|
181
189
|
|
|
182
190
|
// Modern practices
|
|
@@ -187,15 +195,29 @@ export const baseRules = {
|
|
|
187
195
|
// Import rules
|
|
188
196
|
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
|
189
197
|
'import/no-empty-named-blocks': 'error',
|
|
190
|
-
'import/no-reserved-dependencies': 'error',
|
|
191
198
|
|
|
192
199
|
// Better promises
|
|
193
200
|
'promise/no-multiple-resolved': 'error',
|
|
194
201
|
'promise/prefer-await-to-callbacks': 'warn',
|
|
195
202
|
|
|
196
203
|
// Security
|
|
197
|
-
'security/detect-non-literal-fs-filename': '
|
|
198
|
-
'security/detect-unsafe-regex': 'error',
|
|
204
|
+
'security/detect-non-literal-fs-filename': 'error',
|
|
205
|
+
'security/detect-unsafe-regex': ['error', {
|
|
206
|
+
allowDollarMatchAll: false,
|
|
207
|
+
maxLength: 50
|
|
208
|
+
}],
|
|
209
|
+
'security/detect-buffer-noassert': 'error',
|
|
210
|
+
'security/detect-child-process': 'warn',
|
|
211
|
+
'security/detect-disable-mustache-escape': 'error',
|
|
212
|
+
'security/detect-possible-timing-attacks': ['error', {
|
|
213
|
+
threshold: 8,
|
|
214
|
+
catchAliases: true
|
|
215
|
+
}],
|
|
216
|
+
'security/detect-non-literal-regexp': ['error', {
|
|
217
|
+
report: 'error',
|
|
218
|
+
warnOnDynamicRegexp: true
|
|
219
|
+
}],
|
|
220
|
+
'security/detect-non-literal-require': 'error',
|
|
199
221
|
|
|
200
222
|
// Better testing
|
|
201
223
|
'jest/prefer-spy-on': 'warn',
|
|
@@ -218,7 +240,9 @@ export const baseRules = {
|
|
|
218
240
|
'etc/prefer-interface': 'error',
|
|
219
241
|
|
|
220
242
|
// Enhanced Import Rules
|
|
221
|
-
'import/no-relative-parent-imports': '
|
|
243
|
+
'import/no-relative-parent-imports': ['error', {
|
|
244
|
+
ignore: ['@/components', '@/utils', '@/types']
|
|
245
|
+
}],
|
|
222
246
|
'import/no-extraneous-dependencies': ['error', {
|
|
223
247
|
devDependencies: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}', '**/test/**']
|
|
224
248
|
}],
|
|
@@ -227,11 +251,6 @@ export const baseRules = {
|
|
|
227
251
|
'promise/no-nesting': 'warn',
|
|
228
252
|
'promise/prefer-await-to-then': 'warn',
|
|
229
253
|
|
|
230
|
-
// Security Enhancements
|
|
231
|
-
'security/detect-buffer-noassert': 'error',
|
|
232
|
-
'security/detect-child-process': 'warn',
|
|
233
|
-
'security/detect-disable-mustache-escape': 'error',
|
|
234
|
-
|
|
235
254
|
// Code Organization
|
|
236
255
|
'typescript-sort-keys/interface': 'warn',
|
|
237
256
|
'typescript-sort-keys/string-enum': 'warn',
|
|
@@ -243,14 +262,17 @@ export const baseRules = {
|
|
|
243
262
|
'sonarjs/no-duplicated-branches': 'error',
|
|
244
263
|
'sonarjs/max-switch-cases': ['warn', 10],
|
|
245
264
|
|
|
246
|
-
//
|
|
247
|
-
'
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// Better Type Safety
|
|
265
|
+
// Import Safety
|
|
266
|
+
'import/no-cycle': ['error', {
|
|
267
|
+
maxDepth: 1,
|
|
268
|
+
ignoreExternal: true
|
|
269
|
+
}],
|
|
252
270
|
'import/no-relative-packages': 'error',
|
|
253
271
|
'import/no-self-import': 'error',
|
|
272
|
+
'import/no-namespace': 'error',
|
|
273
|
+
'import/no-empty-named-blocks': 'error',
|
|
274
|
+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
275
|
+
'import/no-import-module-exports': 'error',
|
|
254
276
|
|
|
255
277
|
// Architecture Boundaries
|
|
256
278
|
'boundaries/element-types': [
|
|
@@ -271,87 +293,6 @@ export const baseRules = {
|
|
|
271
293
|
'radar/cognitive-complexity': ['error', 15],
|
|
272
294
|
|
|
273
295
|
// Enhanced Security
|
|
274
|
-
'security/detect-non-literal-fs-filename': ['error', { allowInlineConfig: false }],
|
|
275
|
-
'security/detect-unsafe-regex': ['error', { allowDollarMatchAll: false }],
|
|
276
|
-
'security/detect-buffer-noassert': 'error',
|
|
277
|
-
|
|
278
|
-
// Better Type Safety
|
|
279
|
-
'import/no-cycle': ['error', { maxDepth: 1 }],
|
|
280
|
-
'import/no-relative-packages': 'error',
|
|
281
|
-
'unicorn/prefer-module': 'error',
|
|
282
|
-
|
|
283
|
-
// Code Style
|
|
284
|
-
'perfectionist/sort-named-imports': [
|
|
285
|
-
'warn',
|
|
286
|
-
{
|
|
287
|
-
type: 'natural',
|
|
288
|
-
order: 'asc',
|
|
289
|
-
'ignore-case': true
|
|
290
|
-
}
|
|
291
|
-
],
|
|
292
|
-
|
|
293
|
-
// Enhanced Security
|
|
294
|
-
'security/detect-possible-timing-attacks': ['error', {
|
|
295
|
-
threshold: 8,
|
|
296
|
-
catchAliases: true
|
|
297
|
-
}],
|
|
298
|
-
'security/detect-non-literal-regexp': ['error', {
|
|
299
|
-
report: 'error',
|
|
300
|
-
warnOnDynamicRegexp: true
|
|
301
|
-
}],
|
|
302
|
-
'security/detect-unsafe-regex': ['error', {
|
|
303
|
-
maxLength: 50
|
|
304
|
-
}],
|
|
305
|
-
|
|
306
|
-
// Import Safety
|
|
307
|
-
'import/no-import-module-exports': 'error',
|
|
308
|
-
'import/no-relative-parent-imports': ['error', {
|
|
309
|
-
ignore: ['@/components', '@/utils', '@/types']
|
|
310
|
-
}],
|
|
311
|
-
|
|
312
|
-
// Better Code Organization
|
|
313
|
-
'perfectionist/sort-objects': ['error', {
|
|
314
|
-
type: 'natural',
|
|
315
|
-
order: 'asc',
|
|
316
|
-
'spread-last': true
|
|
317
|
-
}],
|
|
318
|
-
'perfectionist/sort-named-imports': ['error', {
|
|
319
|
-
type: 'natural',
|
|
320
|
-
order: 'asc',
|
|
321
|
-
'ignore-case': true
|
|
322
|
-
}],
|
|
323
|
-
|
|
324
|
-
// Advanced Performance
|
|
325
|
-
'no-restricted-syntax': [
|
|
326
|
-
'error',
|
|
327
|
-
{
|
|
328
|
-
selector: "CallExpression[callee.property.name='reduce'][arguments.length<2]",
|
|
329
|
-
message: 'Provide initialValue to reduce'
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
selector: "CallExpression[callee.property.name='forEach']",
|
|
333
|
-
message: 'Use for...of instead'
|
|
334
|
-
}
|
|
335
|
-
],
|
|
336
|
-
'require-atomic-updates': ['error', { allowProperties: false }],
|
|
337
|
-
'no-constant-binary-expression': 'error',
|
|
338
|
-
|
|
339
|
-
// Better Error Handling
|
|
340
|
-
'no-implicit-coercion': ['error', { boolean: false, number: true, string: true }],
|
|
341
|
-
'unicorn/prefer-type-error': 'error',
|
|
342
|
-
'unicorn/no-useless-undefined': ['error', { checkArguments: true }],
|
|
343
|
-
|
|
344
|
-
// Enhanced Import Safety
|
|
345
|
-
'import/no-cycle': ['error', { maxDepth: 1, ignoreExternal: true }],
|
|
346
|
-
'import/no-relative-packages': 'error',
|
|
347
|
-
'import/no-self-import': 'error',
|
|
348
|
-
|
|
349
|
-
// Type Safety
|
|
350
|
-
'unicorn/prefer-at': 'error',
|
|
351
|
-
'unicorn/prefer-string-replace-all': 'error',
|
|
352
|
-
'unicorn/require-post-message-target-origin': 'error',
|
|
353
|
-
|
|
354
|
-
// Security
|
|
355
296
|
'n/no-unsupported-features/es-syntax': ['error', {
|
|
356
297
|
version: '>=18.0.0',
|
|
357
298
|
ignores: ['modules', 'dynamicImport']
|
|
@@ -370,11 +311,25 @@ export const baseRules = {
|
|
|
370
311
|
|
|
371
312
|
// Better Error Handling
|
|
372
313
|
'max-classes-per-file': ['error', 1],
|
|
373
|
-
'no-promise-executor-return': ['error', { allowVoid: true }],
|
|
374
314
|
'unicorn/catch-error-name': ['error', { name: 'error' }],
|
|
315
|
+
'unicorn/no-useless-undefined': ['error', { checkArguments: true }],
|
|
316
|
+
'unicorn/prefer-type-error': 'error',
|
|
375
317
|
|
|
376
|
-
//
|
|
377
|
-
'
|
|
378
|
-
|
|
379
|
-
|
|
318
|
+
// Code Style
|
|
319
|
+
'perfectionist/sort-named-imports': ['error', {
|
|
320
|
+
type: 'natural',
|
|
321
|
+
order: 'asc',
|
|
322
|
+
'ignore-case': true
|
|
323
|
+
}],
|
|
324
|
+
'perfectionist/sort-objects': ['error', {
|
|
325
|
+
type: 'natural',
|
|
326
|
+
order: 'asc',
|
|
327
|
+
'spread-last': true
|
|
328
|
+
}],
|
|
329
|
+
|
|
330
|
+
// Advanced Performance
|
|
331
|
+
'no-implicit-coercion': ['error', { boolean: false, number: true, string: true }],
|
|
332
|
+
'unicorn/prefer-at': 'error',
|
|
333
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
334
|
+
'unicorn/require-post-message-target-origin': 'error'
|
|
380
335
|
};
|