@mikey-pro/eslint-config 9.0.7 → 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/README.md +1 -1
- package/base-config.js +432 -0
- package/flat.js +12 -5
- package/index.js +48 -44
- package/overrides.js +125 -35
- package/package.json +24 -48
- package/rules.js +0 -622
package/overrides.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// Modern overrides for different file types and frameworks
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
3
|
|
|
5
4
|
import html from '@html-eslint/eslint-plugin';
|
|
6
5
|
import htmlParser from '@html-eslint/parser';
|
|
7
6
|
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
8
7
|
import tsParser from '@typescript-eslint/parser';
|
|
8
|
+
import markdown from '@eslint/markdown';
|
|
9
9
|
import cypress from 'eslint-plugin-cypress';
|
|
10
|
-
import
|
|
10
|
+
import importX from 'eslint-plugin-import-x';
|
|
11
11
|
import jest from 'eslint-plugin-jest';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import jestDom from 'eslint-plugin-jest-dom';
|
|
13
|
+
import jsoncPlugin from 'eslint-plugin-jsonc';
|
|
14
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
15
|
+
import tomlPlugin from 'eslint-plugin-toml';
|
|
15
16
|
import jsoncParser from 'jsonc-eslint-parser';
|
|
16
17
|
import tomlParser from 'toml-eslint-parser';
|
|
17
18
|
import yamlParser from 'yaml-eslint-parser';
|
|
@@ -32,15 +33,11 @@ export const ts = {
|
|
|
32
33
|
},
|
|
33
34
|
sourceType: 'module',
|
|
34
35
|
},
|
|
35
|
-
plugins: {
|
|
36
|
-
'@typescript-eslint': tsPlugin,
|
|
37
|
-
import: importPlugin,
|
|
38
|
-
},
|
|
39
36
|
rules: {
|
|
40
37
|
// TypeScript-specific rules
|
|
41
38
|
...tsPlugin.configs.all.rules,
|
|
42
39
|
...tsPlugin.configs['recommended-requiring-type-checking'].rules,
|
|
43
|
-
...
|
|
40
|
+
...importX.flatConfigs.typescript.rules,
|
|
44
41
|
|
|
45
42
|
// Override some rules for better developer experience
|
|
46
43
|
'@typescript-eslint/class-methods-use-this': 'off',
|
|
@@ -209,10 +206,10 @@ export const ts = {
|
|
|
209
206
|
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
|
210
207
|
},
|
|
211
208
|
settings: {
|
|
212
|
-
'import/parsers': {
|
|
209
|
+
'import-x/parsers': {
|
|
213
210
|
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
214
211
|
},
|
|
215
|
-
'import/resolver': {
|
|
212
|
+
'import-x/resolver': {
|
|
216
213
|
typescript: { alwaysTryTypes: true },
|
|
217
214
|
},
|
|
218
215
|
},
|
|
@@ -248,11 +245,25 @@ export const yaml = {
|
|
|
248
245
|
languageOptions: {
|
|
249
246
|
parser: yamlParser,
|
|
250
247
|
},
|
|
251
|
-
plugins: {
|
|
252
|
-
yml: yml,
|
|
253
|
-
},
|
|
254
248
|
rules: {
|
|
249
|
+
'yml/block-mapping': 'error',
|
|
250
|
+
'yml/block-mapping-question-indicator-newline': 'error',
|
|
251
|
+
'yml/block-sequence': 'error',
|
|
252
|
+
'yml/block-sequence-hyphen-indicator-newline': 'error',
|
|
253
|
+
'yml/flow-mapping-curly-newline': 'error',
|
|
254
|
+
'yml/flow-mapping-curly-spacing': 'error',
|
|
255
|
+
'yml/flow-sequence-bracket-newline': 'error',
|
|
256
|
+
'yml/flow-sequence-bracket-spacing': 'error',
|
|
257
|
+
'yml/indent': ['error', 2],
|
|
258
|
+
'yml/key-spacing': 'error',
|
|
259
|
+
'yml/no-empty-document': 'error',
|
|
260
|
+
'yml/no-empty-key': 'error',
|
|
261
|
+
'yml/no-empty-mapping-value': 'error',
|
|
262
|
+
'yml/no-empty-sequence-entry': 'error',
|
|
263
|
+
'yml/no-irregular-whitespace': 'error',
|
|
264
|
+
'yml/no-tab-indent': 'error',
|
|
255
265
|
'yml/quotes': ['warn', { avoidEscape: true, prefer: 'double' }],
|
|
266
|
+
'yml/require-string-key': 'error',
|
|
256
267
|
},
|
|
257
268
|
};
|
|
258
269
|
|
|
@@ -263,20 +274,40 @@ export const toml = {
|
|
|
263
274
|
parser: tomlParser,
|
|
264
275
|
},
|
|
265
276
|
rules: {
|
|
277
|
+
...tomlPlugin.configs['flat/recommended'].reduce(
|
|
278
|
+
(accumulator, config) => ({ ...accumulator, ...config.rules }),
|
|
279
|
+
{},
|
|
280
|
+
),
|
|
266
281
|
'prettier/prettier': 'off',
|
|
267
282
|
},
|
|
268
283
|
};
|
|
269
284
|
|
|
270
|
-
// Markdown files
|
|
285
|
+
// Markdown files — uses @eslint/markdown language plugin
|
|
271
286
|
export const md = {
|
|
272
287
|
files: ['**/*.md'],
|
|
273
|
-
|
|
288
|
+
language: 'markdown/commonmark',
|
|
289
|
+
rules: {
|
|
290
|
+
'markdown/fenced-code-language': 'error',
|
|
291
|
+
'markdown/heading-increment': 'error',
|
|
292
|
+
'markdown/no-duplicate-headings': 'error',
|
|
293
|
+
'markdown/no-empty-links': 'error',
|
|
294
|
+
'markdown/no-html': 'off',
|
|
295
|
+
'markdown/no-invalid-label-refs': 'error',
|
|
296
|
+
'markdown/no-missing-label-refs': 'error',
|
|
297
|
+
},
|
|
274
298
|
};
|
|
275
299
|
|
|
276
300
|
// Package.json files
|
|
277
301
|
export const packageJson = {
|
|
278
302
|
files: ['**/package.json'],
|
|
303
|
+
languageOptions: {
|
|
304
|
+
parser: jsoncParser,
|
|
305
|
+
},
|
|
279
306
|
rules: {
|
|
307
|
+
...jsoncPlugin.configs['flat/recommended-with-json'].reduce(
|
|
308
|
+
(accumulator, config) => ({ ...accumulator, ...config.rules }),
|
|
309
|
+
{},
|
|
310
|
+
),
|
|
280
311
|
'prettier/prettier': ['warn', { parser: 'json' }],
|
|
281
312
|
},
|
|
282
313
|
settings: {
|
|
@@ -317,11 +348,8 @@ export const htmlConfig = {
|
|
|
317
348
|
languageOptions: {
|
|
318
349
|
parser: htmlParser,
|
|
319
350
|
},
|
|
320
|
-
plugins: {
|
|
321
|
-
'@html-eslint': html,
|
|
322
|
-
},
|
|
323
351
|
rules: {
|
|
324
|
-
...html.configs
|
|
352
|
+
...html.configs['flat/recommended'].rules,
|
|
325
353
|
'@html-eslint/element-newline': 'off',
|
|
326
354
|
'@html-eslint/indent': 'off',
|
|
327
355
|
'@html-eslint/no-extra-spacing-attrs': 'off',
|
|
@@ -334,11 +362,21 @@ export const htmlConfig = {
|
|
|
334
362
|
|
|
335
363
|
// JSONC files
|
|
336
364
|
export const jsonc = {
|
|
337
|
-
files: [
|
|
365
|
+
files: [
|
|
366
|
+
'**/*.jsonc',
|
|
367
|
+
'**/.babelrc',
|
|
368
|
+
'**/.eslintrc',
|
|
369
|
+
'**/.prettierrc',
|
|
370
|
+
'**/.stylelintrc',
|
|
371
|
+
],
|
|
338
372
|
languageOptions: {
|
|
339
373
|
parser: jsoncParser,
|
|
340
374
|
},
|
|
341
375
|
rules: {
|
|
376
|
+
...jsoncPlugin.configs['flat/recommended-with-jsonc'].reduce(
|
|
377
|
+
(accumulator, config) => ({ ...accumulator, ...config.rules }),
|
|
378
|
+
{},
|
|
379
|
+
),
|
|
342
380
|
'prettier/prettier': ['warn', { parser: 'json' }],
|
|
343
381
|
},
|
|
344
382
|
};
|
|
@@ -350,6 +388,10 @@ export const json5 = {
|
|
|
350
388
|
parser: jsoncParser,
|
|
351
389
|
},
|
|
352
390
|
rules: {
|
|
391
|
+
...jsoncPlugin.configs['flat/recommended-with-json5'].reduce(
|
|
392
|
+
(accumulator, config) => ({ ...accumulator, ...config.rules }),
|
|
393
|
+
{},
|
|
394
|
+
),
|
|
353
395
|
'prettier/prettier': ['warn', { parser: 'json5' }],
|
|
354
396
|
},
|
|
355
397
|
};
|
|
@@ -360,14 +402,42 @@ export const jestJs = {
|
|
|
360
402
|
languageOptions: {
|
|
361
403
|
globals: { jest: true },
|
|
362
404
|
},
|
|
363
|
-
plugins: {
|
|
364
|
-
jest,
|
|
365
|
-
},
|
|
366
405
|
rules: {
|
|
367
|
-
...jest.configs
|
|
406
|
+
...jest.configs['flat/all'].rules,
|
|
407
|
+
// Jest DOM rules for testing-library assertions
|
|
408
|
+
'jest-dom/prefer-checked': 'error',
|
|
409
|
+
'jest-dom/prefer-enabled-disabled': 'error',
|
|
410
|
+
'jest-dom/prefer-focus': 'error',
|
|
411
|
+
'jest-dom/prefer-in-document': 'error',
|
|
412
|
+
'jest-dom/prefer-required': 'error',
|
|
413
|
+
'jest-dom/prefer-to-have-attribute': 'error',
|
|
414
|
+
'jest-dom/prefer-to-have-class': 'error',
|
|
415
|
+
'jest-dom/prefer-to-have-style': 'error',
|
|
416
|
+
'jest-dom/prefer-to-have-text-content': 'error',
|
|
417
|
+
'jest-dom/prefer-to-have-value': 'error',
|
|
418
|
+
// Testing Library rules
|
|
419
|
+
'testing-library/await-async-queries': 'error',
|
|
420
|
+
'testing-library/await-async-utils': 'error',
|
|
421
|
+
'testing-library/no-await-sync-queries': 'error',
|
|
422
|
+
'testing-library/no-debugging-utils': 'warn',
|
|
423
|
+
'testing-library/no-dom-import': 'error',
|
|
424
|
+
'testing-library/no-manual-cleanup': 'error',
|
|
425
|
+
'testing-library/no-render-in-lifecycle': 'error',
|
|
426
|
+
'testing-library/no-unnecessary-act': 'error',
|
|
427
|
+
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
428
|
+
'testing-library/prefer-explicit-assert': 'warn',
|
|
429
|
+
'testing-library/prefer-find-by': 'error',
|
|
430
|
+
'testing-library/prefer-presence-queries': 'error',
|
|
431
|
+
'testing-library/prefer-query-by-disappearance': 'error',
|
|
432
|
+
'testing-library/prefer-screen-queries': 'error',
|
|
433
|
+
'testing-library/render-result-naming-convention': 'error',
|
|
434
|
+
// Disable rules requiring TypeScript type checking (not available in JS files)
|
|
435
|
+
'jest/no-error-equal': 'off',
|
|
436
|
+
'jest/no-unnecessary-assertion': 'off',
|
|
437
|
+
'jest/unbound-method': 'off',
|
|
438
|
+
'jest/valid-expect-with-promise': 'off',
|
|
368
439
|
'jest/prefer-spy-on': 'warn',
|
|
369
440
|
'jest/require-top-level-describe': 'error',
|
|
370
|
-
'jest/unbound-method': 'off',
|
|
371
441
|
'unicorn/no-array-callback-reference': 'off',
|
|
372
442
|
'unicorn/prevent-abbreviations': ['warn', { ignore: [/e2e/] }],
|
|
373
443
|
},
|
|
@@ -380,12 +450,35 @@ export const jestTs = {
|
|
|
380
450
|
globals: { jest: true },
|
|
381
451
|
parser: tsParser,
|
|
382
452
|
},
|
|
383
|
-
plugins: {
|
|
384
|
-
'@typescript-eslint': tsPlugin,
|
|
385
|
-
jest,
|
|
386
|
-
},
|
|
387
453
|
rules: {
|
|
388
|
-
...jest.configs
|
|
454
|
+
...jest.configs['flat/all'].rules,
|
|
455
|
+
// Jest DOM rules for testing-library assertions
|
|
456
|
+
'jest-dom/prefer-checked': 'error',
|
|
457
|
+
'jest-dom/prefer-enabled-disabled': 'error',
|
|
458
|
+
'jest-dom/prefer-focus': 'error',
|
|
459
|
+
'jest-dom/prefer-in-document': 'error',
|
|
460
|
+
'jest-dom/prefer-required': 'error',
|
|
461
|
+
'jest-dom/prefer-to-have-attribute': 'error',
|
|
462
|
+
'jest-dom/prefer-to-have-class': 'error',
|
|
463
|
+
'jest-dom/prefer-to-have-style': 'error',
|
|
464
|
+
'jest-dom/prefer-to-have-text-content': 'error',
|
|
465
|
+
'jest-dom/prefer-to-have-value': 'error',
|
|
466
|
+
// Testing Library rules
|
|
467
|
+
'testing-library/await-async-queries': 'error',
|
|
468
|
+
'testing-library/await-async-utils': 'error',
|
|
469
|
+
'testing-library/no-await-sync-queries': 'error',
|
|
470
|
+
'testing-library/no-debugging-utils': 'warn',
|
|
471
|
+
'testing-library/no-dom-import': 'error',
|
|
472
|
+
'testing-library/no-manual-cleanup': 'error',
|
|
473
|
+
'testing-library/no-render-in-lifecycle': 'error',
|
|
474
|
+
'testing-library/no-unnecessary-act': 'error',
|
|
475
|
+
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
476
|
+
'testing-library/prefer-explicit-assert': 'warn',
|
|
477
|
+
'testing-library/prefer-find-by': 'error',
|
|
478
|
+
'testing-library/prefer-presence-queries': 'error',
|
|
479
|
+
'testing-library/prefer-query-by-disappearance': 'error',
|
|
480
|
+
'testing-library/prefer-screen-queries': 'error',
|
|
481
|
+
'testing-library/render-result-naming-convention': 'error',
|
|
389
482
|
'jest/prefer-spy-on': 'warn',
|
|
390
483
|
'jest/require-top-level-describe': 'error',
|
|
391
484
|
'jest/unbound-method': 'off',
|
|
@@ -397,9 +490,6 @@ export const jestTs = {
|
|
|
397
490
|
// Cypress files
|
|
398
491
|
export const cypressConfig = {
|
|
399
492
|
files: ['**/*.cy.*'],
|
|
400
|
-
plugins: {
|
|
401
|
-
cypress,
|
|
402
|
-
},
|
|
403
493
|
rules: {
|
|
404
494
|
...cypress.configs.recommended.rules,
|
|
405
495
|
},
|
package/package.json
CHANGED
|
@@ -1,55 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikey-pro/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Mikey Pro ESLint configuration - Ultimate coding style guide for excellence",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@
|
|
10
|
-
"@
|
|
11
|
-
"@babel/eslint-plugin": "^7.27.1",
|
|
12
|
-
"@babel/preset-env": "^7.28.3",
|
|
13
|
-
"@cypress/eslint-plugin-json": "^3.2.3",
|
|
14
|
-
"@eslint/js": "^9.35.0",
|
|
9
|
+
"@eslint/js": "^10.0.0",
|
|
10
|
+
"@eslint/markdown": "^7.5.1",
|
|
15
11
|
"@html-eslint/eslint-plugin": "^0.46.2",
|
|
16
12
|
"@html-eslint/parser": "^0.46.2",
|
|
17
|
-
"@
|
|
18
|
-
"@typescript-eslint/
|
|
19
|
-
"
|
|
20
|
-
"eslint": "^
|
|
21
|
-
"eslint-
|
|
22
|
-
"eslint-
|
|
23
|
-
"eslint-plugin-
|
|
24
|
-
"eslint-plugin-
|
|
25
|
-
"eslint-plugin-css-modules": "^2.12.0",
|
|
26
|
-
"eslint-plugin-cypress": "^5.1.1",
|
|
27
|
-
"eslint-plugin-filenames": "^1.3.2",
|
|
28
|
-
"@eslint/markdown": "^6.1.0",
|
|
13
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
14
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
15
|
+
"eslint": "^10.0.0",
|
|
16
|
+
"eslint-plugin-boundaries": "^5.4.0",
|
|
17
|
+
"eslint-plugin-compat": "^7.0.0",
|
|
18
|
+
"eslint-plugin-cypress": "^6.1.0",
|
|
19
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
20
|
+
"eslint-plugin-jest": "^29.12.1",
|
|
29
21
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
30
22
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
31
|
-
"eslint-plugin-
|
|
32
|
-
"eslint-plugin-n": "^17.21.3",
|
|
23
|
+
"eslint-plugin-n": "^17.23.1",
|
|
33
24
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
34
|
-
"eslint-plugin-no-secrets": "^2.
|
|
35
|
-
"eslint-plugin-only-warn": "^1.1.0",
|
|
36
|
-
"eslint-plugin-optimize-regex": "^1.2.1",
|
|
25
|
+
"eslint-plugin-no-secrets": "^2.3.3",
|
|
37
26
|
"eslint-plugin-perfectionist": "^4.15.0",
|
|
38
|
-
"eslint-plugin-prettier": "^5.5.
|
|
27
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
39
28
|
"eslint-plugin-promise": "^7.2.1",
|
|
40
29
|
"eslint-plugin-regexp": "^2.10.0",
|
|
41
|
-
"eslint-plugin-security": "^
|
|
30
|
+
"eslint-plugin-security": "^4.0.0",
|
|
42
31
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
43
32
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
44
|
-
"eslint-plugin-sort-destructure-keys": "^
|
|
33
|
+
"eslint-plugin-sort-destructure-keys": "^3.0.0",
|
|
45
34
|
"eslint-plugin-testing-library": "^7.6.8",
|
|
46
35
|
"eslint-plugin-toml": "^0.12.0",
|
|
47
|
-
"eslint-plugin-unicorn": "^
|
|
48
|
-
"eslint-plugin-write-good-comments": "^0.2.0",
|
|
36
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
49
37
|
"eslint-plugin-yml": "^1.18.0",
|
|
50
38
|
"globals": "^16.4.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
39
|
+
"jsonc-eslint-parser": "^2.4.0",
|
|
40
|
+
"toml-eslint-parser": "^0.10.0",
|
|
53
41
|
"yaml-eslint-parser": "^1.3.0"
|
|
54
42
|
},
|
|
55
43
|
"peerDependenciesMeta": {
|
|
@@ -58,18 +46,12 @@
|
|
|
58
46
|
},
|
|
59
47
|
"@typescript-eslint/parser": {
|
|
60
48
|
"optional": true
|
|
61
|
-
},
|
|
62
|
-
"eslint-plugin-import": {
|
|
63
|
-
"optional": false
|
|
64
|
-
},
|
|
65
|
-
"eslint-plugin-n": {
|
|
66
|
-
"optional": false
|
|
67
49
|
}
|
|
68
50
|
},
|
|
69
51
|
"files": [
|
|
70
52
|
"index.js",
|
|
53
|
+
"base-config.js",
|
|
71
54
|
"flat.js",
|
|
72
|
-
"rules.js",
|
|
73
55
|
"overrides.js",
|
|
74
56
|
"README.md",
|
|
75
57
|
"LICENSE",
|
|
@@ -97,7 +79,7 @@
|
|
|
97
79
|
"style-guide",
|
|
98
80
|
"style",
|
|
99
81
|
"guide",
|
|
100
|
-
"eslint-
|
|
82
|
+
"eslint-10",
|
|
101
83
|
"flat-config",
|
|
102
84
|
"typescript",
|
|
103
85
|
"react",
|
|
@@ -106,17 +88,15 @@
|
|
|
106
88
|
"angular"
|
|
107
89
|
],
|
|
108
90
|
"author": "Mikl Wolfe <wolfe@mikl.io> (https://mikl.io)",
|
|
109
|
-
"browserslist": [
|
|
110
|
-
"defaults"
|
|
111
|
-
],
|
|
91
|
+
"browserslist": ["defaults"],
|
|
112
92
|
"type": "module",
|
|
113
93
|
"engines": {
|
|
114
|
-
"node": ">=20.
|
|
94
|
+
"node": ">=20.19.0",
|
|
115
95
|
"npm": ">=9.0.0",
|
|
116
96
|
"pnpm": ">=8.0.0",
|
|
117
97
|
"yarn": ">=4.0.0"
|
|
118
98
|
},
|
|
119
|
-
"_comment": "Priority: Latest Node (25+) for latest features. Minimum: Node 20. Older versions tested but may break.",
|
|
99
|
+
"_comment": "Priority: Latest Node (25+) for latest features. Minimum: Node 20.19.0. Older versions tested but may break.",
|
|
120
100
|
"exports": {
|
|
121
101
|
".": {
|
|
122
102
|
"import": "./index.js",
|
|
@@ -126,10 +106,6 @@
|
|
|
126
106
|
"import": "./flat.js",
|
|
127
107
|
"require": "./flat.js"
|
|
128
108
|
},
|
|
129
|
-
"./rules": {
|
|
130
|
-
"import": "./rules.js",
|
|
131
|
-
"require": "./rules.js"
|
|
132
|
-
},
|
|
133
109
|
"./overrides": {
|
|
134
110
|
"import": "./overrides.js",
|
|
135
111
|
"require": "./overrides.js"
|