@mikey-pro/eslint-config 8.0.17 → 8.0.19
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/index.js +40 -21
- package/overrides.js +7 -14
- package/package.json +4 -4
- package/rules.js +1 -7
package/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import babelParser from '@babel/eslint-parser';
|
|
2
1
|
import cypressJson from '@cypress/eslint-plugin-json';
|
|
3
2
|
import eslintJs from '@eslint/js';
|
|
4
3
|
import compatPlugin from 'eslint-plugin-compat';
|
|
5
4
|
import cssModules from 'eslint-plugin-css-modules';
|
|
6
5
|
import importPlugin from 'eslint-plugin-import';
|
|
7
6
|
import onlyWarn from 'eslint-plugin-only-warn';
|
|
8
|
-
import prettier from 'eslint-plugin-prettier';
|
|
9
7
|
import unicorn from 'eslint-plugin-unicorn';
|
|
10
8
|
import globals from 'globals';
|
|
11
9
|
import securityPlugin from 'eslint-plugin-security';
|
|
@@ -15,6 +13,16 @@ import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
|
15
13
|
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
16
14
|
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
17
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';
|
|
18
26
|
|
|
19
27
|
import { baseOverrides } from './overrides.js';
|
|
20
28
|
import { baseRules } from './rules.js';
|
|
@@ -41,26 +49,12 @@ const config = [
|
|
|
41
49
|
],
|
|
42
50
|
},
|
|
43
51
|
eslintJs.configs.recommended,
|
|
52
|
+
eslintPluginPrettierRecommended,
|
|
44
53
|
{
|
|
54
|
+
files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'], // Add files pattern
|
|
45
55
|
languageOptions: {
|
|
46
56
|
ecmaVersion: 'latest',
|
|
47
57
|
sourceType: 'module',
|
|
48
|
-
parser: babelParser,
|
|
49
|
-
parserOptions: {
|
|
50
|
-
babelOptions: {
|
|
51
|
-
presets: [
|
|
52
|
-
[
|
|
53
|
-
'@babel/preset-env',
|
|
54
|
-
{
|
|
55
|
-
targets: {
|
|
56
|
-
node: 'current',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
requireConfigFile: false,
|
|
63
|
-
},
|
|
64
58
|
globals: {
|
|
65
59
|
...globals.browser,
|
|
66
60
|
...globals.commonjs,
|
|
@@ -69,8 +63,11 @@ const config = [
|
|
|
69
63
|
...globals.node
|
|
70
64
|
},
|
|
71
65
|
},
|
|
66
|
+
linterOptions: {
|
|
67
|
+
noInlineConfig: true,
|
|
68
|
+
reportUnusedDisableDirectives: true,
|
|
69
|
+
},
|
|
72
70
|
plugins: {
|
|
73
|
-
prettier,
|
|
74
71
|
unicorn,
|
|
75
72
|
'css-modules': cssModules,
|
|
76
73
|
'only-warn': onlyWarn,
|
|
@@ -83,6 +80,16 @@ const config = [
|
|
|
83
80
|
'no-secrets': noSecretsPlugin,
|
|
84
81
|
'no-only-tests': noOnlyTestsPlugin,
|
|
85
82
|
sonarjs: sonarjsPlugin,
|
|
83
|
+
regexp: regexpPlugin,
|
|
84
|
+
etc: etcPlugin,
|
|
85
|
+
'typescript-sort-keys': typescriptSortKeysPlugin,
|
|
86
|
+
'sort-destructure-keys': sortDestructureKeysPlugin,
|
|
87
|
+
'write-good-comments': writeGoodCommentsPlugin,
|
|
88
|
+
boundaries: boundariesPlugin,
|
|
89
|
+
n: nPlugin,
|
|
90
|
+
radar: radarPlugin,
|
|
91
|
+
'optimize-regex': optimizeRegexPlugin,
|
|
92
|
+
compat: compatPlugin,
|
|
86
93
|
},
|
|
87
94
|
rules: {
|
|
88
95
|
...baseRules,
|
|
@@ -131,7 +138,7 @@ const config = [
|
|
|
131
138
|
|
|
132
139
|
// SonarJS rules
|
|
133
140
|
'sonarjs/cognitive-complexity': ['error', 15],
|
|
134
|
-
'sonarjs/no-duplicate-string': ['error', 5],
|
|
141
|
+
'sonarjs/no-duplicate-string': ['error', { threshold: 5 }],
|
|
135
142
|
'sonarjs/no-redundant-boolean': 'error',
|
|
136
143
|
'sonarjs/prefer-immediate-return': 'error',
|
|
137
144
|
'sonarjs/no-small-switch': 'warn',
|
|
@@ -140,7 +147,7 @@ const config = [
|
|
|
140
147
|
},
|
|
141
148
|
settings: {
|
|
142
149
|
'json/json-with-comments-files': [],
|
|
143
|
-
polyfills: ['Promise', 'fetch', 'URLSearchParams'],
|
|
150
|
+
polyfills: ['Promise', 'fetch', 'URLSearchParams', 'Array.prototype.includes'],
|
|
144
151
|
jest: {
|
|
145
152
|
version: 29,
|
|
146
153
|
},
|
|
@@ -153,6 +160,18 @@ const config = [
|
|
|
153
160
|
extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs']
|
|
154
161
|
}
|
|
155
162
|
},
|
|
163
|
+
boundaries: {
|
|
164
|
+
elements: [
|
|
165
|
+
{ type: 'app', pattern: 'app/*' },
|
|
166
|
+
{ type: 'pages', pattern: 'pages/*' },
|
|
167
|
+
{ type: 'components', pattern: 'components/*' },
|
|
168
|
+
{ type: 'hooks', pattern: 'hooks/*' },
|
|
169
|
+
{ type: 'utils', pattern: 'utils/*' },
|
|
170
|
+
{ type: 'services', pattern: 'services/*' },
|
|
171
|
+
{ type: 'types', pattern: 'types/*' },
|
|
172
|
+
{ type: 'config', pattern: 'config/*' }
|
|
173
|
+
]
|
|
174
|
+
}
|
|
156
175
|
},
|
|
157
176
|
},
|
|
158
177
|
...baseOverrides,
|
package/overrides.js
CHANGED
|
@@ -11,17 +11,14 @@ const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
|
11
11
|
const ts = {
|
|
12
12
|
files: ['*.ts', '*.tsx'],
|
|
13
13
|
languageOptions: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
ecmaFeatures: {
|
|
17
|
-
jsx: true,
|
|
18
|
-
},
|
|
19
|
-
ecmaVersion: 'latest',
|
|
20
|
-
extraFileExtensions: ['.vue', '.svelte'],
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
project: 'tsconfig.json',
|
|
23
|
-
tsconfigRootDir: path.join(currentDir, '../../..'),
|
|
14
|
+
ecmaFeatures: {
|
|
15
|
+
jsx: true,
|
|
24
16
|
},
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
extraFileExtensions: ['.vue', '.svelte'],
|
|
19
|
+
sourceType: 'module',
|
|
20
|
+
project: 'tsconfig.json',
|
|
21
|
+
tsconfigRootDir: path.join(currentDir, '../../..'),
|
|
25
22
|
},
|
|
26
23
|
plugins: {
|
|
27
24
|
'@typescript-eslint': typeScriptPlugin,
|
|
@@ -157,7 +154,6 @@ const ts = {
|
|
|
157
154
|
'error',
|
|
158
155
|
{ ignoreArrowShorthand: true }
|
|
159
156
|
],
|
|
160
|
-
'@typescript-eslint/prefer-return-this-type': 'error',
|
|
161
157
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
162
158
|
'@typescript-eslint/promise-function-async': 'error',
|
|
163
159
|
'@typescript-eslint/require-array-sort-compare': [
|
|
@@ -261,9 +257,6 @@ const toml = {
|
|
|
261
257
|
|
|
262
258
|
const md = {
|
|
263
259
|
files: ['*.md'],
|
|
264
|
-
languageOptions: {
|
|
265
|
-
parser: 'eslint-plugin-markdownlint/parser',
|
|
266
|
-
},
|
|
267
260
|
plugins: {
|
|
268
261
|
markdownlint: markdownPlugin,
|
|
269
262
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikey-pro/eslint-config",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.19",
|
|
4
4
|
"description": "Mikey Pro ESLint configuration",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"@html-eslint/parser": "^0.33.0",
|
|
16
16
|
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
|
17
17
|
"@typescript-eslint/parser": "^8.22.0",
|
|
18
|
-
"eslint-config-prettier": "^10.0",
|
|
18
|
+
"eslint-config-prettier": "^10.0.1",
|
|
19
19
|
"eslint-import-resolver-typescript": "^3.7.0",
|
|
20
|
-
"eslint-plugin-compat": "^6.0",
|
|
20
|
+
"eslint-plugin-compat": "^6.0.2",
|
|
21
21
|
"eslint-plugin-css-modules": "^2.12",
|
|
22
22
|
"eslint-plugin-cypress": "^4.1.0",
|
|
23
23
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"eslint-plugin-perfectionist": "^4.7.0",
|
|
30
30
|
"eslint-plugin-no-secrets": "^2.1.1",
|
|
31
31
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
32
|
-
"eslint-plugin-prettier": "^5.2",
|
|
32
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
33
33
|
"eslint-plugin-promise": "^7.2.1",
|
|
34
34
|
"eslint-plugin-security": "^3.0.1",
|
|
35
35
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
package/rules.js
CHANGED
|
@@ -40,7 +40,7 @@ export const baseRules = {
|
|
|
40
40
|
'no-delete-var': 'warn',
|
|
41
41
|
'no-dupe-class-members': 'warn',
|
|
42
42
|
'no-dupe-keys': 'warn',
|
|
43
|
-
'no-duplicate-imports': '
|
|
43
|
+
'no-duplicate-imports': 'error',
|
|
44
44
|
'no-else-return': 'warn',
|
|
45
45
|
'no-empty': 'off',
|
|
46
46
|
'no-empty-pattern': 'off',
|
|
@@ -210,7 +210,6 @@ export const baseRules = {
|
|
|
210
210
|
'security/detect-non-literal-regexp': 'error',
|
|
211
211
|
'security/detect-non-literal-require': 'error',
|
|
212
212
|
|
|
213
|
-
'no-duplicate-imports': 'error',
|
|
214
213
|
'no-unreachable': 'error',
|
|
215
214
|
'no-constant-condition': 'error',
|
|
216
215
|
'complexity': ['error', { max: 15 }],
|
|
@@ -219,8 +218,6 @@ export const baseRules = {
|
|
|
219
218
|
'regexp/no-missing-g-flag': 'error',
|
|
220
219
|
|
|
221
220
|
// Enhanced TypeScript
|
|
222
|
-
'etc/no-commented-out-code': 'warn',
|
|
223
|
-
'etc/no-implicit-any-catch': 'error',
|
|
224
221
|
'etc/prefer-interface': 'error',
|
|
225
222
|
|
|
226
223
|
// Enhanced Import Rules
|
|
@@ -251,7 +248,6 @@ export const baseRules = {
|
|
|
251
248
|
'import/no-relative-packages': 'error',
|
|
252
249
|
'import/no-self-import': 'error',
|
|
253
250
|
'import/no-namespace': 'error',
|
|
254
|
-
'import/no-empty-named-blocks': 'error',
|
|
255
251
|
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
256
252
|
'import/no-import-module-exports': 'error',
|
|
257
253
|
|
|
@@ -270,8 +266,6 @@ export const baseRules = {
|
|
|
270
266
|
|
|
271
267
|
// Performance
|
|
272
268
|
'optimize-regex/optimize-regex': 'warn',
|
|
273
|
-
'radar/no-duplicate-string': ['warn', 5],
|
|
274
|
-
'radar/cognitive-complexity': ['error', 15],
|
|
275
269
|
|
|
276
270
|
// Enhanced Security
|
|
277
271
|
'n/no-unsupported-features/es-syntax': ['error', {
|