docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,240 @@
|
||||
---
|
||||
id: wiki-2026-0508-ai와-기계에게-검열-맡기기-정적-분석-툴-eslint-p
|
||||
title: 정적 분석 툴 (ESLint, Prettier)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [ESLint, Prettier, linter, formatter, static analysis tools]
|
||||
duplicate_of: none
|
||||
source_trust_level: B
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [eslint, prettier, linter, formatter, static-analysis, ast, code-quality]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-09
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: TypeScript / JavaScript
|
||||
framework: ESLint / Prettier / Biome
|
||||
---
|
||||
|
||||
# 정적 분석 툴 (ESLint + Prettier)
|
||||
|
||||
## 📌 한 줄 통찰
|
||||
> **"매 subjective code review → deterministic tool"**. Linter (ESLint) = bug + style. Formatter (Prettier) = visual. 매 PR 의 mechanical 의 AI / tool, 매 logic 의 human.
|
||||
|
||||
## 📖 핵심
|
||||
|
||||
### Linter vs Formatter
|
||||
|
||||
#### Linter (ESLint)
|
||||
- 매 AST 의 analysis.
|
||||
- 매 logic 의 problem.
|
||||
- Configurable rule.
|
||||
- Auto-fix subset.
|
||||
|
||||
#### Formatter (Prettier)
|
||||
- 매 visual layout (indent, line break).
|
||||
- 매 opinionated (no config debate).
|
||||
- Always auto-fix.
|
||||
|
||||
→ 매 different concern. 매 둘 다 사용.
|
||||
|
||||
### ESLint 의 핵심
|
||||
- 매 rule (built-in + plugin).
|
||||
- 매 severity (error / warn / off).
|
||||
- 매 file pattern (override).
|
||||
- 매 plugin ecosystem 큰.
|
||||
|
||||
### Prettier 의 철학
|
||||
- 매 minimal config.
|
||||
- "End the debate".
|
||||
- 매 language (JS, TS, CSS, HTML, MD, JSON).
|
||||
|
||||
### Modern alternative
|
||||
|
||||
#### Biome (Rust, ESLint + Prettier 의 통합)
|
||||
- 빠름 (10x).
|
||||
- 매 single tool.
|
||||
- 매 ESLint plugin 의 support 부족.
|
||||
|
||||
#### Oxlint (Rust)
|
||||
- 매 ESLint compatible.
|
||||
- 50x faster.
|
||||
|
||||
#### Rome (deprecated)
|
||||
- Biome 의 이름.
|
||||
|
||||
### 매 production setup
|
||||
|
||||
#### Pre-commit
|
||||
- husky + lint-staged.
|
||||
- 매 commit 의 lint + format.
|
||||
|
||||
#### CI
|
||||
- 매 PR 의 lint 의 fail.
|
||||
- 매 format check.
|
||||
|
||||
#### IDE
|
||||
- VS Code 의 ESLint extension.
|
||||
- 매 save 의 auto-fix.
|
||||
|
||||
### TypeScript + ESLint
|
||||
- @typescript-eslint plugin.
|
||||
- 매 type-aware rule.
|
||||
- 매 import order.
|
||||
- 매 unused export.
|
||||
|
||||
### Custom rule
|
||||
- 매 team convention.
|
||||
- 매 architectural pattern.
|
||||
- 매 anti-pattern detect.
|
||||
|
||||
## 💻 Code
|
||||
|
||||
### .eslintrc.json
|
||||
```json
|
||||
{
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"no-console": "warn",
|
||||
"no-unused-vars": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"react/jsx-key": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{ "files": ["*.test.ts"], "rules": { "no-console": "off" } }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### .prettierrc
|
||||
```json
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"tabWidth": 2,
|
||||
"printWidth": 100
|
||||
}
|
||||
```
|
||||
|
||||
### Pre-commit (husky + lint-staged)
|
||||
```json
|
||||
// package.json
|
||||
{
|
||||
"scripts": {
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
||||
"*.{md,json}": ["prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
# .husky/pre-commit
|
||||
#!/bin/sh
|
||||
npx lint-staged
|
||||
```
|
||||
|
||||
### CI workflow
|
||||
```yaml
|
||||
- run: npm run lint
|
||||
- run: npm run format -- --check
|
||||
- run: npm run typecheck
|
||||
```
|
||||
|
||||
### Custom ESLint rule
|
||||
```js
|
||||
// eslint-rules/no-direct-db-import.js
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: { description: 'Direct DB import 의 ban from UI layer' },
|
||||
},
|
||||
create(context) {
|
||||
const filename = context.getFilename();
|
||||
if (!filename.includes('/components/')) return {};
|
||||
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
if (node.source.value.includes('@/db')) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'UI 의 DB 직접 import X. Use service.',
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Biome (modern alternative)
|
||||
```bash
|
||||
npm install -D @biomejs/biome
|
||||
npx biome init
|
||||
npx biome format --write .
|
||||
npx biome lint .
|
||||
```
|
||||
|
||||
### Auto-fix on save (VS Code)
|
||||
```json
|
||||
// .vscode/settings.json
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
|
||||
| 상황 | 추천 |
|
||||
|---|---|
|
||||
| 매 new project | ESLint + Prettier |
|
||||
| 매 large monorepo | Biome (single tool, fast) |
|
||||
| 매 React-heavy | ESLint + react plugin |
|
||||
| 매 type-safe | + @typescript-eslint |
|
||||
| 매 specific convention | Custom rule |
|
||||
| 매 cross-language | Biome / Prettier |
|
||||
|
||||
**기본값**: ESLint + Prettier (separate). 매 large project 의 Biome 의 consider.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Static-Analysis]] · [[Code-Quality]]
|
||||
- 변형: [[Biome]] · [[Oxlint]] · (CSS) · (Python) · (Rust)
|
||||
- 응용: [[AST]]
|
||||
- Adjacent: [[AI_코드_리뷰]] · [[AI-Powered Code Analysis (Autofix + Triage)]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 codebase quality 의 setup. 매 team convention 의 enforce.
|
||||
**언제 X**: 매 throwaway script. 매 specific compliance audit.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Inconsistent rule (per-dev)**: drift.
|
||||
- **No pre-commit hook**: 매 PR 의 매 lint fail.
|
||||
- **ESLint + Prettier 의 conflict (rule overlap)**: eslint-config-prettier 의 사용.
|
||||
- **No auto-fix on save**: manual cycle slow.
|
||||
- **Custom rule 의 over-engineer**: 매 simple 의 readable 더 좋음.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (industry standard).
|
||||
- 신뢰도 B.
|
||||
- Related: [[AI_코드_리뷰]] · [[AI-Powered Code Analysis (Autofix + Triage)]] · [[AST]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-09 | Cleanup — ESLint + Prettier setup + Biome alternative + custom rule |
|
||||
Reference in New Issue
Block a user