eslint-config-entva-typescript-base 2.15.0 → 2.18.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.
Files changed (2) hide show
  1. package/index.js +17 -28
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -1,21 +1,20 @@
1
- import baseConfig from 'eslint-config-entva-base';
1
+ import { ignoreRule, mainRule, testRule } from 'eslint-config-entva-base';
2
2
  import importPlugin from 'eslint-plugin-import';
3
3
  import globals from 'globals';
4
4
  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 baseRules = baseConfig.reduce((acc, config) => ({ ...acc, ...config.rules }), {});
9
-
10
8
  // 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) => {
9
+ const getOverrides = (base, rules, overridePrefix) => rules.reduce((acc, rule) => {
12
10
  acc[rule] = ['off'];
13
- acc[`${overridePrefix}/${rule}`] = baseRules[rule];
11
+ acc[`${overridePrefix}/${rule}`] = base[rule];
14
12
  return acc;
15
13
  }, {});
16
14
 
17
15
  export default [
18
- ...baseConfig,
16
+ ignoreRule,
17
+ mainRule,
19
18
  {
20
19
  files: ['**/*.{ts,tsx}'],
21
20
  plugins: {
@@ -71,8 +70,9 @@ export default [
71
70
  },
72
71
 
73
72
  rules: {
74
- ...baseRules,
73
+ ...mainRule.rules,
75
74
  ...getOverrides(
75
+ mainRule.rules,
76
76
  [
77
77
  'no-array-constructor',
78
78
  'no-useless-constructor',
@@ -82,10 +82,12 @@ export default [
82
82
  'dot-notation',
83
83
  'naming-convention',
84
84
  'no-shadow',
85
+ 'no-unused-vars',
85
86
  ],
86
87
  '@typescript-eslint',
87
88
  ),
88
89
  ...getOverrides(
90
+ mainRule.rules,
89
91
  [
90
92
  'space-before-function-paren',
91
93
  'lines-between-class-members',
@@ -102,16 +104,6 @@ export default [
102
104
  '@stylistic/ts',
103
105
  ),
104
106
 
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
107
  '@typescript-eslint/no-implied-eval': ['error'],
116
108
  '@typescript-eslint/no-loss-of-precision': ['error'],
117
109
  '@typescript-eslint/no-loop-func': ['error'],
@@ -188,16 +180,9 @@ export default [
188
180
  }],
189
181
  },
190
182
  },
183
+ testRule,
191
184
  {
192
185
  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
186
  '**/*.test.ts',
202
187
  '**/*.test.tsx',
203
188
  '**/*.spec.ts',
@@ -210,9 +195,13 @@ export default [
210
195
  },
211
196
  },
212
197
  rules: {
213
- 'import/first': ['off'],
214
- 'no-unused-vars': ['off'],
215
- '@typescript-eslint/no-unused-vars': ['off'],
198
+ ...getOverrides(
199
+ testRule.rules,
200
+ [
201
+ 'no-unused-vars',
202
+ ],
203
+ '@typescript-eslint',
204
+ ),
216
205
  },
217
206
  },
218
207
  ];
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.15.0",
12
+ "version": "2.18.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.18.2",
33
- "@typescript-eslint/parser": "^8.18.2",
34
- "eslint-config-entva-base": "^2.15.0",
32
+ "@typescript-eslint/eslint-plugin": "^8.19.0",
33
+ "@typescript-eslint/parser": "^8.19.0",
34
+ "eslint-config-entva-base": "^2.18.0",
35
35
  "eslint-plugin-import": "^2.31.0",
36
36
  "globals": "^15.14.0"
37
37
  },