eslint-config-entva-typescript 2.17.0 → 2.19.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 +61 -64
  2. package/package.json +4 -3
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import baseConfig from 'eslint-config-entva';
2
- import tsConfig from 'eslint-config-entva-typescript-base';
1
+ import { ignoreRule, mainRule as baseMainRule, testRule as baseTestRule } from 'eslint-config-entva-base';
2
+ import { mainRule as reactMainRule } from 'eslint-config-entva';
3
+ import { mainRule as tsMainRule, testRule as tsTestRule } from 'eslint-config-entva-typescript-base';
3
4
  import react from 'eslint-plugin-react';
4
5
  import jsxA11Y from 'eslint-plugin-jsx-a11y';
5
6
  import reactHooks from 'eslint-plugin-react-hooks';
@@ -9,81 +10,77 @@ import typescriptEslint from '@typescript-eslint/eslint-plugin';
9
10
  import tsParser from '@typescript-eslint/parser';
10
11
  import stylisticTs from '@stylistic/eslint-plugin-ts';
11
12
 
12
- // ESLint 9 is shit at merging config rules so we have to do it by hand.
13
- // Thanks ESLint <3
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: {} });
13
+ export const mainRule = {
14
+ files: ['**/*.{ts,tsx}'],
15
+ plugins: {
16
+ react,
17
+ 'jsx-a11y': jsxA11Y,
18
+ 'react-hooks': reactHooks,
19
+ import: importPlugin,
20
+ '@typescript-eslint': typescriptEslint,
21
+ '@stylistic/ts': stylisticTs,
22
+ },
21
23
 
22
- export default [
23
- ...baseConfig,
24
- {
25
- files: ['**/*.{ts,tsx}'],
26
- plugins: {
27
- react,
28
- 'jsx-a11y': jsxA11Y,
29
- 'react-hooks': reactHooks,
30
- import: importPlugin,
31
- '@typescript-eslint': typescriptEslint,
32
- '@stylistic/ts': stylisticTs,
24
+ languageOptions: {
25
+ globals: {
26
+ ...globals.browser,
27
+ ...globals.node,
33
28
  },
34
29
 
35
- languageOptions: {
36
- globals: {
37
- ...globals.browser,
38
- ...globals.node,
39
- },
40
-
41
- parser: tsParser,
42
- ecmaVersion: 'latest',
43
- sourceType: 'module',
30
+ parser: tsParser,
31
+ ecmaVersion: 'latest',
32
+ sourceType: 'module',
44
33
 
45
- parserOptions: {
46
- parser: '@typescript-eslint/parser',
47
- project: './tsconfig.json',
34
+ parserOptions: {
35
+ parser: '@typescript-eslint/parser',
36
+ project: './tsconfig.json',
48
37
 
49
- ecmaFeatures: {
50
- generators: false,
51
- objectLiteralDuplicateProperties: false,
52
- jsx: true,
53
- },
38
+ ecmaFeatures: {
39
+ generators: false,
40
+ objectLiteralDuplicateProperties: false,
41
+ jsx: true,
54
42
  },
55
43
  },
44
+ },
56
45
 
57
- settings: {
58
- 'import/parsers': {
59
- '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
60
- },
46
+ settings: {
47
+ 'import/parsers': {
48
+ '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
49
+ },
61
50
 
62
- 'import/resolver': {
63
- node: {
64
- extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
65
- },
51
+ 'import/resolver': {
52
+ node: {
53
+ extensions: ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
66
54
  },
55
+ },
67
56
 
68
- 'import/extensions': ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
69
- 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
70
- 'import/core-modules': [],
71
- 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
72
-
73
- react: {
74
- pragma: 'React',
75
- version: 'detect',
76
- },
57
+ 'import/extensions': ['.js', '.mjs', '.cjs', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
58
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
59
+ 'import/core-modules': [],
60
+ 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
77
61
 
78
- propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'],
62
+ react: {
63
+ pragma: 'React',
64
+ version: 'detect',
79
65
  },
80
66
 
81
- rules: {
82
- ...baseConfigRules.base,
83
- 'react/jsx-filename-extension': ['error', {
84
- extensions: ['.jsx', '.tsx'],
85
- }],
86
- },
67
+ propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'],
87
68
  },
88
- ...tsConfig,
69
+
70
+ rules: {
71
+ ...reactMainRule.rules,
72
+ 'react/jsx-filename-extension': ['error', {
73
+ extensions: ['.jsx', '.tsx'],
74
+ }],
75
+ },
76
+ };
77
+
78
+ export default [
79
+ ignoreRule,
80
+ baseMainRule,
81
+ tsMainRule,
82
+ reactMainRule,
83
+ mainRule,
84
+ baseTestRule,
85
+ tsTestRule,
89
86
  ];
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.17.0",
12
+ "version": "2.19.0",
13
13
  "keywords": [
14
14
  "linter",
15
15
  "config",
@@ -39,8 +39,9 @@
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.17.0",
43
- "eslint-config-entva-typescript-base": "^2.17.0",
42
+ "eslint-config-entva": "^2.18.1",
43
+ "eslint-config-entva-base": "^2.18.0",
44
+ "eslint-config-entva-typescript-base": "^2.19.0",
44
45
  "eslint-plugin-import": "^2.31.0",
45
46
  "globals": "^15.14.0"
46
47
  },