-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.eslintrc.js
110 lines (103 loc) · 2.66 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
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
jest: true,
},
globals: {
context: 'readonly',
given: 'readonly',
},
ignorePatterns: [
'.next/',
'node_modules/',
'.pnp.cjs',
'.pnp.loader.mjs',
'public',
'.yarn',
'@types',
],
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
extends: [
'next',
'prettier',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:storybook/recommended',
],
plugins: ['prettier', 'import', '@typescript-eslint', 'simple-import-sort', 'unused-imports'],
parser: '@typescript-eslint/parser',
rules: {
'prettier/prettier': 'error',
'no-var': 'error',
'prefer-const': 'error',
'no-implicit-coercion': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
selector: 'variable',
leadingUnderscore: 'allow',
},
{ format: ['camelCase', 'PascalCase'], selector: 'function' },
{ format: ['PascalCase'], selector: 'interface' },
{ format: ['PascalCase'], selector: 'typeAlias' },
],
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true, argsIgnorePattern: '_', varsIgnorePattern: '_' },
],
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'react/jsx-no-target-blank': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'import/no-duplicates': 'error',
'import/newline-after-import': 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
// react > next > @ > a~z
['^react$', '^next', '^@', '^[a-z]'],
// ~
['^~'],
// ./ > ../ > ../../
['^\\./?$', '^\\.(?!/?$)', '^\\./(?=.*/)(?!/?$)', '^\\.\\./?$', '^\\.\\.(?!/?$)'],
// Side effect imports
['^\\u0000'],
],
},
],
'no-console': [
'warn',
{
allow: ['warn', 'error'],
},
],
'import/default': 'off',
'import/namespace': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
};