@mikey-pro/eslint-config 9.0.8 → 10.0.0

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/base-config.js CHANGED
@@ -1,22 +1,21 @@
1
1
  // Base configuration for Mikey Pro ESLint
2
2
  import js from '@eslint/js';
3
3
  import html from '@html-eslint/eslint-plugin';
4
+ import htmlParser from '@html-eslint/parser';
5
+ import markdown from '@eslint/markdown';
6
+ import tsPlugin from '@typescript-eslint/eslint-plugin';
7
+ import tsParser from '@typescript-eslint/parser';
4
8
  import boundaries from 'eslint-plugin-boundaries';
5
9
  import compat from 'eslint-plugin-compat';
6
- import cssModules from 'eslint-plugin-css-modules';
7
10
  import cypress from 'eslint-plugin-cypress';
8
- import filenames from 'eslint-plugin-filenames';
9
- import importPlugin from 'eslint-plugin-import';
11
+ import importX from 'eslint-plugin-import-x';
10
12
  import jest from 'eslint-plugin-jest';
11
13
  import jestDom from 'eslint-plugin-jest-dom';
12
14
  import jsonc from 'eslint-plugin-jsonc';
13
- import markdownlint from 'eslint-plugin-markdownlint';
14
- import markdown from '@eslint/markdown';
15
15
  import nPlugin from 'eslint-plugin-n';
16
16
  import noOnlyTests from 'eslint-plugin-no-only-tests';
17
17
  import noSecrets from 'eslint-plugin-no-secrets';
18
- import onlyWarn from 'eslint-plugin-only-warn';
19
- import optimizeRegex from 'eslint-plugin-optimize-regex';
18
+
20
19
  import perfectionist from 'eslint-plugin-perfectionist';
21
20
  import prettier from 'eslint-plugin-prettier';
22
21
  import promise from 'eslint-plugin-promise';
@@ -28,43 +27,26 @@ import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
28
27
  import testingLibrary from 'eslint-plugin-testing-library';
29
28
  import toml from 'eslint-plugin-toml';
30
29
  import unicorn from 'eslint-plugin-unicorn';
31
- import writeGoodComments from 'eslint-plugin-write-good-comments';
32
30
  import yml from 'eslint-plugin-yml';
33
31
  import globals from 'globals';
34
32
 
