-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.cjs
75 lines (75 loc) · 2.22 KB
/
.eslintrc.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module.exports = {
root: true,
env: { browser: true, es2022: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:import/recommended',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react-hooks/recommended',
'plugin:react-redux/recommended',
'plugin:@typescript-eslint/recommended'
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', 'simple-import-sort', 'react-redux'],
rules: {
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_'
}
],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
],
'react/react-in-jsx-scope': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'react-redux/connect-prefer-named-arguments': 2,
'import/named': 'off',
'react-redux/useSelector-prefer-selectors': 'off'
},
settings: {
react: {
version: 'detect'
},
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
},
overrides: [
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'simple-import-sort/imports': [
'error',
{
groups: [
// Импорты из 'react' и других библиотек
['^react', '^@?\\w'],
// Импорты из ваших алиасов и компонентов
['^(@|components)(/.*|$)'],
// Импорты с абсолютными путями (например, из виртуальных модулей)
['^\\u0000'],
// Импорты из родительских директорий
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Импорты из текущей директории
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Импорты файлов стилей (CSS)
['^.+\\.?(css)$']
]
}
]
}
}
]
};