docs: add React component style change

This commit is contained in:
2026-08-25 15:33:29 +03:00
parent 6e2890f86f
commit 18a9487432
6 changed files with 440 additions and 0 deletions
@@ -0,0 +1,26 @@
## 1. Tooling Guardrail
- [x] 1.1 Настроить frontend Biome rules для enforceable subset component style: const-valued named React components, no default exports и exports после declarations тела module. Verification: `npm run lint` сообщает настроенные rules и падает на representative local violations.
- [x] 1.2 Доказать новый hard guardrail одним compliant fixture или временным authored source sample и representative failing samples для запрещённой component declaration, default export и export ordering. Verification: записать exact Biome commands и observed pass/fail behavior в implementation summary перед archive.
## 2. Frontend Conventions
- [x] 2.1 Обновить frontend-local conventions и описать полный React component style: `FC` typing, named props types только когда они несут real props shape, no inline props typing, props destructuring внутри component body, один нижний named export block для обычных modules и прямые re-exports для чистых barrels. Verification: `frontend/docs/CONVENTIONS.md` явно разделяет Biome-enforced guardrails и mandatory review conventions.
- [x] 2.2 При необходимости обновить frontend routing guidance для AI agents, чтобы будущие frontend edits находили component style convention до implementation. Verification: affected local guidance указывает на documented convention без дублирования product architecture.
## 3. Source Migration
- [x] 3.1 Мигрировать authored production React components в `frontend/src` на const-valued `FC` component declarations без изменения JSX, hook order, route behavior, state selection, localized text keys или API calls. Verification: TypeScript и existing frontend tests проходят после migration.
- [x] 3.2 Заменить inline props typing в authored React components на named props types, использовать `FC<PropsWithChildren>` без alias для children-only components, использовать `PropsWithChildren<{ ... }>` для components с `children` и дополнительными props и не создавать empty props type для components без props. Verification: review migrated source на documented convention и запуск `npm run typecheck`.
- [x] 3.3 Перенести React component props destructuring из function parameters в component bodies. Verification: review migrated source на documented convention и запуск `npm run typecheck`.
- [x] 3.4 Свести обычные authored module exports к одному нижнему named export block, а чистые barrels — к прямым re-exports с сохранением public APIs и import paths. Verification: `npm run lint`, `npm run knip` и `npm run deps` проходят.
- [x] 3.5 Оставить generated OpenAPI source вне manual style migration. Verification: generated files остаются owned by existing OpenAPI workflow и не редактируются руками ради component style.
## 4. Verification
- [x] 4.1 Запустить targeted frontend checks после migration. Verification: `npm run lint`, `npm run typecheck`, `npm run test:coverage`, `npm run knip`, `npm run deps` и `npm run build` проходят из `frontend`.
- [x] 4.2 Запустить frontend canonical gate. Verification: `npm run verify` проходит из `frontend` под Node 22.
- [x] 4.3 Проверить OpenSpec change структурно. Verification: `openspec validate codify-frontend-component-style --type change --strict --store wealth-ledger-specs` проходит из `specs`.
- [x] 4.4 Выполнить semantic verification против Proposal, Delta Spec, Design и Tasks. Verification: implementation summary подтверждает, что user-visible behavior, routes, localization, API contract, backend behavior, generated API source ownership и product documentation не изменились вне approved scope.
- [x] 4.5 Выполнить independent read-only review перед archive. Verification: review не содержит Critical или Important findings.
- [x] 4.6 Запустить workspace change dispatcher после завершения affected tasks. Verification: `bash specs/scripts/verify-workspace-change.sh codify-frontend-component-style` проходит из workspace root.