|
1 |
| -import eslint from '@eslint/js'; |
2 |
| -import stylistic from '@stylistic/eslint-plugin'; |
3 |
| -import pluginJsxA11y from 'eslint-plugin-jsx-a11y'; |
4 |
| -import react from 'eslint-plugin-react'; |
5 |
| -import eslintPluginReactHooks from 'eslint-plugin-react-hooks'; |
6 |
| -import simpleImportSort from 'eslint-plugin-simple-import-sort'; |
7 |
| -import tseslint from 'typescript-eslint'; |
8 |
| - |
9 |
| -export const baseConfig = tseslint.config( |
10 |
| - eslint.configs.recommended, |
11 |
| - ...tseslint.configs.recommended, |
12 |
| - { |
13 |
| - plugins: { |
14 |
| - '@stylistic': stylistic, |
15 |
| - 'simple-import-sort': simpleImportSort, |
16 |
| - }, |
17 |
| - rules: { |
18 |
| - '@stylistic/arrow-parens': 'error', |
19 |
| - '@stylistic/arrow-spacing': 'error', |
20 |
| - '@stylistic/block-spacing': 'error', |
21 |
| - '@stylistic/comma-dangle': ['error', 'always-multiline'], |
22 |
| - '@stylistic/eol-last': 'error', |
23 |
| - '@stylistic/function-call-spacing': 'error', |
24 |
| - '@stylistic/indent': ['error', 2], |
25 |
| - '@stylistic/key-spacing': 'error', |
26 |
| - '@stylistic/keyword-spacing': 'error', |
27 |
| - '@stylistic/max-len': [ |
28 |
| - 'error', |
29 |
| - // Do not allow more than 120 characters per line, except for long strings and comments in the same line |
30 |
| - { 'code': 120, 'ignoreComments': true, 'ignoreStrings': true, 'ignoreTemplateLiterals': true }, |
31 |
| - ], |
32 |
| - '@stylistic/no-trailing-spaces': 'error', |
33 |
| - '@stylistic/object-curly-spacing': ['error', 'always'], |
34 |
| - '@stylistic/quotes': ['error', 'single'], |
35 |
| - '@stylistic/jsx-quotes': ['error', 'prefer-double'], |
36 |
| - '@stylistic/rest-spread-spacing': 'error', |
37 |
| - '@stylistic/semi': 'error', |
38 |
| - '@stylistic/spaced-comment': 'error', |
39 |
| - '@stylistic/no-multiple-empty-lines': ['error', { 'max': 1 }], |
40 |
| - |
41 |
| - '@typescript-eslint/consistent-type-imports': 'error', |
42 |
| - |
43 |
| - 'simple-import-sort/imports': ['error', { |
44 |
| - 'groups': [ |
45 |
| - // First external imports, then local imports, then styles imports |
46 |
| - ['^', '^\\.', '\\.s?css$'] |
47 |
| - ] |
48 |
| - }], |
49 |
| - 'no-restricted-exports': ['error', { |
50 |
| - 'restrictDefaultExports': { |
51 |
| - 'direct': true, |
52 |
| - 'named': true, |
53 |
| - 'defaultFrom': true, |
54 |
| - 'namedFrom': true, |
55 |
| - 'namespaceFrom': true |
56 |
| - } |
57 |
| - }], |
58 |
| - |
59 |
| - // Disabled rules from presets |
60 |
| - '@typescript-eslint/ban-types': 'off', |
61 |
| - '@typescript-eslint/no-explicit-any': 'off', |
62 |
| - }, |
63 |
| - }, |
64 |
| - { |
65 |
| - files: ['*.test.*', '*.spec.*'], |
66 |
| - rules: { |
67 |
| - 'prefer-promise-reject-errors': 'off', |
68 |
| - 'no-param-reassign': 'off', |
69 |
| - '@typescript-eslint/no-shadow': 'off', |
70 |
| - }, |
71 |
| - }, |
72 |
| -); |
73 |
| - |
74 |
| -export const reactConfig = [ |
75 |
| - react.configs.flat.recommended, |
76 |
| - react.configs.flat['jsx-runtime'], |
77 |
| - pluginJsxA11y.flatConfigs.recommended, |
78 |
| - { |
79 |
| - plugins: { |
80 |
| - 'react-hooks': eslintPluginReactHooks, |
81 |
| - }, |
82 |
| - languageOptions: { |
83 |
| - parserOptions: { |
84 |
| - ecmaFeatures: { |
85 |
| - jsx: true, |
86 |
| - }, |
87 |
| - }, |
88 |
| - }, |
89 |
| - settings: { |
90 |
| - react: { |
91 |
| - version: 'detect' |
92 |
| - } |
93 |
| - }, |
94 |
| - rules: { |
95 |
| - 'react/jsx-tag-spacing': ['error', { beforeClosing: 'never' }], |
96 |
| - 'react-hooks/rules-of-hooks': 'error', |
97 |
| - 'react-hooks/exhaustive-deps': 'error', |
98 |
| - |
99 |
| - // Disabled rules from presets |
100 |
| - 'react/display-name': ['off', { 'ignoreTranspilerName': false }], |
101 |
| - 'react/prop-types': 'off', |
102 |
| - }, |
103 |
| - }, |
104 |
| - { |
105 |
| - files: ['*.test.*', '*.spec.*'], |
106 |
| - rules: { |
107 |
| - 'react/no-children-prop': 'off', |
108 |
| - }, |
109 |
| - }, |
110 |
| -]; |
| 1 | +import baseConfig from './base.js'; |
| 2 | +import reactConfig from './react.js'; |
111 | 3 |
|
112 | 4 | export default [
|
113 | 5 | ...baseConfig,
|
|
0 commit comments