-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.eslintrc.js
222 lines (221 loc) · 6.31 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
module.exports = {
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
parserOptions: {
project: ['./tsconfig.json'], // Specify it only for TypeScript files
tsconfigRootDir: __dirname,
},
plugins: ['cypress', 'import', 'prettier', '@typescript-eslint'],
rules: {
// Place to specify Typescript specific ESLint rules.
// Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
'import/no-unresolved': 'off',
// ! enabling @typescript-eslint/recommended-requiring-type-checking triggers a lot of errors
// ! as type-checking is more strict than usual. In order to fix those errors progressively,
// ! we have changed the configuration rules from error to warning for now to avoid crashing the deploy.
// ! This does not mean the below rules are meant to stay as if, the warning must be fixed until
// ! linter does not complain about a specific rule and can be safely removed from below.
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
// ---
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [1, {
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
}],
}
},
],
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
},
env: {
browser: true,
node: true,
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
extends: [
'airbnb',
'prettier',
],
plugins: ['cypress', 'import', 'prettier'],
rules: {
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react/jsx-filename-extension': 'off',
'react/prop-types': 0,
'no-console': [1, { allow: ['info', 'warn', 'error'] }],
'react/jsx-props-no-spreading': [0, {}],
'arrow-body-style': 0,
'import/no-named-as-default': 0,
'import/prefer-default-export': 0,
'import/no-cycle': 0,
'no-param-reassign': ['error', { props: false }],
'prettier/prettier': 1,
'no-restricted-exports': 0,
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
pathGroups: [
{
pattern: 'react',
group: 'builtin',
},
{
pattern: 'react**',
group: 'builtin',
},
{
pattern: '@react**',
group: 'builtin',
},
{
pattern: 'redux_modules/**',
group: 'builtin',
},
{
pattern: 'router',
group: 'builtin',
position: 'after',
},
{
pattern: '@loadable/**',
group: 'builtin',
position: 'after',
},
{
pattern: '@transifex/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'lodash',
group: 'builtin',
},
{
pattern: 'selectors/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'prop-types',
group: 'builtin',
position: 'after',
},
{
pattern: 'actions/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'utils/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'reselect',
group: 'builtin',
},
{
pattern: 'next/**',
group: 'builtin',
position: 'after',
},
{
pattern: 'node_modules/**',
group: 'builtin',
},
{
pattern: 'hooks/**',
group: 'internal',
position: 'before',
},
{
pattern: 'scenes/**',
group: 'internal',
position: 'before',
},
{
pattern: 'containers/**',
group: 'internal',
position: 'before',
},
{
pattern: 'components/**',
group: 'internal',
},
{
pattern: 'services/**',
group: 'internal',
position: 'after',
},
{
pattern: 'constants/**',
group: 'internal',
position: 'after',
},
{
pattern: 'styles/**',
group: 'internal',
position: 'after',
},
{
pattern: './styles**',
group: 'internal',
position: 'after',
},
{
pattern: 'icons/**',
group: 'internal',
position: 'after',
},
{
pattern: 'images/**',
group: 'internal',
position: 'after',
},
{
pattern: 'svgs/**',
group: 'internal',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['react'],
},
],
},
globals: {
window: true,
},
};