-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
184 lines (183 loc) · 4.84 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
const prettierConfig = require('./.prettierrc.js');
module.exports = {
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
extends: [
'airbnb',
'airbnb/hooks',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
'prettier/react',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
createDefaultProgram: true,
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2019,
sourceType: 'module',
project: './tsconfig.json',
},
plugins: [
'react',
'import',
'jsx-a11y',
'react-hooks',
'@typescript-eslint',
'simple-import-sort',
'prettier',
],
overrides: [
{
files: '*.js',
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
camelcase: ['off'],
},
},
],
rules: {
'@typescript-eslint/no-this-alias': [
'error',
{
allowDestructuring: true,
allowedNames: ['self'],
},
],
'@typescript-eslint/no-unused-vars': 'error',
'prettier/prettier': ['warn', prettierConfig],
'quote-props': ['error', 'consistent-as-needed'],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/require-default-props': 'off',
'react/prop-types': 'off',
'react/destructuring-assignment': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
'react/jsx-props-no-spreading': 'off',
'react/jsx-wrap-multilines': [
'warn',
{
declaration: 'parens-new-line',
assignment: 'parens-new-line',
return: 'parens-new-line',
arrow: 'parens-new-line',
condition: 'parens-new-line',
logical: 'parens-new-line',
prop: 'ignore',
},
],
'sort-imports': 'off',
'no-param-reassign': [
2,
{
props: false,
},
],
'import/order': 'off',
'import/no-cycle': 'off',
'no-debugger': 'off',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'no-confusing-arrow': ['error', { allowParens: false }],
'no-underscore-dangle': ['error', { allow: ['__typename'] }],
'simple-import-sort/sort': [
'warn',
{
// https://github.com/lydell/eslint-plugin-simple-import-sort/blob/master/examples/.eslintrc.js#L71
groups:
// [
// // [
// // '^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)',
// // ],
// ['^@?'],
// ['^react'],
// ['^index'],
// ['^(@|@company|@ui|components|utils|config|vendored-lib)(/.*|$)'],
// ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// ['^\\u0000'],
// ['^.+\\.s?css$'],
// ],
[
['^react'],
['^mobx|redux|store|reducer|RootReducer|react-redux'],
['^@?\\w'],
['^(@|@company|@ui|components|utils|config|vendored-lib)(/.*|$)'],
['^pages|components|index'],
['^utils|hooks|store|appConstant|types|services'],
[
'^.*\\u0000$',
'^\\u0000',
'^\\.\\.(?!/?$)',
'^\\.\\./?$',
'^\\./(?=.*/)(?!/?$)',
'^\\.(?!/?$)',
'^\\./?$',
],
['^assets'],
['^.+\\.s?css$'],
],
},
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error'],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/ban-types': [
'error',
{
extendDefaults: true,
types: {
'{}': false,
},
},
],
'no-console': [
'warn',
{
allow: ['debug', 'error'],
},
],
'no-unused-vars': 'warn',
},
settings: {
'import/resolver': {
node: {
paths: ['src'],
},
},
},
};