Sergey Krylov 1774c7ffd6
Some checks failed
CI / ci (pull_request) Failing after 2m32s
CI / ci (push) Failing after 2m17s
refactor(frontend): bring FSD architecture into compliance
- Remove cross-entity import (broker-position -> broker-operation)
- Extract duplicated formatters to shared/lib/formatters.ts
- Flatten shared/ui/broker-allocation-bar nesting
- Clean up entities/stock/index.ts public API

All 111 tests pass, build clean.
2026-06-20 22:43:44 +03:00

1.8 KiB
Raw Permalink Blame History

FSD Quick Fix — Plan

Архитектурные решения

  1. Все форматтеры переносятся в shared/lib/formatters.ts. Каноничные реализации берутся из entities/broker-account/model/brokerAccountsOverview.ts. Исходные функции в brokerAccountsOverview становятся тонкими врапперами (re-export), чтобы не менять контракт entity.
  2. Cross-entity импорт удаляется полностью — символы broker-operation никто не импортирует через broker-position, реэкспорты мёртвые.
  3. Stock API-функции убираются из barrel — используются только внутри entity хуками.
  4. shared/ui/broker-allocation-bar уплощается: компонент поднимается на уровень slice.

Порядок выполнения

Task 1: Убрать cross-entity import

  • broker-position/model/brokerDisplay.ts — удалить re-export строки
  • broker-position/index.ts — удалить соответствующие экспорты

Task 2: Дедуплицировать форматтеры

  • Создать shared/lib/formatters.ts
  • Переделать brokerAccountsOverview.ts на импорт из shared
  • Заменить дубликаты во всех консьюмерах

Task 3: Уплостить shared/ui/broker-allocation-bar

  • Переместить BrokerAllocationBar.tsx на уровень выше
  • Обновить index.ts
  • Удалить ui/

Task 4: Очистить entities/stock/index.ts

  • Убрать getShare, getShareMarketData и т.д. из barrel

Проверка

  • npm run lint (frontend)
  • npm run build (frontend)
  • npm run test (frontend)