35
- export const baseConfig = {
36
- files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
37
- languageOptions: {
38
- ecmaVersion: 'latest',
39
- globals: {
40
- ...globals.browser,
41
- ...globals.node,
42
- ...globals.es2022,
43
- },
44
- sourceType: 'module',
45
- },
46
- linterOptions: {
47
- noInlineConfig: true,
48
- reportUnusedDisableDirectives: true,
49
- },
33
+ // Global plugin registration — available to all config objects
34
+ // No `files` restriction so plugins are accessible everywhere
35
+ export const globalPlugins = {
50
36
  plugins: {
37
+ '@html-eslint': html,
38
+ '@typescript-eslint': tsPlugin,
51
39
  boundaries,
52
40
  compat,
53
- 'css-modules': cssModules,
54
41
  cypress,
55
- filenames,
56
- html,
57
- import: importPlugin,
42
+ 'import-x': importX,
58
43
  jest,
59
44
  'jest-dom': jestDom,
60
45
  jsonc,
61
46
  markdown,
62
- markdownlint,
63
47
  n: nPlugin,
64
48
  'no-only-tests': noOnlyTests,
65
49
  'no-secrets': noSecrets,
66
- 'only-warn': onlyWarn,
67
- 'optimize-regex': optimizeRegex,
68
50
  perfectionist,
69
51
  prettier,
70
52
  promise,
@@ -73,33 +55,65 @@ export const baseConfig = {
73
55
  'simple-import-sort': importSort,
74
56
  sonarjs,
75
57
  'sort-destructure-keys': sortDestructureKeys,
76
- testing: testingLibrary,
58
+ 'testing-library': testingLibrary,
77
59
  toml,
78
60
  unicorn,
79
- 'write-good-comments': writeGoodComments,
80
61
  yml,
81
62
  },
63
+ };
64
+
65
+ export const baseConfig = {
66
+ files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
67
+ languageOptions: {
68
+ ecmaVersion: 'latest',
69
+ globals: {
70
+ ...globals.browser,
71
+ ...globals.node,
72
+ ...globals.es2022,
73
+ },
74
+ sourceType: 'module',
75
+ },
76
+ linterOptions: {
77
+ noInlineConfig: true,
78
+ reportUnusedDisableDirectives: true,
79
+ },
82
80
  rules: {
83
81
  // Core ESLint rules
84
82
  ...js.configs.recommended.rules,
85
83
 
84
+ // Core ESLint best practices
85
+ 'accessor-pairs': 'error',
86
+ 'array-callback-return': 'error',
87
+ 'block-scoped-var': 'error',
88
+ 'consistent-return': 'error',
89
+ curly: ['error', 'all'],
90
+ 'default-case': 'error',
91
+ 'default-case-last': 'error',
92
+ 'default-param-last': 'error',
93
+ 'dot-notation': 'warn',
94
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
95
+ 'grouped-accessor-pairs': 'error',
96
+ 'guard-for-in': 'error',
97
+
86
98
  // Import/Export rules
87
- 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
88
- 'import/default': 'off',
89
- 'import/extensions': [
99
+ 'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
100
+ 'import-x/default': 'off',
101
+ 'import-x/export': 'error',
102
+ 'import-x/extensions': [
90
103
  'error',
91
104
  'ignorePackages',
92
105
  { ts: 'never', tsx: 'never' },
93
106
  ],
94
- 'import/first': 'error',
95
- 'import/named': 'off',
96
- 'import/namespace': 'off',
97
- 'import/no-absolute-path': 'error',
98
- 'import/no-cycle': ['error', { ignoreExternal: true, maxDepth: 1 }],
99
- 'import/no-duplicates': ['error', { 'prefer-inline': true }],
100
- 'import/no-dynamic-require': 'error',
101
- 'import/no-empty-named-blocks': 'error',
102
- 'import/no-extraneous-dependencies': [
107
+ 'import-x/first': 'error',
108
+ 'import-x/named': 'off',
109
+ 'import-x/namespace': 'off',
110
+ 'import-x/newline-after-import': 'error',
111
+ 'import-x/no-absolute-path': 'error',
112
+ 'import-x/no-cycle': ['error', { ignoreExternal: true, maxDepth: 1 }],
113
+ 'import-x/no-duplicates': ['error', { 'prefer-inline': true }],
114
+ 'import-x/no-dynamic-require': 'error',
115
+ 'import-x/no-empty-named-blocks': 'error',
116
+ 'import-x/no-extraneous-dependencies': [
103
117
  'error',
104
118
  {
105
119
  devDependencies: [
@@ -109,20 +123,24 @@ export const baseConfig = {
109
123
  ],
110
124
  },
111
125
  ],
112
- 'import/no-import-module-exports': 'error',
113
- 'import/no-named-as-default-member': 'off',
114
- 'import/no-namespace': 'error',
115
- 'import/no-relative-packages': 'error',
116
- 'import/no-relative-parent-imports': [
126
+ 'import-x/no-import-module-exports': 'error',
127
+ 'import-x/no-mutable-exports': 'error',
128
+ 'import-x/no-named-as-default-member': 'off',
129
+ 'import-x/no-named-default': 'error',
130
+ 'import-x/no-namespace': 'error',
131
+ 'import-x/no-relative-packages': 'error',
132
+ 'import-x/no-relative-parent-imports': [
117
133
  'error',
118
134
  { ignore: ['@/components', '@/utils', '@/types'] },
119
135
  ],
120
- 'import/no-self-import': 'error',
121
- 'import/no-unresolved': [
136
+ 'import-x/no-self-import': 'error',
137
+ 'import-x/no-unresolved': [
122
138
  'error',
123
139
  { amd: true, commonjs: true, ignore: ['^node:'] },
124
140
  ],
125
- 'import/order': [
141
+ 'import-x/no-useless-path-segments': 'error',
142
+ 'import-x/no-webpack-loader-syntax': 'error',
143
+ 'import-x/order': [
126
144
  'error',
127
145
  {
128
146
  alphabetize: { order: 'asc' },
@@ -152,42 +170,66 @@ export const baseConfig = {
152
170
 
153
171
  // Unicorn rules for modern JavaScript
154
172
  ...unicorn.configs.all.rules,
173
+ // Compatibility rules
174
+ 'compat/compat': 'warn',
175
+
155
176
  // Code quality rules
156
- complexity: ['error', { max: 15 }],
177
+ complexity: ['error', { max: 12 }],
157
178
  'max-classes-per-file': ['error', 1],
158
- 'max-depth': ['error', 4],
179
+ 'max-depth': ['error', 3],
159
180
  'max-lines': [
160
181
  'error',
161
- { max: 500, skipBlankLines: true, skipComments: true },
182
+ { max: 300, skipBlankLines: true, skipComments: true },
162
183
  ],
163
184
  'max-lines-per-function': [
164
185
  'error',
165
186
  { max: 50, skipBlankLines: true, skipComments: true },
166
187
  ],
167
- 'max-params': ['error', 4],
188
+ 'max-params': ['error', 3],
189
+ // Node.js rules
190
+ 'n/no-unsupported-features/es-syntax': [
191
+ 'error',
192
+ {
193
+ ignores: ['modules', 'dynamicImport'],
194
+ version: '>=20.0.0',
195
+ },
196
+ ],
197
+
198
+ 'no-alert': 'warn',
168
199
  'no-array-constructor': 'error',
169
200
  'no-await-in-loop': 'warn',
201
+ 'no-bitwise': 'error',
170
202
  'no-caller': 'warn',
203
+ 'no-console': 'warn',
171
204
  'no-constant-binary-expression': 'error',
172
205
  'no-constant-condition': 'error',
173
206
  'no-constructor-return': 'error',
174
-
207
+ 'no-continue': 'error',
208
+ 'no-div-regex': 'error',
175
209
  'no-duplicate-imports': 'error',
176
210
  'no-else-return': 'warn',
177
211
  'no-empty': 'off',
178
212
  'no-empty-pattern': 'off',
213
+ 'no-eq-null': 'error',
179
214
  'no-eval': 'error',
180
215
  'no-extend-native': 'error',
181
216
  'no-extra-bind': 'warn',
182
217
  'no-floating-decimal': 'warn',
183
-
184
218
  'no-implicit-coercion': [
185
219
  'error',
186
220
  { boolean: false, number: true, string: true },
187
221
  ],
222
+ 'no-implicit-globals': 'error',
223
+ 'no-implied-eval': 'error',
188
224
  'no-iterator': 'warn',
225
+ 'no-lone-blocks': 'error',
189
226
  'no-lonely-if': 'warn',
227
+ 'no-loop-func': 'error',
228
+ 'no-multi-assign': 'error',
190
229
  'no-multi-str': 'warn',
230
+ 'no-nested-ternary': 'error',
231
+ 'no-new': 'error',
232
+ 'no-new-func': 'error',
191
233
  'no-new-object': 'error',
192
234
  'no-new-wrappers': 'warn',
193
235
  'no-octal-escape': 'error',
@@ -196,11 +238,34 @@ export const baseConfig = {
196
238
  'no-param-reassign': 'warn',
197
239
  'no-promise-executor-return': ['error', { allowVoid: true }],
198
240
  'no-proto': 'warn',
241
+ 'no-restricted-syntax': [
242
+ 'warn',
243
+ {
244
+ message:
245
+ 'for..in loops iterate over the entire prototype chain. Use Object.{keys,values,entries} instead.',
246
+ selector: 'ForInStatement',
247
+ },
248
+ {
249
+ message: 'Labels are a form of GOTO; using them makes code confusing.',
250
+ selector: 'LabeledStatement',
251
+ },
252
+ {
253
+ message: '`with` is disallowed in strict mode.',
254
+ selector: 'WithStatement',
255
+ },
256
+ {
257
+ message: 'Provide initialValue to reduce.',
258
+ selector:
259
+ "CallExpression[callee.property.name='reduce'][arguments.length<2]",
260
+ },
261
+ ],
199
262
  'no-return-assign': 'error',
200
263
  'no-return-await': 'error',
264
+ 'no-script-url': 'error',
201
265
  'no-secrets/no-secrets': ['warn', { tolerance: 4.5 }],
202
266
  'no-self-compare': 'error',
203
267
  'no-sequences': 'error',
268
+ 'no-template-curly-in-string': 'error',
204
269
  'no-throw-literal': 'error',
205
270
  'no-unmodified-loop-condition': 'error',
206
271
  'no-unreachable-loop': 'error',
@@ -215,8 +280,10 @@ export const baseConfig = {
215
280
  'no-useless-return': 'warn',
216
281
  'no-var': 'error',
217
282
  'no-void': 'error',
283
+ 'no-warning-comments': 'warn',
218
284
  'no-with': 'warn',
219
- 'optimize-regex/optimize-regex': 'warn',
285
+ 'object-shorthand': 'warn',
286
+ 'one-var': ['error', 'never'],
220
287
  // Perfectionist rules for consistent ordering
221
288
  'perfectionist/sort-named-imports': [
222
289
  'error',
@@ -254,37 +321,69 @@ export const baseConfig = {
254
321
  // Promise rules
255
322
  'promise/always-return': 'warn',
256
323
  'promise/catch-or-return': 'warn',
324
+ 'promise/no-callback-in-promise': 'warn',
257
325
  'promise/no-multiple-resolved': 'error',
258
326
  'promise/no-nesting': 'warn',
327
+ 'promise/no-new-statics': 'error',
328
+ 'promise/no-promise-in-callback': 'warn',
329
+ 'promise/no-return-in-finally': 'warn',
259
330
  'promise/no-return-wrap': 'warn',
260
331
  'promise/param-names': 'warn',
261
332
  'promise/prefer-await-to-callbacks': 'warn',
262
333
  'promise/prefer-await-to-then': 'warn',
334
+ 'promise/valid-params': 'warn',
263
335
  radix: 'warn',
264
336
  'regexp/no-missing-g-flag': 'error',
337
+ 'regexp/no-useless-flag': 'error',
338
+ 'regexp/prefer-d': 'error',
339
+ 'regexp/prefer-plus-quantifier': 'error',
340
+ 'regexp/prefer-question-quantifier': 'error',
341
+ 'regexp/prefer-star-quantifier': 'error',
265
342
  'require-atomic-updates': ['error', { allowProperties: false }],
343
+ 'require-unicode-regexp': 'error',
266
344
  // Security rules
267
345
  'security/detect-buffer-noassert': 'error',
268
346
  'security/detect-child-process': 'warn',
269
347
  'security/detect-disable-mustache-escape': 'error',
348
+ 'security/detect-eval-with-expression': 'error',
349
+ 'security/detect-new-buffer': 'error',
350
+ 'security/detect-no-csrf-before-method-override': 'error',
270
351
  'security/detect-non-literal-fs-filename': 'error',
271
352
  'security/detect-non-literal-regexp': 'error',
272
353
  'security/detect-non-literal-require': 'error',
354
+ 'security/detect-object-injection': 'warn',
273
355
  'security/detect-possible-timing-attacks': 'error',
356
+ 'security/detect-pseudoRandomBytes': 'error',
274
357
  'security/detect-unsafe-regex': 'error',
275
- 'sonarjs/cognitive-complexity': ['warn', 15],
276
-
358
+ 'sonarjs/cognitive-complexity': ['warn', 12],
277
359
  'sonarjs/max-switch-cases': ['warn', 10],
360
+ 'sonarjs/no-all-duplicated-branches': 'warn',
361
+ 'sonarjs/no-collapsible-if': 'warn',
362
+ 'sonarjs/no-collection-size-mischeck': 'warn',
278
363
  'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],
279
364
  'sonarjs/no-duplicated-branches': 'warn',
365
+ 'sonarjs/no-identical-conditions': 'warn',
366
+ 'sonarjs/no-identical-expressions': 'warn',
367
+ 'sonarjs/no-inverted-boolean-check': 'warn',
368
+ 'sonarjs/no-nested-switch': 'warn',
369
+ 'sonarjs/no-nested-template-literals': 'warn',
280
370
  'sonarjs/no-redundant-boolean': 'warn',
371
+ 'sonarjs/no-redundant-jump': 'warn',
281
372
  'sonarjs/no-small-switch': 'warn',
373
+ 'sonarjs/no-unused-collection': 'warn',
374
+ 'sonarjs/no-use-of-empty-return-value': 'warn',
375
+ 'sonarjs/no-useless-catch': 'warn',
282
376
  'sonarjs/prefer-immediate-return': 'warn',
377
+ 'sonarjs/prefer-object-literal': 'warn',
378
+ 'sonarjs/prefer-single-boolean-return': 'warn',
379
+ 'sonarjs/prefer-while': 'warn',
283
380
  'sort-destructure-keys/sort-destructure-keys': 'warn',
284
381
  'sort-imports': 'off',
285
382
 
286
383
  'sort-vars': 'warn',
384
+ 'spaced-comment': ['warn', 'always'],
287
385
  strict: ['error', 'never'],
386
+ 'symbol-description': 'error',
288
387
 
289
388
  'unicorn/expiring-todo-comments': 'off',
290
389
  'unicorn/filename-case': [
@@ -310,16 +409,15 @@ export const baseConfig = {
310
409
  },
311
410
  ],
312
411
  'unicorn/require-post-message-target-origin': 'error',
313
- 'write-good-comments/write-good-comments': 'warn',
314
412
 
315
413
  yoda: 'error',
316
414
  },
317
415
  settings: {
318
- 'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
319
- 'import/parsers': {
416
+ 'import-x/extensions': ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
417
+ 'import-x/parsers': {
320
418
  '@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
321
419
  },
322
- 'import/resolver': {
420
+ 'import-x/resolver': {
323
421
  node: { extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'] },
324
422
  },
325
423
  jest: { version: 29 },
package/flat.js CHANGED
@@ -1,7 +1,8 @@
1
- // Modern ESLint 9 Flat Configuration for Mikey Pro
2
- // Ultimate coding style guide for excellence
1
+ // Modern ESLint 10 Flat Configuration for Mikey Pro
2
+ // Simplified flat config entry point
3
3
 
4
- import { baseConfig } from './base-config.js';
4
+ import { baseConfig, globalPlugins } from './base-config.js';
5
+ import { baseOverrides } from './overrides.js';
5
6
 
6
7
  export default [
7
8
  // Global ignores
@@ -39,9 +40,16 @@ export default [
39
40
  'CNAME',
40
41
  '*.min.js',
41
42
  '*.min.css',
43
+ '**/*.npmrc',
42
44
  ],
43
45
  },
44
46
 
45
- // Base configuration
47
+ // Global plugin registration (available to all config objects)
48
+ globalPlugins,
49
+
50
+ // Base configuration for JS/TS files
46
51
  baseConfig,
52
+
53
+ // File-specific overrides
54
+ ...baseOverrides,
47
55
  ];
package/index.js CHANGED
@@ -1,51 +1,57 @@
1
- // Modern ESLint 9 configuration for Mikey Pro
2
- // This is the main entry point that exports the flat config
1
+ // Modern ESLint 10 configuration for Mikey Pro
2
+ // Ultimate coding style guide for excellence
3
3
 
4
- import { baseConfig } from './base-config.js';
4
+ import { baseConfig, globalPlugins } from './base-config.js';
5
5
  import { baseOverrides } from './overrides.js';
6
6
 
7
+ // Global ignores — files excluded from all linting
8
+ const globalIgnores = {
9
+ ignores: [
10
+ '**/dist/**/*',
11
+ '**/vendor/**/*',
12
+ '**/node_modules/**/*',
13
+ '**/coverage/**/*',
14
+ '**/.next/**/*',
15
+ '**/.nuxt/**/*',
16
+ '**/.output/**/*',
17
+ '**/.vite/**/*',
18
+ '**/build/**/*',
19
+ '**/out/**/*',
20
+ '*.properties',
21
+ '*.cclibs',
22
+ '*.svg',
23
+ '*.png',
24
+ '*.jpg',
25
+ '*.jpeg',
26
+ '*.gif',
27
+ '*.ico',
28
+ '*.webp',
29
+ '*.aco',
30
+ '*.psd',
31
+ '*.ai',
32
+ '*.ase',
33
+ '*.bat',
34
+ '*.cmd',
35
+ 'package-lock.json',
36
+ 'yarn.lock',
37
+ 'pnpm-lock.yaml',
38
+ 'LICENSE',
39
+ 'CNAME',
40
+ '*.min.js',
41
+ '*.min.css',
42
+ '**/*.npmrc',
43
+ ],
44
+ };
45
+
7
46
  // Export the modern flat configuration
8
47
  export default [
9
48
  // Global ignores
10
- {
11
- ignores: [
12
- '**/dist/**/*',
13
- '**/vendor/**/*',
14
- '**/node_modules/**/*',
15
- '**/coverage/**/*',
16
- '**/.next/**/*',
17
- '**/.nuxt/**/*',
18
- '**/.output/**/*',
19
- '**/.vite/**/*',
20
- '**/build/**/*',
21
- '**/out/**/*',
22
- '*.properties',
23
- '*.cclibs',
24
- '*.svg',
25
- '*.png',
26
- '*.jpg',
27
- '*.jpeg',
28
- '*.gif',
29
- '*.ico',
30
- '*.webp',
31
- '*.aco',
32
- '*.psd',
33
- '*.ai',
34
- '*.ase',
35
- '*.bat',
36
- '*.cmd',
37
- 'package-lock.json',
38
- 'yarn.lock',
39
- 'pnpm-lock.yaml',
40
- 'LICENSE',
41
- 'CNAME',
42
- '*.min.js',
43
- '*.min.css',
44
- '**/*.md', // Markdown files require special processor configuration
45
- ],
46
- },
49
+ globalIgnores,
50
+
51
+ // Global plugin registration (available to all config objects)
52
+ globalPlugins,
47
53
 
48
- // Base configuration
54
+ // Base configuration for JS/TS files
49
55
  baseConfig,
50
56
 
51
57
  // File-specific overrides
@@ -53,6 +59,5 @@ export default [
53
59
  ];
54
60
 
55
61
  // Export individual components for advanced usage
56
- export { baseConfig } from './base-config.js';
62
+ export { baseConfig, globalPlugins } from './base-config.js';
57
63
  export { baseOverrides } from './overrides.js';
58
- export { baseRules } from './rules.js';