veza/.husky/pre-commit
senke 9a0e1c4680 implicit: implement Implicit 9.2, 10.1, 10.2 - env validation and pre-commit hooks
- Implicit 9.2: Verified env validation already implemented (Zod schema with clear errors)
- Implicit 10.1: Added type checking to pre-commit hook (blocks on errors, allows warnings)
- Implicit 10.2: Added linting to pre-commit hook (blocks on errors, allows warnings)
- Pre-commit hook now runs: type generation, type checking, linting
- Prevents commits with TypeScript or linting errors
- Provides helpful error messages and tips
- Note: Pre-existing TypeScript errors in codebase will block commits until fixed
2026-01-16 13:04:49 +01:00

21 lines
820 B
Bash
Executable file

#!/usr/bin/env sh
# Generate TypeScript types from OpenAPI spec before commit
# This ensures types are always up-to-date with the backend API
cd apps/web && bash scripts/generate-types.sh
# Implicit 10.1: Type checking
# Prevent commits with TypeScript errors (warnings are allowed)
cd apps/web && npm run typecheck 2>&1 | grep -q "error TS" && {
echo "❌ Type checking failed. Please fix TypeScript errors before committing."
echo "💡 Run 'npm run typecheck' to see all errors."
exit 1
} || true
# Implicit 10.2: Linting
# Prevent commits with linting errors (warnings are allowed)
cd apps/web && npm run lint 2>&1 | grep -q "error" && {
echo "❌ Linting failed. Please fix linting errors before committing."
echo "💡 Tip: Run 'npm run lint:fix' to automatically fix some issues."
exit 1
} || true