mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-07-31 04:01:24 +08:00
2.0 KiB
2.0 KiB
AI Rule: Build Validation
Build validation for successful deployments with minimal friction.
Targets
force-app/main/default/webapplications/*/**/***/*.{js,ts,jsx,tsx}
MANDATORY: Build Success
Before completing any coding session (from the web app directory force-app/main/default/webapplications/<appName>/):
npm run build # MUST succeed with no errors
Quick Quality Checks
Run from the web app directory (force-app/main/default/webapplications/<appName>/):
npm run lint # ESLint; fix issues before completing
npm run build # Runs tsc -b && vite build; catches TypeScript and build issues
Requirements
Must Pass:
npm run buildcompletes successfully- No TypeScript compilation errors
- No critical ESLint errors
Can Be Warnings:
- ESLint warnings
- Minor TypeScript warnings
Fix Commands (when available in the web app's package.json)
npm run lint # Run ESLint (always available)
# If your project adds Prettier/format scripts, use those before completing
Workflow
During Development:
- Write code with AI assistance
- Save frequently (auto-format on save)
- Check periodically:
npm run lint(optional)
Before Completion:
- Run
npm run buildfrom the web app directory - If it fails: fix TypeScript/ESLint errors (run
npm run lint), then retry build
Error Priority
Fix Immediately:
- TypeScript compilation errors
- Import/export errors
- Syntax errors
Fix When Convenient:
- ESLint warnings
- Unused variables
Hard Requirements
- Build must complete without errors
- No broken imports
- Basic TypeScript type safety
Key Commands (web app directory)
npm run dev # Start development server (vite)
npm run build # TypeScript + Vite build; check deployment readiness
npm run lint # Run ESLint
Troubleshooting Import Errors
npm install # Check missing dependencies
# Verify file exists, case sensitivity, export/import match