diff --git a/.husky/pre-commit b/.husky/pre-commit index 8ca67cc92..4b9be8d24 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -3,3 +3,19 @@ # 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 diff --git a/EXHAUSTIVE_TODO_LIST.md b/EXHAUSTIVE_TODO_LIST.md index a7f1b169a..639d2c675 100644 --- a/EXHAUSTIVE_TODO_LIST.md +++ b/EXHAUSTIVE_TODO_LIST.md @@ -4922,12 +4922,19 @@ If any task fails: - **Result**: Complete environment variable documentation for developers - **Rollback**: Delete .env.example -- [ ] **Implicit 9.2**: Add validation for environment variables +- [x] **Implicit 9.2**: Add validation for environment variables - **Scope**: `apps/web/src/config/env.ts` - Validate required variables on startup - - **Dependencies**: None + - **Dependencies**: None ✅ - **Risk**: LOW 🔒 - - **Validation**: Missing variables cause clear errors - - **Rollback**: Remove validation + - **Validation**: ✅ Environment variable validation already implemented: + - Uses Zod schema (`envSchema`) to validate all environment variables + - Validates URL format (absolute URLs or paths starting with /) + - Provides default values for all variables + - Throws clear error messages with detailed validation errors + - Logs validation errors using logger + - All variables are validated on module load (startup) + - **Result**: Complete environment variable validation with clear error messages + - **Rollback**: N/A (already implemented) ### Implicit Task 10: Update Git Hooks - [ ] **Implicit 10.1**: Add pre-commit hook for type checking