-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
246 lines (246 loc) · 6.53 KB
/
Copy path.eslintrc.js
File metadata and controls
246 lines (246 loc) · 6.53 KB
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
module.exports = {
extends: [
"next/core-web-vitals",
"next",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
plugins: ["prettier", "import"],
rules: {
// import 순서 강제
"import/order": [
"error",
{
groups: [
"builtin", // Node.js 내장 모듈
"external", // 외부 라이브러리
"internal", // 내부 절대경로 (@/)
["parent", "sibling", "index"], // 상대경로
],
pathGroups: [
// lib
{
pattern: "@/lib/**",
group: "internal",
position: "before",
},
// types (shared)
{
pattern: "@/types/**",
group: "internal",
position: "before",
},
// types (domain)
{
pattern: "@/domains/**/types/**",
group: "internal",
position: "before",
},
// utils (shared)
{
pattern: "@/utils/**",
group: "internal",
position: "before",
},
// utils (domain)
{
pattern: "@/domains/**/utils/**",
group: "internal",
position: "before",
},
// hooks (shared)
{
pattern: "@/hooks/**",
group: "internal",
position: "before",
},
// hooks (domain)
{
pattern: "@/domains/**/hooks/**",
group: "internal",
position: "before",
},
// apis (shared)
{
pattern: "@/api/**",
group: "internal",
position: "before",
},
// apis (domain)
{
pattern: "@/domains/**/api/**",
group: "internal",
position: "before",
},
// stores (shared)
{
pattern: "@/store/**",
group: "internal",
position: "before",
},
// stores (domain)
{
pattern: "@/domains/**/store/**",
group: "internal",
position: "before",
},
// components (shared)
{
pattern: "@/components/**",
group: "internal",
position: "before",
},
// components (domain)
{
pattern: "@/domains/**/components/**",
group: "internal",
position: "before",
},
],
pathGroupsExcludedImportTypes: ["builtin"],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
// 절대경로(@/) 강제 사용
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["../*", "./*"],
message: "상대경로 사용 금지. 절대경로(@/)를 사용하세요.",
},
],
},
],
// typescript-eslint rule을 정의하기 위해 기존 규칙 off
"no-unused-vars": "off",
// 사용하지 않은 변수(인자)가 있으면 에러, _로 시작하는 변수(인자)는 무시
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
},
],
// useEffect의 deps에 필요없는 변수를 삽입하지 않은 경우
"react-hooks/exhaustive-deps": "off",
},
overrides: [
{
// auth 도메인: 다른 도메인 참조 금지 (같은 도메인 내부는 허용)
files: ["src/domains/auth/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/!(auth)/**"],
message:
"도메인 간 직접 참조 금지. 페이지에서 조립하거나 공통 types(@/types)만 참조하세요.",
},
],
},
],
},
},
{
// record 도메인: 다른 도메인 참조 금지
files: ["src/domains/record/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/!(record)/**"],
message:
"도메인 간 직접 참조 금지. 페이지에서 조립하거나 공통 types(@/types)만 참조하세요.",
},
],
},
],
},
},
{
// profile 도메인: 다른 도메인 참조 금지
files: ["src/domains/profile/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/!(profile)/**"],
message:
"도메인 간 직접 참조 금지. 페이지에서 조립하거나 공통 types(@/types)만 참조하세요.",
},
],
},
],
},
},
{
// place 도메인: 다른 도메인 참조 금지
files: ["src/domains/place/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/!(place)/**"],
message:
"도메인 간 직접 참조 금지. 페이지에서 조립하거나 공통 types(@/types)만 참조하세요.",
},
],
},
],
},
},
{
// jjikboul 도메인: 다른 도메인 참조 금지
files: ["src/domains/jjikboul/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/!(jjikboul)/**"],
message:
"도메인 간 직접 참조 금지. 페이지에서 조립하거나 공통 types(@/types)만 참조하세요.",
},
],
},
],
},
},
{
// components, hooks 폴더에서 도메인 import 금지
files: ["src/components/**/*", "src/hooks/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@/domains/**"],
message:
"공통 컴포넌트/훅에서 도메인 참조 금지. types, utils만 참조 가능합니다.",
},
],
},
],
},
},
],
};