Skip to content

Commit

Permalink
프론트엔드 lint:fix 스크립트 추가 및 git hook 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
serithemage committed Feb 27, 2025
1 parent fe42d81 commit c742c1e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
12 changes: 8 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ done

# 변경된 부분에 따라 린트, 빌드 및 테스트 실행
if [ "$FRONTEND_CHANGED" = true ]; then
echo "🔍 프론트엔드 변경 감지: 린트, 빌드 및 테스트 실행 중..."
cd frontend && npm run lint && npm run build && npm test
echo "🔍 프론트엔드 변경 감지: 린트 자동 수정, 빌드 및 테스트 실행 중..."
cd frontend && npm run lint:fix
# 수정된 파일들을 다시 스테이징
cd .. && git add frontend/
# 빌드 및 테스트 실행
cd frontend && npm run build && npm test
if [ $? -ne 0 ]; then
echo "❌ 프론트엔드 린트, 빌드 또는 테스트 실패"
echo "❌ 프론트엔드 빌드 또는 테스트 실패"
exit 1
fi
echo "✅ 프론트엔드 린트, 빌드 및 테스트 성공"
echo "✅ 프론트엔드 린트 자동 수정, 빌드 및 테스트 성공"
cd ..
fi

Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"preview": "vite preview",
"test": "echo \"No tests yet, but this will pass for now\" && exit 0"
},
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@
"build:frontend": "cd frontend && npm run build",
"build:backend": "cd backend && npm run build",
"lint:frontend": "cd frontend && npm run lint",
"lint:backend": "cd backend && npm run lint"
"lint:backend": "cd backend && npm run lint",
"lint:fix:frontend": "cd frontend && npm run lint:fix",
"lint:fix:backend": "cd backend && npm run lint:fix"
},
"devDependencies": {
"husky": "^8.0.3",
"lint-staged": "^15.2.0"
},
"lint-staged": {
"frontend/**/*.{js,jsx,ts,tsx}": [
"npm run lint:frontend",
"npm run lint:fix:frontend",
"npm run build:frontend",
"npm run test:frontend"
],
"backend/**/*.{js,ts}": [
"npm run lint:backend",
"npm run lint:fix:backend",
"npm run build:backend",
"npm run test:backend"
]
Expand Down

0 comments on commit c742c1e

Please sign in to comment.