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
This commit is contained in:
parent
60a232157e
commit
9a0e1c4680
2 changed files with 27 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue