Skip to content

Commit a8adabd

Browse files
committed
CDP-30 chore⚙️: Prettier + ESLint 설정
1 parent bb251ec commit a8adabd

File tree

12 files changed

+248
-72
lines changed

12 files changed

+248
-72
lines changed

.github/workflows/frontend-ci.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
branches: [main]
77
types: [opened, reopened, synchronize, ready_for_review]
88

9-
# 빠른 피드백: 기능/작업 브랜치에 push될 때 CI 실행
9+
# 빠른 피드백: 작업 브랜치에 push될 때 CI 실행 (⚠️ 대문자 네이밍만 허용)
1010
push:
1111
branches:
12-
- "Feature/*"
13-
- "Fix/*"
14-
- "Chore/*"
15-
- "Docs/*"
16-
- "Test/*"
17-
- "Refactor/*"
12+
- "Feature/**"
13+
- "Fix/**"
14+
- "Chore/**"
15+
- "Docs/**"
16+
- "Test/**"
17+
- "Refactor/**"
1818

1919
# (선택) Actions 탭에서 수동 실행 버튼
2020
workflow_dispatch: {}
@@ -23,34 +23,51 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525

26+
permissions:
27+
contents: read
28+
2629
env:
2730
NODE_VERSION: "20.19.2"
31+
CI: "true"
2832

2933
jobs:
3034
lint:
35+
name: Style & Lint
3136
runs-on: ubuntu-latest
37+
timeout-minutes: 10
3238
steps:
3339
- uses: actions/checkout@v4
40+
3441
- uses: actions/setup-node@v4
3542
with:
3643
node-version: ${{ env.NODE_VERSION }}
44+
3745
- uses: pnpm/action-setup@v4
3846
with:
3947
run_install: false
48+
4049
- name: Get pnpm store directory
4150
id: pnpm-cache
4251
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
52+
4353
- uses: actions/cache@v4
4454
with:
4555
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
4656
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
4757
restore-keys: ${{ runner.os }}-pnpm-
58+
4859
- run: pnpm install --frozen-lockfile
49-
- run: pnpm run --if-present lint
60+
61+
- name: Prettier check
62+
run: pnpm run --if-present format:check
63+
64+
- name: ESLint
65+
run: pnpm run --if-present lint
5066

5167
test:
5268
runs-on: ubuntu-latest
5369
needs: lint
70+
timeout-minutes: 15
5471
steps:
5572
- uses: actions/checkout@v4
5673
- uses: actions/setup-node@v4
@@ -73,6 +90,7 @@ jobs:
7390
build:
7491
runs-on: ubuntu-latest
7592
needs: test
93+
timeout-minutes: 15
7694
steps:
7795
- uses: actions/checkout@v4
7896
- uses: actions/setup-node@v4
@@ -90,4 +108,13 @@ jobs:
90108
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
91109
restore-keys: ${{ runner.os }}-pnpm-
92110
- run: pnpm install --frozen-lockfile
111+
112+
# (선택) Next.js 빌드 캐시
113+
# - uses: actions/cache@v4
114+
# with:
115+
# path: |
116+
# .next/cache
117+
# key: ${{ runner.os }}-next-${{ hashFiles('pnpm-lock.yaml', 'next.config.*', '**/*.{ts,tsx,js,jsx,css,scss,md,mdx}') }}
118+
# restore-keys: ${{ runner.os }}-next-
119+
93120
- run: pnpm run build

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.next
3+
out
4+
dist
5+
coverage
6+
.turbo
7+
public/generated

.prettierrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"trailingComma": "all",
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"endOfLine": "lf",
11+
"proseWrap": "preserve"
12+
}

eslint.config.mjs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1+
// eslint.config.mjs
2+
import { FlatCompat } from "@eslint/eslintrc";
13
import { dirname } from "path";
24
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
45

56
const __filename = fileURLToPath(import.meta.url);
67
const __dirname = dirname(__filename);
78

8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
});
9+
const compat = new FlatCompat({ baseDirectory: __dirname });
10+
11+
const config = [
12+
// Next 권장 + TS + Prettier 추천(FlatCompat로 레거시 확장 변환)
13+
...compat.extends("next/core-web-vitals", "next/typescript", "plugin:prettier/recommended"),
1114

12-
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
15+
// 무시 목록
1416
{
15-
ignores: [
16-
"node_modules/**",
17-
".next/**",
18-
"out/**",
19-
"build/**",
20-
"next-env.d.ts",
21-
],
17+
ignores: ["node_modules/**", ".next/**", "out/**", "build/**", "next-env.d.ts"],
2218
},
2319
];
2420

25-
export default eslintConfig;
21+
export default config;

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"@types/react-dom": "^19",
2424
"eslint": "^9",
2525
"eslint-config-next": "15.5.3",
26+
"eslint-config-prettier": "^10.1.8",
27+
"eslint-plugin-prettier": "^5.5.4",
28+
"prettier": "^3.6.2",
29+
"prettier-plugin-tailwindcss": "^0.6.14",
2630
"tailwindcss": "^4",
2731
"typescript": "^5"
2832
}

0 commit comments

Comments
 (0)