ship-gis/.githooks/pre-commit
htlee 3060973f92 chore: React 19 + Vite 7 + ESLint 9 + Zustand 5 업그레이드
- React 18.2 → 19.2.4, react-dom 19.2.4
- Vite 5.2.10 → 7.3.1, @vitejs/plugin-react 5.1.4
- ESLint 8.44 → 9.39.2 flat config, typescript-eslint 8.55.0
- eslint-plugin-react-hooks 7.0.1 (신규 규칙 warn 설정)
- Zustand 4.5 → 5.0.11 (shallow → useShallow 마이그레이션)
- sass 1.77.8 → 1.97.3
- sockjs-client, flatgeobuf 미사용 패키지 제거
- react-router-dom v7 future flag 적용
- vite.config.ts: defineConfig 함수형, build.target: es2022

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:37:37 +09:00

37 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#==============================================================================
# pre-commit hook (React TypeScript)
# ESLint 검증 — 실패 시 커밋 차단
#==============================================================================
# npm 확인
if ! command -v npx &>/dev/null; then
echo "경고: npx가 설치되지 않았습니다. 검증을 건너뜁니다."
exit 0
fi
# node_modules 확인
if [ ! -d "node_modules" ]; then
echo "경고: node_modules가 없습니다. 'yarn install' 실행 후 다시 시도하세요."
exit 0
fi
# ESLint 검증 (설정 파일이 있는 경우만)
if [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f ".eslintrc.cjs" ] || [ -f "eslint.config.js" ] || [ -f "eslint.config.mjs" ]; then
echo "pre-commit: ESLint 검증 중..."
npx eslint src/ --quiet 2>&1
LINT_RESULT=$?
if [ $LINT_RESULT -ne 0 ]; then
echo ""
echo "╔══════════════════════════════════════════════════════════╗"
echo "║ ESLint 에러! 커밋이 차단되었습니다. ║"
echo "║ 'npx eslint src/ --fix'로 자동 수정을 시도해보세요. ║"
echo "╚══════════════════════════════════════════════════════════╝"
echo ""
exit 1
fi
echo "pre-commit: ESLint 통과"
fi