eslint-config-entva-typescript-base 2.15.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 +21 -25
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -5,12 +5,18 @@ 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
|
|
|
@@ -71,8 +77,9 @@ export default [
|
|
|
71
77
|
},
|
|
72
78
|
|
|
73
79
|
rules: {
|
|
74
|
-
...
|
|
80
|
+
...baseConfigRules.base,
|
|
75
81
|
...getOverrides(
|
|
82
|
+
baseConfigRules.base,
|
|
76
83
|
[
|
|
77
84
|
'no-array-constructor',
|
|
78
85
|
'no-useless-constructor',
|
|
@@ -82,10 +89,12 @@ export default [
|
|
|
82
89
|
'dot-notation',
|
|
83
90
|
'naming-convention',
|
|
84
91
|
'no-shadow',
|
|
92
|
+
'no-unused-vars',
|
|
85
93
|
],
|
|
86
94
|
'@typescript-eslint',
|
|
87
95
|
),
|
|
88
96
|
...getOverrides(
|
|
97
|
+
baseConfigRules.base,
|
|
89
98
|
[
|
|
90
99
|
'space-before-function-paren',
|
|
91
100
|
'lines-between-class-members',
|
|
@@ -102,16 +111,6 @@ export default [
|
|
|
102
111
|
'@stylistic/ts',
|
|
103
112
|
),
|
|
104
113
|
|
|
105
|
-
// Glitchy because of the test rules
|
|
106
|
-
'import/first': ['error'],
|
|
107
|
-
'no-unused-vars': ['off'],
|
|
108
|
-
'@typescript-eslint/no-unused-vars': ['error', {
|
|
109
|
-
vars: 'all',
|
|
110
|
-
args: 'after-used',
|
|
111
|
-
ignoreRestSiblings: true,
|
|
112
|
-
caughtErrors: 'none',
|
|
113
|
-
}],
|
|
114
|
-
|
|
115
114
|
'@typescript-eslint/no-implied-eval': ['error'],
|
|
116
115
|
'@typescript-eslint/no-loss-of-precision': ['error'],
|
|
117
116
|
'@typescript-eslint/no-loop-func': ['error'],
|
|
@@ -190,14 +189,6 @@ export default [
|
|
|
190
189
|
},
|
|
191
190
|
{
|
|
192
191
|
files: [
|
|
193
|
-
'**/*.test.js',
|
|
194
|
-
'**/*.test.cjs',
|
|
195
|
-
'**/*.test.mjs',
|
|
196
|
-
'**/*.test.jsx',
|
|
197
|
-
'**/*.spec.js',
|
|
198
|
-
'**/*.spec.cjs',
|
|
199
|
-
'**/*.spec.mjs',
|
|
200
|
-
'**/*.spec.jsx',
|
|
201
192
|
'**/*.test.ts',
|
|
202
193
|
'**/*.test.tsx',
|
|
203
194
|
'**/*.spec.ts',
|
|
@@ -210,9 +201,14 @@ export default [
|
|
|
210
201
|
},
|
|
211
202
|
},
|
|
212
203
|
rules: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
204
|
+
...baseConfigRules.test,
|
|
205
|
+
...getOverrides(
|
|
206
|
+
baseConfigRules.test,
|
|
207
|
+
[
|
|
208
|
+
'no-unused-vars',
|
|
209
|
+
],
|
|
210
|
+
'@typescript-eslint',
|
|
211
|
+
),
|
|
216
212
|
},
|
|
217
213
|
},
|
|
218
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",
|
|
@@ -29,9 +29,9 @@
|
|
|
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
36
|
"globals": "^15.14.0"
|
|
37
37
|
},
|