@mikey-pro/eslint-config 8.0.14 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rules.js +58 -102
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config",
3
- "version": "8.0.14",
3
+ "version": "8.0.15",
4
4
  "description": "Mikey Pro ESLint configuration",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
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
@@ -193,8 +201,23 @@ export const baseRules = {
193
201
  'promise/prefer-await-to-callbacks': 'warn',
194
202
 
195
203
  // Security
196
- 'security/detect-non-literal-fs-filename': 'warn',
197
- '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',
198
221
 
199
222
  // Better testing
200
223
  'jest/prefer-spy-on': 'warn',
@@ -217,7 +240,9 @@ export const baseRules = {
217
240
  'etc/prefer-interface': 'error',
218
241
 
219
242
  // Enhanced Import Rules
220
- 'import/no-relative-parent-imports': 'warn',
243
+ 'import/no-relative-parent-imports': ['error', {
244
+ ignore: ['@/components', '@/utils', '@/types']
245
+ }],
221
246
  'import/no-extraneous-dependencies': ['error', {
222
247
  devDependencies: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}', '**/test/**']
223
248
  }],
@@ -226,11 +251,6 @@ export const baseRules = {
226
251
  'promise/no-nesting': 'warn',
227
252
  'promise/prefer-await-to-then': 'warn',
228
253
 
229
- // Security Enhancements
230
- 'security/detect-buffer-noassert': 'error',
231
- 'security/detect-child-process': 'warn',
232
- 'security/detect-disable-mustache-escape': 'error',
233
-
234
254
  // Code Organization
235
255
  'typescript-sort-keys/interface': 'warn',
236
256
  'typescript-sort-keys/string-enum': 'warn',
@@ -242,14 +262,17 @@ export const baseRules = {
242
262
  'sonarjs/no-duplicated-branches': 'error',
243
263
  'sonarjs/max-switch-cases': ['warn', 10],
244
264
 
245
- // Additional Security
246
- 'security/detect-possible-timing-attacks': ['error', { threshold: 10 }],
247
- 'security/detect-non-literal-regexp': ['error', { report: 'error' }],
248
- 'security/detect-non-literal-require': 'error',
249
-
250
- // Better Type Safety
265
+ // Import Safety
266
+ 'import/no-cycle': ['error', {
267
+ maxDepth: 1,
268
+ ignoreExternal: true
269
+ }],
251
270
  'import/no-relative-packages': 'error',
252
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',
253
276
 
254
277
  // Architecture Boundaries
255
278
  'boundaries/element-types': [
@@ -270,87 +293,6 @@ export const baseRules = {
270
293
  'radar/cognitive-complexity': ['error', 15],
271
294
 
272
295
  // Enhanced Security
273
- 'security/detect-non-literal-fs-filename': ['error', { allowInlineConfig: false }],
274
- 'security/detect-unsafe-regex': ['error', { allowDollarMatchAll: false }],
275
- 'security/detect-buffer-noassert': 'error',
276
-
277
- // Better Type Safety
278
- 'import/no-cycle': ['error', { maxDepth: 1 }],
279
- 'import/no-relative-packages': 'error',
280
- 'unicorn/prefer-module': 'error',
281
-
282
- // Code Style
283
- 'perfectionist/sort-named-imports': [
284
- 'warn',
285
- {
286
- type: 'natural',
287
- order: 'asc',
288
- 'ignore-case': true
289
- }
290
- ],
291
-
292
- // Enhanced Security
293
- 'security/detect-possible-timing-attacks': ['error', {
294
- threshold: 8,
295
- catchAliases: true
296
- }],
297
- 'security/detect-non-literal-regexp': ['error', {
298
- report: 'error',
299
- warnOnDynamicRegexp: true
300
- }],
301
- 'security/detect-unsafe-regex': ['error', {
302
- maxLength: 50
303
- }],
304
-
305
- // Import Safety
306
- 'import/no-import-module-exports': 'error',
307
- 'import/no-relative-parent-imports': ['error', {
308
- ignore: ['@/components', '@/utils', '@/types']
309
- }],
310
-
311
- // Better Code Organization
312
- 'perfectionist/sort-objects': ['error', {
313
- type: 'natural',
314
- order: 'asc',
315
- 'spread-last': true
316
- }],
317
- 'perfectionist/sort-named-imports': ['error', {
318
- type: 'natural',
319
- order: 'asc',
320
- 'ignore-case': true
321
- }],
322
-
323
- // Advanced Performance
324
- 'no-restricted-syntax': [
325
- 'error',
326
- {
327
- selector: "CallExpression[callee.property.name='reduce'][arguments.length<2]",
328
- message: 'Provide initialValue to reduce'
329
- },
330
- {
331
- selector: "CallExpression[callee.property.name='forEach']",
332
- message: 'Use for...of instead'
333
- }
334
- ],
335
- 'require-atomic-updates': ['error', { allowProperties: false }],
336
- 'no-constant-binary-expression': 'error',
337
-
338
- // Better Error Handling
339
- 'no-implicit-coercion': ['error', { boolean: false, number: true, string: true }],
340
- 'unicorn/prefer-type-error': 'error',
341
- 'unicorn/no-useless-undefined': ['error', { checkArguments: true }],
342
-
343
- // Enhanced Import Safety
344
- 'import/no-cycle': ['error', { maxDepth: 1, ignoreExternal: true }],
345
- 'import/no-relative-packages': 'error',
346
- 'import/no-self-import': 'error',
347
-
348
- // Type Safety
349
- 'unicorn/prefer-at': 'error',
350
- 'unicorn/prefer-string-replace-all': 'error',
351
- 'unicorn/require-post-message-target-origin': 'error',
352
-
353
- // Security
354
296
  'n/no-unsupported-features/es-syntax': ['error', {
355
297
  version: '>=18.0.0',
356
298
  ignores: ['modules', 'dynamicImport']
@@ -369,11 +311,25 @@ export const baseRules = {
369
311
 
370
312
  // Better Error Handling
371
313
  'max-classes-per-file': ['error', 1],
372
- 'no-promise-executor-return': ['error', { allowVoid: true }],
373
314
  'unicorn/catch-error-name': ['error', { name: 'error' }],
315
+ 'unicorn/no-useless-undefined': ['error', { checkArguments: true }],
316
+ 'unicorn/prefer-type-error': 'error',
374
317
 
375
- // Enhanced Import Safety
376
- 'import/no-namespace': 'error',
377
- 'import/no-empty-named-blocks': 'error',
378
- 'import/no-duplicates': ['error', { 'prefer-inline': true }]
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'
379
335
  };