1.1 KiB
1.1 KiB
Coding Standards
Core Standards
- Languages & Runtimes: TypeScript 5.9.2, Node.js 20.x LTS
- Style & Linting: ESLint with Next.js recommended rules, Prettier for formatting
- Test Organization: Co-located tests with component files (Component.test.tsx)
Critical Rules
- Never use console.log in production code - use proper logging
- All database queries must use Prisma client - no direct SQL
- API responses must follow Next.js patterns - no custom response formats
- All external inputs must be validated - use Zod schemas
- Authentication checks required - use session validation middleware
- Image optimization mandatory - use Next.js Image component
- Accessibility compliance - follow WCAG 2.1 AA guidelines
Language-Specific Guidelines
TypeScript Specifics
- Strict Mode: Enable strict TypeScript compiler options
- Type Safety: Prefer types over interfaces for internal types
- Null Handling: Use optional chaining and nullish coalescing
- Async/Await: Always handle promise rejections appropriately