-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path.eslintrc.js
119 lines (116 loc) · 2.95 KB
/
.eslintrc.js
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
119
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'plugin:react/recommended',
'airbnb-typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['build/**/*.js', 'public/**/*.js', 'config-overrides.js'],
overrides: [
{
files: ['.eslintrc.js'],
rules: {
'sort-keys-fix/sort-keys-fix': [
'error',
'asc',
{
caseSensitive: false,
},
],
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: './tsconfig.json',
sourceType: 'module',
tsconfigRootDir: __dirname,
},
plugins: [
'react',
'react-hooks',
'@typescript-eslint',
'jest',
'import',
'sort-keys-fix',
],
root: true,
rules: {
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/naming-convention': [
'error',
{ format: ['UPPER_CASE'], selector: 'enum' },
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'arrow-body-style': ['error', 'as-needed'],
'import/no-extraneous-dependencies': 'off',
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
pathGroups: [
{
group: 'external',
pattern: 'react',
position: 'before',
},
{
group: 'internal',
pattern: '@/**',
position: 'before',
},
{
group: 'object',
pattern: '{.,..}/**/*.scss',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['react'],
warnOnUnassignedImports: true,
},
],
'linebreak-style': 'off',
'no-console': 1,
'prefer-const': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react/display-name': 'error',
'react/jsx-curly-brace-presence': 'error',
'react/jsx-uses-react': 'off',
'react/no-array-index-key': 'error',
'react/react-in-jsx-scope': 'off',
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
react: {
version: 'detect',
},
},
};