eslint-config-entva-typescript 2.16.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.
Files changed (2) hide show
  1. package/index.js +9 -32
  2. package/package.json +6 -6
package/index.js CHANGED
@@ -11,13 +11,16 @@ import stylisticTs from '@stylistic/eslint-plugin-ts';
11
11
 
12
12
  // ESLint 9 is shit at merging config rules so we have to do it by hand.
13
13
  // Thanks ESLint <3
14
- const baseRules = [...baseConfig, ...tsConfig].reduce((acc, config) => ({
15
- ...acc, ...config.rules,
16
- }), {});
14
+ const baseConfigRules = [...baseConfig, ...tsConfig].reduce((acc, config) => {
15
+ if (!config.files || !config.rules) return acc;
16
+ const isTest = config.files.some((pattern) => pattern.includes('.test.'));
17
+ const key = isTest ? 'test' : 'base';
18
+ acc[key] = { ...acc[key], ...config.rules };
19
+ return acc;
20
+ }, { base: {}, test: {} });
17
21
 
18
22
  export default [
19
23
  ...baseConfig,
20
- ...tsConfig,
21
24
  {
22
25
  files: ['**/*.{ts,tsx}'],
23
26
  plugins: {
@@ -76,37 +79,11 @@ export default [
76
79
  },
77
80
 
78
81
  rules: {
79
- ...baseRules,
80
- 'import/first': ['error'],
81
- 'no-unused-vars': ['off'],
82
- '@typescript-eslint/no-unused-vars': ['error', {
83
- vars: 'all',
84
- args: 'after-used',
85
- ignoreRestSiblings: true,
86
- caughtErrors: 'none',
87
- }],
82
+ ...baseConfigRules.base,
88
83
  'react/jsx-filename-extension': ['error', {
89
84
  extensions: ['.jsx', '.tsx'],
90
85
  }],
91
86
  },
92
87
  },
93
- {
94
- files: [
95
- '**/*.test.ts',
96
- '**/*.test.tsx',
97
- '**/*.spec.ts',
98
- '**/*.spec.tsx',
99
- '**/__tests__/**',
100
- ],
101
- languageOptions: {
102
- globals: {
103
- ...globals.jest,
104
- },
105
- },
106
- rules: {
107
- 'import/first': ['off'],
108
- 'no-unused-vars': ['off'],
109
- '@typescript-eslint/no-unused-vars': ['off'],
110
- },
111
- },
88
+ ...tsConfig,
112
89
  ];
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.16.0",
12
+ "version": "2.17.0",
13
13
  "keywords": [
14
14
  "linter",
15
15
  "config",
@@ -25,7 +25,7 @@
25
25
  "prepublishOnly": "npm test"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/node": "^22.10.1",
28
+ "@types/node": "^22.10.3",
29
29
  "@types/react": "^19.0.2",
30
30
  "@types/react-dom": "^19.0.2",
31
31
  "eslint": "^9.17.0",
@@ -34,13 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@stylistic/eslint-plugin-ts": "^2.12.1",
37
- "@typescript-eslint/eslint-plugin": "^8.18.2",
38
- "@typescript-eslint/parser": "^8.18.2",
37
+ "@typescript-eslint/eslint-plugin": "^8.19.0",
38
+ "@typescript-eslint/parser": "^8.19.0",
39
39
  "eslint-plugin-jsx-a11y": "^6.10.2",
40
40
  "eslint-plugin-react": "^7.37.2",
41
41
  "eslint-plugin-react-hooks": "^5.1.0",
42
- "eslint-config-entva": "^2.15.0",
43
- "eslint-config-entva-typescript-base": "^2.15.0",
42
+ "eslint-config-entva": "^2.17.0",
43
+ "eslint-config-entva-typescript-base": "^2.17.0",
44
44
  "eslint-plugin-import": "^2.31.0",
45
45
  "globals": "^15.14.0"
46
46
  },