auto-claude: subtask-1-2 - Document code style conventions and linting
This commit is contained in:
@@ -217,6 +217,69 @@ Ensure the build completes without errors before submitting.
|
||||
|
||||
## Code Style & Standards
|
||||
|
||||
### ESLint & Code Linting
|
||||
|
||||
This project uses ESLint to enforce code quality and consistency. The configuration extends Next.js recommended presets:
|
||||
|
||||
**ESLint Configuration** (`.eslintrc.json`):
|
||||
```json
|
||||
{
|
||||
"extends": [
|
||||
"next/core-web-vitals",
|
||||
"next/typescript"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Key ESLint Rules:**
|
||||
- `next/core-web-vitals` - Enforces Next.js best practices and Core Web Vitals optimizations
|
||||
- `next/typescript` - TypeScript-specific rules for Next.js applications
|
||||
|
||||
**Running the Linter:**
|
||||
```bash
|
||||
# Run ESLint in strict mode (recommended before committing)
|
||||
npm run lint
|
||||
|
||||
# The linter will check for:
|
||||
# - Code quality issues
|
||||
# - Next.js best practices violations
|
||||
# - TypeScript type errors
|
||||
# - Unused variables and imports
|
||||
# - Accessibility issues
|
||||
```
|
||||
|
||||
**Important:**
|
||||
- Always run `npm run lint` before committing changes
|
||||
- Fix all linting errors - the project uses `--strict` mode
|
||||
- The linter runs automatically during the build process
|
||||
- ESLint errors will prevent successful production builds
|
||||
|
||||
### Code Formatting
|
||||
|
||||
**General Formatting Guidelines:**
|
||||
- **Indentation:** 2 spaces (no tabs)
|
||||
- **Line Length:** Aim for 80-100 characters, hard limit at 120
|
||||
- **Semicolons:** Required at the end of statements
|
||||
- **Quotes:** Single quotes for strings (except in JSX/TSX where double quotes are preferred)
|
||||
- **Trailing Commas:** Use trailing commas in multi-line objects and arrays
|
||||
|
||||
**Example:**
|
||||
```typescript
|
||||
// ✅ Good
|
||||
const user = {
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
role: 'admin',
|
||||
};
|
||||
|
||||
// ❌ Bad
|
||||
const user = {
|
||||
name: "John Doe",
|
||||
email: "john@example.com",
|
||||
role: "admin"
|
||||
}
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
- Use TypeScript for all new files
|
||||
- Define proper types and interfaces
|
||||
|
||||
Reference in New Issue
Block a user