-
Notifications
You must be signed in to change notification settings - Fork 12
/
.eslintrc.cjs
118 lines (118 loc) · 3.55 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended'
],
overrides: [
{
plugins: ['react', '@typescript-eslint', 'react-refresh'],
files: ['*.ts', '*.tsx'],
rules: {
'react-refresh/only-export-components': 'warn',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'error', {
varsIgnorePattern: '^_',
argsIgnorePattern: '^_'
}
],
// TODO fix start
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-restricted-imports': [
'error',
{
patterns: [
{
group: ['**/dist', '**/dist/**'],
message: 'Don not import from dist',
allowTypeImports: false
},
{
group: ['**/src', '**/src/**'],
message: 'Don not import from src',
allowTypeImports: false
}
]
}
],
// JSX
'jsx-quotes': ['error', 'prefer-single'],
'react/prop-types': 'off',
'react/jsx-indent': ['error', 2],
'react/jsx-indent-props': ['error', 'first'],
'react/jsx-tag-spacing': ['error', {
closingSlash: 'never',
beforeSelfClosing: 'always',
afterOpening: 'never',
beforeClosing: 'never',
}],
}
},
],
settings: {
react: {
version: '18'
}
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['react', '@typescript-eslint', 'simple-import-sort'],
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: false }
],
'@typescript-eslint/no-namespace': 'off',
'no-unused-vars': 'off',
'simple-import-sort/imports': ['error', {
groups: [
// Style imports.
['^.+\\.s?css$'],
// Side effect imports.
['^\\u0000'],
// Style imports.
['^\/\/'],
// Packages. `react` related packages come first.
['^react', '^@?\\w'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
}],
'simple-import-sort/exports': 'error',
'semi': ['error', 'never'],
'quotes': ['error', 'single'],
'keyword-spacing': ['error', { before: true, after: true }],
'space-before-blocks': ['error', 'always'],
'comma-dangle': ['error', 'never'],
'comma-spacing': ['error', { before: false, after: true }],
'no-multi-spaces': ['error', {
ignoreEOLComments: true
}],
'block-spacing': 'error',
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 'first',
// ignore jsx node, template literal expression
ignoredNodes: ['JSXElement *', 'TemplateLiteral *']
}],
"space-infix-ops": 1
}
}