@mikey-pro/eslint-config 8.0.16 → 8.0.18
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 +36 -19
- package/overrides.js +7 -14
- package/package.json +4 -4
- package/rules.js +7 -10
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
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';
|
|
@@ -14,7 +13,16 @@ import importSortPlugin from 'eslint-plugin-simple-import-sort';
|
|
|
14
13
|
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
15
14
|
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
16
15
|
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
|
|
17
|
-
|
|
16
|
+
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
17
|
+
import regexpPlugin from 'eslint-plugin-regexp';
|
|
18
|
+
import etcPlugin from 'eslint-plugin-etc';
|
|
19
|
+
import typescriptSortKeysPlugin from 'eslint-plugin-typescript-sort-keys';
|
|
20
|
+
import sortDestructureKeysPlugin from 'eslint-plugin-sort-destructure-keys';
|
|
21
|
+
import writeGoodCommentsPlugin from 'eslint-plugin-write-good-comments';
|
|
22
|
+
import boundariesPlugin from 'eslint-plugin-boundaries';
|
|
23
|
+
import nPlugin from 'eslint-plugin-n';
|
|
24
|
+
import radarPlugin from 'eslint-plugin-radar';
|
|
25
|
+
import optimizeRegexPlugin from 'eslint-plugin-optimize-regex';
|
|
18
26
|
|
|
19
27
|
import { baseOverrides } from './overrides.js';
|
|
20
28
|
import { baseRules } from './rules.js';
|
|
@@ -42,25 +50,10 @@ const config = [
|
|
|
42
50
|
},
|
|
43
51
|
eslintJs.configs.recommended,
|
|
44
52
|
{
|
|
53
|
+
files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'], // Add files pattern
|
|
45
54
|
languageOptions: {
|
|
46
55
|
ecmaVersion: 'latest',
|
|
47
56
|
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
57
|
globals: {
|
|
65
58
|
...globals.browser,
|
|
66
59
|
...globals.commonjs,
|
|
@@ -69,6 +62,10 @@ const config = [
|
|
|
69
62
|
...globals.node
|
|
70
63
|
},
|
|
71
64
|
},
|
|
65
|
+
linterOptions: {
|
|
66
|
+
noInlineConfig: true,
|
|
67
|
+
reportUnusedDisableDirectives: true,
|
|
68
|
+
},
|
|
72
69
|
plugins: {
|
|
73
70
|
prettier,
|
|
74
71
|
unicorn,
|
|
@@ -82,7 +79,17 @@ const config = [
|
|
|
82
79
|
perfectionist: perfectionistPlugin,
|
|
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,
|
|
@@ -90,6 +97,7 @@ const config = [
|
|
|
90
97
|
...compatPlugin.configs.recommended.rules,
|
|
91
98
|
...cssModules.configs.recommended.rules,
|
|
92
99
|
...importPlugin.configs.recommended.rules,
|
|
100
|
+
...sonarjsPlugin.configs.recommended.rules,
|
|
93
101
|
'prettier/prettier': ['warn', {
|
|
94
102
|
parser: 'babel',
|
|
95
103
|
endOfLine: 'lf',
|
|
@@ -127,6 +135,15 @@ const config = [
|
|
|
127
135
|
'import/no-cycle': 'warn',
|
|
128
136
|
'import/no-useless-path-segments': 'warn',
|
|
129
137
|
'import/no-anonymous-default-export': 'warn',
|
|
138
|
+
|
|
139
|
+
// SonarJS rules
|
|
140
|
+
'sonarjs/cognitive-complexity': ['error', 15],
|
|
141
|
+
'sonarjs/no-duplicate-string': ['error', { threshold: 5 }],
|
|
142
|
+
'sonarjs/no-redundant-boolean': 'error',
|
|
143
|
+
'sonarjs/prefer-immediate-return': 'error',
|
|
144
|
+
'sonarjs/no-small-switch': 'warn',
|
|
145
|
+
'sonarjs/no-duplicated-branches': 'error',
|
|
146
|
+
'sonarjs/max-switch-cases': ['warn', 10],
|
|
130
147
|
},
|
|
131
148
|
settings: {
|
|
132
149
|
'json/json-with-comments-files': [],
|
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.18",
|
|
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,11 +210,12 @@ export const baseRules = {
|
|
|
210
210
|
'security/detect-non-literal-regexp': 'error',
|
|
211
211
|
'security/detect-non-literal-require': 'error',
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
'
|
|
215
|
-
'
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
'no-unreachable': 'error',
|
|
214
|
+
'no-constant-condition': 'error',
|
|
215
|
+
'complexity': ['error', { max: 15 }],
|
|
216
|
+
|
|
217
|
+
// RegExp
|
|
218
|
+
'regexp/no-missing-g-flag': 'error',
|
|
218
219
|
|
|
219
220
|
// Enhanced TypeScript
|
|
220
221
|
'etc/no-commented-out-code': 'warn',
|
|
@@ -240,9 +241,6 @@ export const baseRules = {
|
|
|
240
241
|
|
|
241
242
|
// Code Quality
|
|
242
243
|
'write-good-comments/write-good-comments': 'warn',
|
|
243
|
-
'sonarjs/no-small-switch': 'warn',
|
|
244
|
-
'sonarjs/no-duplicated-branches': 'error',
|
|
245
|
-
'sonarjs/max-switch-cases': ['warn', 10],
|
|
246
244
|
|
|
247
245
|
// Import Safety
|
|
248
246
|
'import/no-cycle': ['error', {
|
|
@@ -252,7 +250,6 @@ export const baseRules = {
|
|
|
252
250
|
'import/no-relative-packages': 'error',
|
|
253
251
|
'import/no-self-import': 'error',
|
|
254
252
|
'import/no-namespace': 'error',
|
|
255
|
-
'import/no-empty-named-blocks': 'error',
|
|
256
253
|
'import/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
257
254
|
'import/no-import-module-exports': 'error',
|
|
258
255
|
|