2.0 KiB
2.0 KiB
AGENTS.md
Build, Lint, and Test Commands
Build Commands
npm run build- Build the application for productionnpm run dev- Start development server with hot reloadingnpm run preview- Preview the production build
Lint Commands
npm run lint- Run ESLint on the entire codebasenpm run lint -- --fix- Run ESLint with auto-fix capabilities
Test Commands
- No test framework configured yet
- For running individual tests, add a test runner like Vitest or Jest
- Example with Vitest:
npm run test -- --run --reporter=verbose
Code Style Guidelines
Imports
- Use ES6 module syntax:
import { foo } from 'bar' - Group imports: standard library, external dependencies, internal modules
- Avoid wildcard imports:
import * as React from 'react' - Use named imports for better tree-shaking
Formatting
- Use Prettier for code formatting (configured via .prettierrc)
- 2-space indentation
- No semicolons
- Arrow functions for component methods
- Type annotations for all props and state
Types
- TypeScript strict mode enabled
- Use interfaces for component props and state shapes
- Use type aliases for primitive types
- Use
Partial<T>for optional updates - Use
Record<string, unknown>for generic object types
Naming Conventions
- PascalCase for components and interfaces
- camelCase for variables and functions
- UPPER_CASE for constants
use*prefix for custom hooksis*,has*,should*for boolean values
Error Handling
- Use try/catch blocks for async operations
- Handle errors gracefully in API calls with meaningful error messages
- Localized error states in components
- Use custom error boundaries for React components
- Log errors to console in development only
React Specific
- Use functional components with hooks
- Prefer hooks over class components
- Use useCallback and useMemo for performance optimization
- Use StrictMode for development
- Component composition over inheritance
- Proper cleanup in useEffect hooks