iter 2
This commit is contained in:
@@ -48,6 +48,7 @@ Next.js 16 App Router with Feature-Sliced Design. Strict unidirectional imports:
|
||||
## Component Convention
|
||||
|
||||
Generate new components with `bun run gc <layer> <Name>` — never create component files manually. Each component folder contains:
|
||||
|
||||
- `index.ts` — public re-export only
|
||||
- `ComponentName.tsx` — implementation
|
||||
- `ComponentName.module.scss` — scoped styles
|
||||
@@ -89,6 +90,7 @@ Use the shared `uploadFile` utility for any file upload — do not inline FormDa
|
||||
|
||||
```ts
|
||||
import { uploadFile } from "@shared/api/uploadFile"
|
||||
|
||||
const result = await uploadFile(file, "avatars")
|
||||
// result.file_url, result.file_path
|
||||
```
|
||||
@@ -102,8 +104,8 @@ Use `date-fns` with Russian locale for all date formatting — never use `moment
|
||||
```ts
|
||||
import { formatDate, formatRelativeTime } from "@shared/lib/dates"
|
||||
|
||||
formatDate(user.date_joined) // "21.02.2026"
|
||||
formatDate(date, "dd MMM yyyy") // "21 февр. 2026"
|
||||
formatDate(user.date_joined) // "21.02.2026"
|
||||
formatDate(date, "dd MMM yyyy") // "21 февр. 2026"
|
||||
formatRelativeTime(project.updated_at) // "2 дня назад"
|
||||
```
|
||||
|
||||
@@ -124,3 +126,12 @@ All user-facing UI text **must be in Russian** — labels, headings, buttons, pl
|
||||
- **`next/image` remote hosts**: External image hostnames must be listed in `next.config.mjs` `images.remotePatterns`. MinIO (`localhost:9000`) is already configured. If you add another storage backend, add its hostname there too.
|
||||
- **Stale OpenAPI types**: Always run `bun run gen:api-types` before implementing against the API if the backend has changed. Stale types cause silent 404s at runtime.
|
||||
- **Never use raw `fetch`/`useEffect` for API calls** — always use `api.useQuery()`/`api.useMutation()` from `@shared/api` (TanStack Query + openapi-fetch wrapper). For polling, use the `refetchInterval` option. Raw `fetch` bypasses typed routes, auth middleware, and query caching.
|
||||
|
||||
Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
|
||||
|
||||
## Testing Standards
|
||||
|
||||
- All E2E tests use Playwright with TypeScript
|
||||
- Test files live in tests/e2e/
|
||||
- Use `getByRole` as primary locator strategy
|
||||
- Every PR must include error-state tests, not just happy paths
|
||||
|
||||
Reference in New Issue
Block a user