chore: codify React component style

This commit is contained in:
2026-08-25 15:33:20 +03:00
parent 268acdf2e1
commit d10e1dd182
65 changed files with 711 additions and 365 deletions
+18
View File
@@ -11,6 +11,24 @@
- Зависимости используют exact versions; не добавлять semver ranges.
- Полный локальный gate: `npm run verify`. Pre-commit запускает staged formatting, OpenAPI check и FSD dependency checks; commit message должен следовать Conventional Commits.
## React component style
Biome-enforced guardrails:
- Named React components объявлять как const-valued components, а не function declarations.
- Не использовать default exports.
- Export statements держать после declarations тела module.
Mandatory review conventions:
- React components типизировать через `FC`: `const Component: FC<Props> = (props) => { ... }`; если props нет — `const Component: FC = () => { ... }`.
- Props описывать named type рядом с component либо в `Component.types.ts`, если type переиспользуется или file становится крупным.
- Не использовать inline props typing в component parameters.
- Для components только с `children` использовать `FC<PropsWithChildren>` без отдельного props alias. Если кроме `children` есть другие props, использовать named props type на основе `PropsWithChildren<{ ... }>`.
- Не destructure props в component parameters; принимать `props` и destructure внутри component body.
- Обычный module export surface сводить к одному нижнему named export block, когда это выражается читаемо без потери public API.
- Чистые barrel files должны использовать прямой re-export без промежуточного import: `export { Component } from "./Component";`.
## File roles
- `Component.tsx` - контейнер или публичный компонент; для data-driven pages вызывает page VM hook и выбирает top-level state view.