eslint-config-entva-typescript-base 2.12.0 → 2.17.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/index.js +37 -18
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -5,30 +5,23 @@ import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
|
5
5
|
import tsParser from '@typescript-eslint/parser';
|
|
6
6
|
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const baseConfigRules = baseConfig.reduce((acc, config) => {
|
|
9
|
+
if (!config.files || !config.rules) return acc;
|
|
10
|
+
const isTest = config.files.some((pattern) => pattern.includes('.test.'));
|
|
11
|
+
const key = isTest ? 'test' : 'base';
|
|
12
|
+
acc[key] = { ...acc[key], ...config.rules };
|
|
13
|
+
return acc;
|
|
14
|
+
}, { base: {}, test: {} });
|
|
9
15
|
|
|
10
16
|
// Many TS rules mirror JS rules, we need to disable JS rule and apply config for the TS replacement
|
|
11
|
-
const getOverrides = (rules, overridePrefix) => rules.reduce((acc, rule) => {
|
|
17
|
+
const getOverrides = (base, rules, overridePrefix) => rules.reduce((acc, rule) => {
|
|
12
18
|
acc[rule] = ['off'];
|
|
13
|
-
acc[`${overridePrefix}/${rule}`] =
|
|
19
|
+
acc[`${overridePrefix}/${rule}`] = base[rule];
|
|
14
20
|
return acc;
|
|
15
21
|
}, {});
|
|
16
22
|
|
|
17
23
|
export default [
|
|
18
24
|
...baseConfig,
|
|
19
|
-
{
|
|
20
|
-
files: [
|
|
21
|
-
'**/*.test.ts',
|
|
22
|
-
'**/*.test.tsx',
|
|
23
|
-
'**/*.spec.ts',
|
|
24
|
-
'**/*.spec.tsx',
|
|
25
|
-
],
|
|
26
|
-
languageOptions: {
|
|
27
|
-
globals: {
|
|
28
|
-
...globals.jest,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
25
|
{
|
|
33
26
|
files: ['**/*.{ts,tsx}'],
|
|
34
27
|
plugins: {
|
|
@@ -84,8 +77,9 @@ export default [
|
|
|
84
77
|
},
|
|
85
78
|
|
|
86
79
|
rules: {
|
|
87
|
-
...
|
|
80
|
+
...baseConfigRules.base,
|
|
88
81
|
...getOverrides(
|
|
82
|
+
baseConfigRules.base,
|
|
89
83
|
[
|
|
90
84
|
'no-array-constructor',
|
|
91
85
|
'no-useless-constructor',
|
|
@@ -94,12 +88,13 @@ export default [
|
|
|
94
88
|
'default-param-last',
|
|
95
89
|
'dot-notation',
|
|
96
90
|
'naming-convention',
|
|
97
|
-
'no-unused-vars',
|
|
98
91
|
'no-shadow',
|
|
92
|
+
'no-unused-vars',
|
|
99
93
|
],
|
|
100
94
|
'@typescript-eslint',
|
|
101
95
|
),
|
|
102
96
|
...getOverrides(
|
|
97
|
+
baseConfigRules.base,
|
|
103
98
|
[
|
|
104
99
|
'space-before-function-paren',
|
|
105
100
|
'lines-between-class-members',
|
|
@@ -192,4 +187,28 @@ export default [
|
|
|
192
187
|
}],
|
|
193
188
|
},
|
|
194
189
|
},
|
|
190
|
+
{
|
|
191
|
+
files: [
|
|
192
|
+
'**/*.test.ts',
|
|
193
|
+
'**/*.test.tsx',
|
|
194
|
+
'**/*.spec.ts',
|
|
195
|
+
'**/*.spec.tsx',
|
|
196
|
+
'**/__tests__/**',
|
|
197
|
+
],
|
|
198
|
+
languageOptions: {
|
|
199
|
+
globals: {
|
|
200
|
+
...globals.jest,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
rules: {
|
|
204
|
+
...baseConfigRules.test,
|
|
205
|
+
...getOverrides(
|
|
206
|
+
baseConfigRules.test,
|
|
207
|
+
[
|
|
208
|
+
'no-unused-vars',
|
|
209
|
+
],
|
|
210
|
+
'@typescript-eslint',
|
|
211
|
+
),
|
|
212
|
+
},
|
|
213
|
+
},
|
|
195
214
|
];
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/entva/styleguide"
|
|
10
10
|
},
|
|
11
11
|
"bugs": "https://github.com/entva/styleguide/issues",
|
|
12
|
-
"version": "2.
|
|
12
|
+
"version": "2.17.0",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"linter",
|
|
15
15
|
"config",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"prepublishOnly": "npm test"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.17.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@stylistic/eslint-plugin-ts": "^2.12.1",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
33
|
-
"@typescript-eslint/parser": "^8.
|
|
34
|
-
"eslint-config-entva-base": "^2.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.19.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.19.0",
|
|
34
|
+
"eslint-config-entva-base": "^2.17.0",
|
|
35
35
|
"eslint-plugin-import": "^2.31.0",
|
|
36
|
-
"globals": "^15.
|
|
36
|
+
"globals": "^15.14.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"eslint": "^9.x.x"
|