diff --git a/AGENTS.md b/AGENTS.md index 87b6838..bda9e80 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,6 +43,11 @@ FFmpeg is bundled with the backend via `ffmpeg-static` and `ffprobe-static` npm These rules are required for new code and for touched code when practical. +### TypeScript Strictness +- Frontend and backend active TypeScript source must stay strict-compatible. Do not weaken `strict` or related typecheck settings to make code pass. +- Use `npm run typecheck` in the relevant app after TypeScript changes. Frontend uses `frontend/tsconfig.json` with `strict: true`; backend uses `backend/tsconfig.json` for the migrated strict TypeScript/ESM scope. +- Prefer narrow domain types, local type guards, and validated boundary parsing over broad casts. Do not add new `any`, non-null assertions, `@ts-ignore`, or lint suppressions unless there is a specific documented interop reason. + ### Backend Boundaries - **Routes/controllers**: only authenticate, read runtime context, validate request input, call a service, and map the response. Do not put business logic in routes. - **Services/domain**: own business logic, transactions, permission decisions, and orchestration. diff --git a/documentation/project-improvement-todo.ru.md b/documentation/project-improvement-todo.ru.md index e9ade3d..ea3da94 100644 --- a/documentation/project-improvement-todo.ru.md +++ b/documentation/project-improvement-todo.ru.md @@ -31,22 +31,6 @@ Frontend: ## P1 - Frontend -### Frontend TypeScript strictness - -Цель: включить strict TypeScript как обязательный стандарт для frontend и закрыть legacy errors без сохранения JS/CommonJS как допустимого направления. Новый и изменённый код должен быть strict-compatible. - -Статус: выполнено 2026-07-06 для strict TypeScript baseline и frontend lint-warning cleanup. Первичный запуск `strict: true` давал 294 ошибки; после исправлений `frontend/tsconfig.json` использует общий `strict: true`, `npm run typecheck` проходит, `npm run lint` проходит без warnings, `npm run test` проходит (307 tests), `npm run test:e2e` проходит (10 tests), `npm run build` проходит. - -TODO: - -- [x] Посчитать текущий frontend typecheck baseline: сколько ошибок даёт `strict: true`. -- [x] Включать strictness по шагам: сначала отдельный strict config для selected folders/new code, затем общий `strict: true`, когда baseline закрыт. -- [x] Для новых/изменённых файлов запрещать новый `any` без явной причины через `@typescript-eslint/no-explicit-any` warning. -- [x] Вернуть guardrails для type assertions/casts (`as`, angle-bracket assertions, non-null `!`) как warnings. Исключения: validated external boundaries, DOM/library interop, discriminated unions после guard; исключение должно быть локальным и объяснённым. -- [x] Вернуть `no-unused-vars`/unused imports как warning и очистить текущие warnings. -- [x] Добавить frontend `typecheck` script и включить его в minimal checks, когда baseline проходит. -- [x] Вернуть `react-hooks/exhaustive-deps` как warning и очистить текущие hook dependency warnings. - ### Auth storage Сейчас token пишется и в `sessionStorage`, и в `localStorage`.