-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
158 lines (143 loc) · 4.22 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
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
const aliases = require('./tsconfig.paths.json').compilerOptions.paths;
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:@tanstack/eslint-plugin-query/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', '@tanstack/query'],
settings: {
'import/resolver': {
alias: {
extensions: ['.ts', '.tsx'],
map: Object.entries(aliases).map(([key, value]) => {
const newPathKey = key.replace('/*', '');
const newPathValue = `./${value[0].replace('/*', '')}`;
return [newPathKey, newPathValue];
}),
},
},
},
rules: {
'no-implicit-coercion': 'error',
'no-undef': 'off',
indent: 'off',
'@typescript-eslint/indent': 'off',
semi: 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-extra-boolean-cast': 'off',
'getter-return': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'util',
importNames: ['isArray'],
message: '`Array.isArray`를 대신 사용해주세요!',
},
],
},
],
'no-async-promise-executor': 'warn',
'@typescript-eslint/prefer-as-const': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@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/explicit-module-boundary-types': 'off',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'public-static-field',
'private-static-field',
'public-instance-field',
'private-instance-field',
'public-constructor',
'private-constructor',
'public-instance-method',
'private-instance-method',
],
},
],
'no-warning-comments': [
'warn',
{
terms: ['TODO', 'FIXME', 'XXX', 'BUG'],
location: 'anywhere',
},
],
'prefer-const': 'error',
'no-var': 'error',
curly: ['error', 'all'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'import/no-duplicates': 'error',
'react/prop-types': 'off',
'react/display-name': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/no-var-requires': 'warn',
'react/react-in-jsx-scope': 'off',
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [
'type',
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'unknown',
],
pathGroups: [
{
pattern: 'react*',
group: 'external',
position: 'before',
},
...Object.keys(aliases).map((key) => {
return {
pattern: key,
group: 'internal',
position: 'after',
};
}),
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
};