@mikey-pro/eslint-config 8.1.0 → 9.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 +14 -2
- package/flat.js +48 -0
- package/index.js +32 -154
- package/overrides.js +200 -196
- package/package.json +57 -40
- package/rules.js +515 -202
package/README.md
CHANGED
|
@@ -18,9 +18,19 @@ A preset ESLint configuration
|
|
|
18
18
|
npm i -D mikey-pro
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### Configure
|
|
21
|
+
### Configure (Flat ESLint v9+ Recommended)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Create / update `eslint.config.js`:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import mikeyPro from '@mikey-pro/eslint-config/flat';
|
|
27
|
+
|
|
28
|
+
export default mikeyPro;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Legacy Configuration (still supported)
|
|
32
|
+
|
|
33
|
+
Extend in `package.json` (deprecated style):
|
|
24
34
|
|
|
25
35
|
```json
|
|
26
36
|
{
|
|
@@ -29,3 +39,5 @@ Extend to ESLint in `package.json`:
|
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
```
|
|
42
|
+
|
|
43
|
+
Both configurations are kept semantically equivalent; the legacy form will be removed in a future major release.
|
package/flat.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Modern ESLint 9 Flat Configuration for Mikey Pro
|
|
2
|
+
// Ultimate coding style guide for excellence
|
|
3
|
+
|
|
4
|
+
import { baseConfig } from './base-config.js';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
// Global ignores
|
|
8
|
+
{
|
|
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
|
+
'*.sh',
|
|
34
|
+
'*.bat',
|
|
35
|
+
'*.cmd',
|
|
36
|
+
'package-lock.json',
|
|
37
|
+
'yarn.lock',
|
|
38
|
+
'pnpm-lock.yaml',
|
|
39
|
+
'LICENSE',
|
|
40
|
+
'CNAME',
|
|
41
|
+
'*.min.js',
|
|
42
|
+
'*.min.css',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Base configuration
|
|
47
|
+
baseConfig,
|
|
48
|
+
];
|
package/index.js
CHANGED
|
@@ -1,180 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import compatPlugin from 'eslint-plugin-compat';
|
|
4
|
-
import cssModules from 'eslint-plugin-css-modules';
|
|
5
|
-
import importPlugin from 'eslint-plugin-import';
|
|
6
|
-
import onlyWarn from 'eslint-plugin-only-warn';
|
|
7
|
-
import unicorn from 'eslint-plugin-unicorn';
|
|
8
|
-
import globals from 'globals';
|
|
9
|
-
import securityPlugin from 'eslint-plugin-security';
|
|
10
|
-
import promisePlugin from 'eslint-plugin-promise';
|
|
11
|
-
import importSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
12
|
-
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
13
|
-
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
14
|
-
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
15
|
-
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
16
|
-
import regexpPlugin from 'eslint-plugin-regexp';
|
|
17
|
-
import etcPlugin from 'eslint-plugin-etc';
|
|
18
|
-
import typescriptSortKeysPlugin from 'eslint-plugin-typescript-sort-keys';
|
|
19
|
-
import sortDestructureKeysPlugin from 'eslint-plugin-sort-destructure-keys';
|
|
20
|
-
import writeGoodCommentsPlugin from 'eslint-plugin-write-good-comments';
|
|
21
|
-
import boundariesPlugin from 'eslint-plugin-boundaries';
|
|
22
|
-
import nPlugin from 'eslint-plugin-n';
|
|
23
|
-
import radarPlugin from 'eslint-plugin-radar';
|
|
24
|
-
import optimizeRegexPlugin from 'eslint-plugin-optimize-regex';
|
|
25
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
1
|
+
// Modern ESLint 9 configuration for Mikey Pro
|
|
2
|
+
// This is the main entry point that exports the flat config
|
|
26
3
|
|
|
4
|
+
import { baseConfig } from './base-config.js';
|
|
27
5
|
import { baseOverrides } from './overrides.js';
|
|
28
|
-
import { baseRules } from './rules.js';
|
|
29
6
|
|
|
30
|
-
|
|
7
|
+
// Export the modern flat configuration
|
|
8
|
+
export default [
|
|
9
|
+
// Global ignores
|
|
31
10
|
{
|
|
32
11
|
ignores: [
|
|
33
12
|
'**/dist/**/*',
|
|
34
13
|
'**/vendor/**/*',
|
|
14
|
+
'**/node_modules/**/*',
|
|
15
|
+
'**/coverage/**/*',
|
|
16
|
+
'**/.next/**/*',
|
|
17
|
+
'**/.nuxt/**/*',
|
|
18
|
+
'**/.output/**/*',
|
|
19
|
+
'**/.vite/**/*',
|
|
20
|
+
'**/build/**/*',
|
|
21
|
+
'**/out/**/*',
|
|
35
22
|
'*.properties',
|
|
36
23
|
'*.cclibs',
|
|
37
24
|
'*.svg',
|
|
38
25
|
'*.png',
|
|
26
|
+
'*.jpg',
|
|
27
|
+
'*.jpeg',
|
|
28
|
+
'*.gif',
|
|
29
|
+
'*.ico',
|
|
30
|
+
'*.webp',
|
|
39
31
|
'*.aco',
|
|
40
32
|
'*.psd',
|
|
41
33
|
'*.ai',
|
|
42
34
|
'*.ase',
|
|
43
35
|
'*.sh',
|
|
44
|
-
'*.
|
|
36
|
+
'*.bat',
|
|
37
|
+
'*.cmd',
|
|
45
38
|
'package-lock.json',
|
|
39
|
+
'yarn.lock',
|
|
40
|
+
'pnpm-lock.yaml',
|
|
46
41
|
'LICENSE',
|
|
47
42
|
'CNAME',
|
|
43
|
+
'*.min.js',
|
|
44
|
+
'*.min.css',
|
|
48
45
|
],
|
|
49
46
|
},
|
|
50
|
-
eslintJs.configs.recommended,
|
|
51
|
-
eslintPluginPrettierRecommended,
|
|
52
|
-
{
|
|
53
|
-
files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
|
|
54
|
-
languageOptions: {
|
|
55
|
-
ecmaVersion: 'latest',
|
|
56
|
-
sourceType: 'module',
|
|
57
|
-
globals: {
|
|
58
|
-
...globals.browser,
|
|
59
|
-
...globals.commonjs,
|
|
60
|
-
...globals.es2022,
|
|
61
|
-
...globals.es6,
|
|
62
|
-
...globals.node
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
linterOptions: {
|
|
66
|
-
noInlineConfig: true,
|
|
67
|
-
reportUnusedDisableDirectives: true,
|
|
68
|
-
},
|
|
69
|
-
plugins: {
|
|
70
|
-
unicorn,
|
|
71
|
-
'css-modules': cssModules,
|
|
72
|
-
'only-warn': onlyWarn,
|
|
73
|
-
'@cypress/json': cypressJson,
|
|
74
|
-
import: importPlugin,
|
|
75
|
-
security: securityPlugin,
|
|
76
|
-
promise: promisePlugin,
|
|
77
|
-
'simple-import-sort': importSortPlugin,
|
|
78
|
-
perfectionist: perfectionistPlugin,
|
|
79
|
-
'no-secrets': noSecretsPlugin,
|
|
80
|
-
'no-only-tests': noOnlyTestsPlugin,
|
|
81
|
-
sonarjs: sonarjsPlugin,
|
|
82
|
-
regexp: regexpPlugin,
|
|
83
|
-
etc: etcPlugin,
|
|
84
|
-
'typescript-sort-keys': typescriptSortKeysPlugin,
|
|
85
|
-
'sort-destructure-keys': sortDestructureKeysPlugin,
|
|
86
|
-
'write-good-comments': writeGoodCommentsPlugin,
|
|
87
|
-
boundaries: boundariesPlugin,
|
|
88
|
-
n: nPlugin,
|
|
89
|
-
radar: radarPlugin,
|
|
90
|
-
'optimize-regex': optimizeRegexPlugin,
|
|
91
|
-
compat: compatPlugin,
|
|
92
|
-
},
|
|
93
|
-
rules: {
|
|
94
|
-
...baseRules,
|
|
95
|
-
...unicorn.configs.all.rules,
|
|
96
|
-
...compatPlugin.configs.recommended.rules,
|
|
97
|
-
...cssModules.configs.recommended.rules,
|
|
98
|
-
...importPlugin.configs.recommended.rules,
|
|
99
|
-
...sonarjsPlugin.configs.recommended.rules,
|
|
100
|
-
'prettier/prettier': ['warn', {
|
|
101
|
-
parser: 'babel',
|
|
102
|
-
endOfLine: 'lf',
|
|
103
|
-
singleQuote: true,
|
|
104
|
-
trailingComma: 'all'
|
|
105
|
-
}],
|
|
106
|
-
|
|
107
|
-
// Security
|
|
108
|
-
'security/detect-object-injection': 'warn',
|
|
109
|
-
'security/detect-possible-timing-attacks': 'warn',
|
|
110
|
-
'security/detect-non-literal-regexp': 'warn',
|
|
111
|
-
|
|
112
|
-
// Promises
|
|
113
|
-
'promise/always-return': 'warn',
|
|
114
|
-
'promise/no-return-wrap': 'warn',
|
|
115
|
-
'promise/param-names': 'error',
|
|
116
|
-
'promise/catch-or-return': 'warn',
|
|
117
47
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
'simple-import-sort/exports': 'warn',
|
|
48
|
+
// Base configuration
|
|
49
|
+
baseConfig,
|
|
121
50
|
|
|
122
|
-
|
|
123
|
-
'perfectionist/sort-objects': ['warn', {
|
|
124
|
-
type: 'natural',
|
|
125
|
-
order: 'asc',
|
|
126
|
-
}],
|
|
127
|
-
'perfectionist/sort-named-imports': 'warn',
|
|
128
|
-
|
|
129
|
-
// Security and testing
|
|
130
|
-
'no-secrets/no-secrets': ['warn', { tolerance: 4.5 }],
|
|
131
|
-
'no-only-tests/no-only-tests': 'warn',
|
|
132
|
-
|
|
133
|
-
// Enhanced import rules
|
|
134
|
-
'import/no-cycle': 'warn',
|
|
135
|
-
'import/no-useless-path-segments': 'warn',
|
|
136
|
-
'import/no-anonymous-default-export': 'warn',
|
|
137
|
-
|
|
138
|
-
// SonarJS rules
|
|
139
|
-
'sonarjs/cognitive-complexity': ['error', 15],
|
|
140
|
-
'sonarjs/no-duplicate-string': ['error', { threshold: 5 }],
|
|
141
|
-
'sonarjs/no-redundant-boolean': 'error',
|
|
142
|
-
'sonarjs/prefer-immediate-return': 'error',
|
|
143
|
-
'sonarjs/no-small-switch': 'warn',
|
|
144
|
-
'sonarjs/no-duplicated-branches': 'error',
|
|
145
|
-
'sonarjs/max-switch-cases': ['warn', 10],
|
|
146
|
-
},
|
|
147
|
-
settings: {
|
|
148
|
-
'json/json-with-comments-files': [],
|
|
149
|
-
polyfills: ['Promise', 'fetch', 'URLSearchParams', 'Array.prototype.includes'],
|
|
150
|
-
jest: {
|
|
151
|
-
version: 29,
|
|
152
|
-
},
|
|
153
|
-
'import/parsers': {
|
|
154
|
-
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
|
|
155
|
-
},
|
|
156
|
-
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
|
|
157
|
-
'import/resolver': {
|
|
158
|
-
node: {
|
|
159
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs']
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
boundaries: {
|
|
163
|
-
elements: [
|
|
164
|
-
{ type: 'app', pattern: 'app/*' },
|
|
165
|
-
{ type: 'pages', pattern: 'pages/*' },
|
|
166
|
-
{ type: 'components', pattern: 'components/*' },
|
|
167
|
-
{ type: 'hooks', pattern: 'hooks/*' },
|
|
168
|
-
{ type: 'utils', pattern: 'utils/*' },
|
|
169
|
-
{ type: 'services', pattern: 'services/*' },
|
|
170
|
-
{ type: 'types', pattern: 'types/*' },
|
|
171
|
-
{ type: 'config', pattern: 'config/*' }
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
},
|
|
51
|
+
// File-specific overrides
|
|
176
52
|
...baseOverrides,
|
|
177
53
|
];
|
|
178
54
|
|
|
179
|
-
|
|
180
|
-
export {
|
|
55
|
+
// Export individual components for advanced usage
|
|
56
|
+
export { baseConfig } from './base-config.js';
|
|
57
|
+
export { baseOverrides } from './overrides.js';
|
|
58
|
+
export { baseRules } from './rules.js';
|