-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.cjs
70 lines (70 loc) · 1.99 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
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb',
'airbnb-typescript',
'plugin:react/jsx-runtime',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
plugins: [
'react',
'@typescript-eslint',
'simple-import-sort',
'react-hooks',
],
rules: {
'max-len': ['warn', { code: 125 }],
'no-console': ['error', { allow: ['warn', 'error'] }],
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'react/jsx-one-expression-per-line': 0,
'react/no-unescaped-entities': 0,
'import/prefer-default-export': 0,
'react/jsx-props-no-spreading': 0,
'react/require-default-props': 0,
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'@typescript-eslint/no-unused-vars': 'warn', // TODO: delete this once codebase is more stable.
},
overrides: [
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx',
],
rules: {
// override "simple-import-sort" config:
// https://dev.to/julioxavierr/sorting-your-imports-with-eslint-3ped
'simple-import-sort/imports': [
'error',
{
groups: [
// Packages `react` related packages come first.
['^react', '^@?\\w',
],
// Internal packages & aliases.
['^(@|components|services|assets|src|context|hooks|services)(/.*|$)',
],
// Side effect imports.
['^\\u0000',
],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$',
],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$',
],
// Style imports.
['^.+\\.?(css)$',
],
],
},
],
},
},
],
};