@hyeon/linter 11.0.1-dev.3.47 → 11.0.1-dev.3.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -210,7 +210,192 @@ npm install --save-dev @hyeon/linter @biomejs/biome
|
|
|
210
210
|
| **Biome** | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ | ✅ 1개 | ✅ |
|
|
211
211
|
| **ESLint+Prettier** | ⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ❌ 2개+ | ✅ |
|
|
212
212
|
|
|
213
|
-
##
|
|
213
|
+
## 프로젝트별 셋업 가이드
|
|
214
|
+
|
|
215
|
+
> Biome은 파일 확장자로 언어를 자동 감지합니다. `.ts`, `.tsx` 파일은 TS/React 규칙이 자동 적용됩니다.
|
|
216
|
+
> `@hyeon/linter/biome-config`를 `extends`로 상속하면 포맷+린트+import 정리 설정이 한 번에 적용됩니다.
|
|
217
|
+
|
|
218
|
+
### 공통 설치
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm install --save-dev @hyeon/linter @biomejs/biome
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 공통 scripts
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"scripts": {
|
|
229
|
+
"lint": "biome ci .",
|
|
230
|
+
"lint:fix": "biome check --write ."
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### 1) JavaScript 프로젝트
|
|
238
|
+
|
|
239
|
+
```jsonc
|
|
240
|
+
// biome.jsonc
|
|
241
|
+
{
|
|
242
|
+
"extends": ["@hyeon/linter/biome-config"]
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
이것만으로 JS recommended 린트 + 포맷 + import 정리가 활성화됩니다.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### 2) TypeScript 프로젝트
|
|
251
|
+
|
|
252
|
+
```jsonc
|
|
253
|
+
// biome.jsonc
|
|
254
|
+
{
|
|
255
|
+
"extends": ["@hyeon/linter/biome-config"]
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
`.ts` 파일에 대해 TypeScript 규칙(`useImportType`, `noExplicitAny` 등)이 자동 적용됩니다.
|
|
260
|
+
추가 커스터마이징:
|
|
261
|
+
|
|
262
|
+
```jsonc
|
|
263
|
+
{
|
|
264
|
+
"extends": ["@hyeon/linter/biome-config"],
|
|
265
|
+
"linter": {
|
|
266
|
+
"rules": {
|
|
267
|
+
"suspicious": {
|
|
268
|
+
// any를 엄격히 금지하고 싶은 경우
|
|
269
|
+
"noExplicitAny": "error"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### 3) React 프로젝트
|
|
279
|
+
|
|
280
|
+
```jsonc
|
|
281
|
+
// biome.jsonc
|
|
282
|
+
{
|
|
283
|
+
"extends": ["@hyeon/linter/biome-config"]
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
`.tsx` 파일에 대해 React 규칙(`useJsxKeyInIterable`, `useHookAtTopLevel`, `useExhaustiveDependencies` 등)이 자동 적용됩니다.
|
|
288
|
+
별도 React 프리셋 설치가 필요 없습니다.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### 4) TypeScript + React (풀셋)
|
|
293
|
+
|
|
294
|
+
```jsonc
|
|
295
|
+
// biome.jsonc
|
|
296
|
+
{
|
|
297
|
+
"extends": ["@hyeon/linter/biome-config"]
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
TS + React 규칙이 모두 자동 적용됩니다. ESLint에서는 5개 프리셋을 조합해야 했지만 Biome은 1줄입니다.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
### 5) Next.js 프로젝트
|
|
306
|
+
|
|
307
|
+
```jsonc
|
|
308
|
+
// biome.jsonc
|
|
309
|
+
{
|
|
310
|
+
"extends": ["@hyeon/linter/biome-config"],
|
|
311
|
+
"linter": {
|
|
312
|
+
"rules": {
|
|
313
|
+
"nursery": {
|
|
314
|
+
// Next.js 전용 규칙 활성화
|
|
315
|
+
"noImgElement": "error",
|
|
316
|
+
"noHeadElement": "error"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"overrides": [
|
|
321
|
+
{
|
|
322
|
+
"includes": [".next/**"],
|
|
323
|
+
"linter": { "enabled": false },
|
|
324
|
+
"formatter": { "enabled": false }
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### 6) NestJS / 백엔드 프로젝트
|
|
333
|
+
|
|
334
|
+
```jsonc
|
|
335
|
+
// biome.jsonc
|
|
336
|
+
{
|
|
337
|
+
"extends": ["@hyeon/linter/biome-config"],
|
|
338
|
+
"linter": {
|
|
339
|
+
"rules": {
|
|
340
|
+
"style": {
|
|
341
|
+
// NestJS 데코레이터 패턴에서 빈 클래스 허용
|
|
342
|
+
"noUselessConstructor": "off"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"overrides": [
|
|
347
|
+
{
|
|
348
|
+
"includes": ["dist/**"],
|
|
349
|
+
"linter": { "enabled": false },
|
|
350
|
+
"formatter": { "enabled": false }
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
### 7) 모노레포
|
|
359
|
+
|
|
360
|
+
루트에 `biome.jsonc`를 두고, 각 패키지에서 상속합니다:
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
monorepo/
|
|
364
|
+
├── biome.jsonc # extends @hyeon/linter/biome-config
|
|
365
|
+
├── packages/
|
|
366
|
+
│ ├── web/
|
|
367
|
+
│ │ └── biome.jsonc # extends ../../biome.jsonc + Next.js 오버라이드
|
|
368
|
+
│ └── api/
|
|
369
|
+
│ └── biome.jsonc # extends ../../biome.jsonc + NestJS 오버라이드
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
```jsonc
|
|
373
|
+
// packages/web/biome.jsonc
|
|
374
|
+
{
|
|
375
|
+
"extends": ["../../biome.jsonc"],
|
|
376
|
+
"linter": {
|
|
377
|
+
"rules": {
|
|
378
|
+
"nursery": {
|
|
379
|
+
"noImgElement": "error"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### ESLint 프리셋 대응표
|
|
389
|
+
|
|
390
|
+
| 기존 ESLint 프리셋 | Biome 설정 |
|
|
391
|
+
|---|---|
|
|
392
|
+
| `@hyeon/linter/recommended` | `"extends": ["@hyeon/linter/biome-config"]` (기본 포함) |
|
|
393
|
+
| `@hyeon/linter/typescript` | 자동 적용 (`.ts` 파일 감지) |
|
|
394
|
+
| `@hyeon/linter/react` | 자동 적용 (`.tsx` 파일 감지) |
|
|
395
|
+
| `@hyeon/linter/prettier` | 기본 formatter로 통합 |
|
|
396
|
+
| `@hyeon/linter/hansanghyeon` | 기본 설정에 통합 (`noExplicitAny: off` 등) |
|
|
397
|
+
|
|
398
|
+
**ESLint에서 5개 프리셋을 조합하던 것이 Biome에서는 `extends` 1줄로 끝납니다.**
|
|
214
399
|
|
|
215
400
|
### 실행
|
|
216
401
|
|