-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy path.eslintrc.js
282 lines (272 loc) · 8.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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true,
globalReturn: false,
},
project: './tsconfig.json',
// project: [path.resolve(__dirname, './tsconfig.eslint.json')],
// tsconfigRootDir: __dirname,
warnOnUnsupportedTypeScriptVersion: true,
},
globals: {},
extends: [
'eslint:recommended',
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'react-app',
'next/core-web-vitals',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:array-func/all',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:jsx-a11y/recommended',
'plugin:lodash/recommended',
'plugin:promise/recommended',
'plugin:react/recommended',
'plugin:react-perf/all',
'plugin:security/recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'plugin:prettier/recommended',
],
plugins: [
'array-func',
'cflint',
'import',
'jest',
'jsx-a11y',
'lodash',
'no-loops',
'no-secrets',
'node',
'only-ascii',
'promise',
'react',
'react-hooks',
'react-perf',
'security',
'sonarjs',
'unicorn',
'unused-imports',
'only-warn',
'@typescript-eslint',
'prettier',
],
reportUnusedDisableDirectives: true,
rules: {
'@next/next/no-img-element': 'off',
'@next/next/no-title-in-document-head': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/unbound-method': ['off'],
'array-func/no-unnecessary-this-arg': 'off',
'array-func/prefer-array-from': 'off',
'camelcase': 'warn',
'cflint/no-substr': 'warn',
'cflint/no-this-assignment': 'warn',
'import/extensions': [
'warn',
'ignorePackages',
{
js: 'never',
jsx: 'never',
mjs: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/no-extraneous-dependencies': ['warn', { devDependencies: true }],
'import/no-useless-path-segments': 'off',
'import/no-webpack-loader-syntax': 'off',
'import/order': 'warn',
'import/prefer-default-export': 'off',
'jest/consistent-test-it': 'warn',
'jest/expect-expect': 'warn',
'jest/no-done-callback': 'warn',
'jsx-a11y/label-has-associated-control': ['warn', { assert: 'either' }],
'lodash/chaining': 'off',
'lodash/import-scope': 'off',
'lodash/matches-prop-shorthand': 'off',
'lodash/prefer-constant': 'off',
'lodash/prefer-lodash-chain': 'off',
'lodash/prefer-lodash-method': 'off',
'lodash/prefer-lodash-typecheck': 'off',
'lodash/prefer-noop': 'off',
'lodash/preferred-alias': 'off',
'lodash/prop-shorthand': 'off',
'max-classes-per-file': 'off',
'no-console': ['warn', { allow: ['info', 'warn', 'error', 'memory'] }],
'no-loops/no-loops': 'warn',
'no-param-reassign': ['warn', { ignorePropertyModificationsFor: ['draft'] }],
'no-secrets/no-secrets': ['warn', { tolerance: 5 }],
'no-shadow': 'off',
'no-unused-vars': 'off',
'only-ascii/only-ascii': 'warn',
'prefer-const': ['warn', { destructuring: 'all' }],
'prefer-for-of': 'off',
'prettier/prettier': 'warn',
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks: '(useRecoilCallback|useRecoilTransaction|useRecoilTransaction_UNSTABLE)',
},
],
'react/destructuring-assignment': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/jsx-filename-extension': ['warn', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/jsx-props-no-spreading': 'off',
'react/no-unused-prop-types': 'off',
'react/prop-types': 'off',
'react/require-default-props': 'off',
'react/state-in-constructor': 'off',
'security/detect-non-literal-fs-filename': 'off',
'security/detect-object-injection': 'off',
'sonarjs/cognitive-complexity': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/escape-case': 'off',
'unicorn/filename-case': 'off',
'unicorn/new-for-builtins': 'off',
'unicorn/no-abusive-eslint-disable': 'warn',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-array-method-this-argument': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-fn-reference-in-iterator': 'off',
'unicorn/no-null': 'off',
'unicorn/no-reduce': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/no-zero-fractions': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/prefer-query-selector': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prevent-abbreviations': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
],
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
'require-await': 'off',
'@typescript-eslint/require-await': 'off',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-duplicate-imports': 'off',
},
env: {
browser: true,
es6: true,
jest: true,
node: true,
},
settings: {
'react': {
version: 'detect',
},
'import/parsers': {
'@typescript-eslint/parser': ['.js', '.jsx', '.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
overrides: [
{
files: ['src/pages/**/*', 'src/types/**/*'],
rules: {
'no-restricted-exports': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/ban-types': ['warn', { extendDefaults: true, types: { object: false } }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'import/no-duplicates': 'off',
'no-useless-constructor': 'off',
'react/prefer-stateless-function': 'off',
},
},
{
files: [
'.eslintrc.js',
'babel-node.config.js',
'config/**/*.js',
'config/**/*.ts',
'config/jest/mocks/**/*.js',
'infra/**/*.js',
'jest-runner-eslint.config.js',
'jest.config.js',
'lib/EnvVarError.js',
'lib/findModuleRoot.js',
'lib/getenv.js',
'next.config.js',
'postcss.config.js',
'stylelint.config.js',
'webpack.config.js',
],
rules: {
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'global-require': 'off',
'import/extensions': 'off',
'import/no-anonymous-default-export': 'off',
'import/no-import-module-exports': 'off',
'security/detect-child-process': 'off',
'sonarjs/cognitive-complexity': ['warn', 50],
'unicorn/prefer-module': 'off',
},
},
{
files: ['config/jest/mocks/**/*.js'],
rules: {
'no-constructor-return': 'off',
'react-perf/jsx-no-new-function-as-prop': 'off',
'react/display-name': 'off',
'react/function-component-definition': 'off',
},
},
{
files: ['**/*.test.*', '**/__test__/**', '**/__tests__/**', '**/test/**', '**/tests/**'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-identical-functions': 'off',
},
},
],
}