[CL-REACT-DOCTOR] fix(app): 16 react-doctor errors #101

Merged
andrei merged 3 commits from feature/claude-react-doctor-fixes-20260521 into master 2026-05-21 05:00:54 +00:00
Owner

Что сделано

Закрыто 16 errors из react-doctor scan на app/src:

  • 8× no-mutable-in-deps: replaced location.pathname в useEffect deps на стабильные деривативы (location object или extracted const)
  • 6× effect-needs-cleanup: добавлены cleanup returns для setTimeout / setInterval / .on() subscribes
  • 3× no-nested-component-definition: SectionHeader / Row / SortBtn hoisted на module scope с explicit props

Затронуто 13 файлов в app/src/: App.tsx, layout/, shared/, hooks/, pages/, portfolio/income/, admin/create-object/, cabinet/sponsor/*.

Зачем

react-doctor (npm react-doctor@0.2.1) — quality checker для AI-generated React. Trial scan 2026-05-21 на europatech/app выявил 17 errors + 2130 warnings (score 57/100). Эти 16 errors (один дубликат) — real bugs:

  • location-in-deps: silent stale deps, useEffect не реагирует на route change
  • missing cleanup: memory leaks при re-run и unmount
  • nested component def: re-instantiates каждый render, теряется state

План тестирования

  • react-doctor re-scan: errorCount 17 → 0 (verified локально)
  • Warnings 2130 → 2131 (один косметический side-effect)
  • TSC: запустить pnpm tsc --noEmit после CI runs pnpm install
  • Smoke test: pnpm dev:app + manual click через login → cabinet → admin panels
  • Unit/E2E: existing test suite — fixes additive, не должны ломать

Где могу ошибаться

  • location-in-deps fix: использован [location] (whole object) — может вызвать лишние re-renders если location.state часто меняется. Альтернатива: [location.key] (react-router stable id).
  • usePropertyFeedSocket: socket.off() с named handlers — assumes socket.io API. Если используется другой transport, cleanup может не подключиться.
  • Hoisted components получили explicit props — все call sites обновлены, но проверить runtime warnings про missing key prop.
  • TSC clean не verified локально из-за свежего worktree без node_modules (теперь установлены, но full check не запускался). CI должен поймать.

Артефакты

  • Full JSON report: D:/AI-Memory/stores/claude-project-memory/spike-data/react-doctor-europatech-app-20260521.json (2.1 MB, 2147 diagnostics)
  • Trial doc: D:/AI-Memory/stores/claude-project-memory/reference_trial_react_doctor_20260520.md (ADOPT verdict)

Next steps (после merge)

  1. Wire npx react-doctor --diff origin/master --fail-on error в .forgejo/workflows/react-doctor.yml — block PRs with new errors
  2. Phase 2: refactor top-10 files by warning count (4-6h)
  3. Phase 3 (optional): Tailwind codemod sweep для 1100+ design warnings
## Что сделано Закрыто 16 errors из `react-doctor` scan на `app/src`: - **8× no-mutable-in-deps**: replaced `location.pathname` в useEffect deps на стабильные деривативы (location object или extracted const) - **6× effect-needs-cleanup**: добавлены cleanup returns для `setTimeout` / `setInterval` / `.on()` subscribes - **3× no-nested-component-definition**: `SectionHeader` / `Row` / `SortBtn` hoisted на module scope с explicit props Затронуто **13 файлов** в `app/src/`: App.tsx, layout/*, shared/*, hooks/*, pages/*, portfolio/income/*, admin/create-object/*, cabinet/sponsor/*. ## Зачем [react-doctor](https://github.com/millionco/react-doctor) (npm `react-doctor@0.2.1`) — quality checker для AI-generated React. Trial scan 2026-05-21 на `europatech/app` выявил **17 errors + 2130 warnings** (score 57/100). Эти 16 errors (один дубликат) — real bugs: - `location-in-deps`: silent stale deps, useEffect не реагирует на route change - `missing cleanup`: memory leaks при re-run и unmount - `nested component def`: re-instantiates каждый render, теряется state ## План тестирования - ✅ react-doctor re-scan: errorCount **17 → 0** (verified локально) - Warnings 2130 → 2131 (один косметический side-effect) - ⏳ TSC: запустить `pnpm tsc --noEmit` после CI runs `pnpm install` - ⏳ Smoke test: `pnpm dev:app` + manual click через login → cabinet → admin panels - ⏳ Unit/E2E: existing test suite — fixes additive, не должны ломать ## Где могу ошибаться - **location-in-deps fix**: использован `[location]` (whole object) — может вызвать лишние re-renders если `location.state` часто меняется. Альтернатива: `[location.key]` (react-router stable id). - **usePropertyFeedSocket**: `socket.off()` с named handlers — assumes socket.io API. Если используется другой transport, cleanup может не подключиться. - **Hoisted components** получили explicit props — все call sites обновлены, но проверить runtime warnings про missing `key` prop. - **TSC clean** не verified локально из-за свежего worktree без `node_modules` (теперь установлены, но full check не запускался). CI должен поймать. ## Артефакты - Full JSON report: `D:/AI-Memory/stores/claude-project-memory/spike-data/react-doctor-europatech-app-20260521.json` (2.1 MB, 2147 diagnostics) - Trial doc: `D:/AI-Memory/stores/claude-project-memory/reference_trial_react_doctor_20260520.md` (ADOPT verdict) ## Next steps (после merge) 1. Wire `npx react-doctor --diff origin/master --fail-on error` в `.forgejo/workflows/react-doctor.yml` — block PRs with new errors 2. Phase 2: refactor top-10 files by warning count (4-6h) 3. Phase 3 (optional): Tailwind codemod sweep для 1100+ design warnings
CEO complaint: "документация в обсидиан загружена новая?". Vault не был
синхронизирован после 4 PR (#72/73/74/75). Эта правка:

## Что сделано

### Cross-references на canonical docs (вне vault)
Добавлен блок с ссылками на новые docs:
- `README.md`, `docs/{ARCHITECTURE,CONFIGURATION,GETTING-STARTED,DEVELOPMENT,TESTING,API,DEPLOYMENT}.md`

### Обновлены метрики (Last updated: 2026-05-19)
- API endpoints: 784+ (123 → 128 route файлов)
- Prisma models: 153+95 → 164+99 (13 split schema файлов)
- Services: 672 → 255 модуля
- Middleware: 26 → 30
- Cron jobs: 71 → 76 файлов + 12 BullMQ workers (было +)
- Языки i18n: 13 → 14 (добавлен tr)
- Frontend pages: 398 → 525
- Frontend components: 247 → 264
- Rate limiters: 17 → 27 Redis-backed
- Migrations: 175 → 193

### Стек технологий
- Backend: Prisma 6 → 7
- Frontend: Vite 7 → 8
- i18n: 13 → 14 языков

### Структура монорепо (annotated tree)
- api/: Prisma 7, 128 routes, 255 services, 30 middleware, 76 cron, 52 lib, 32 schemas
- prisma/: 13 split схем (164 моделей, 99 enums), 193 миграций
- app/: Vite 8, 525 pages, 264 components, 14 langs
- tg/: 11 pages, 10 components

## Зачем

Obsidian vault (docs.europa-tech.org) серверу был stale — не отражал
изменения после iter 2 fix loop (Prisma 7, Vite 8, etc) и не содержал
ссылок на новые canonical docs. CEO потребовал «новую docs в обсидиан».

## План тестирования

- [x] Все обновлённые метрики верифицированы через grep/ls на codebase
- [x] Cross-references работают (canonical docs в `../<name>.md` relative path)
- [x] Husky pre-push готов

🤖 Generated with Claude Code via /gsd-docs-update (vault sync)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[CL-DOCS-UPDATE] docs(vault): sync ports + frontend nav counts в 00-INDEX
Some checks failed
CI / App (pull_request) Has been cancelled
CI / API (pull_request) Has been cancelled
CI / Prisma Migrate Gate (pull_request) Has been cancelled
CI / Telegram Mini App (pull_request) Has been cancelled
CI / Contracts (pull_request) Has been cancelled
CI / Python SDK (pull_request) Has been cancelled
CI / Secrets Scan (pull_request) Has been cancelled
e888bec982
Дополнительные правки в vault/00-INDEX.md, пропущенные initial vault-sync commit:

- L95-96: ports `3007/5175` → `3001/5173` в Dev URL таблице
- L128: frontend nav reference `(398 pages, 247 components)` → `(525 pages, 264 components)`

🤖 Generated with Claude Code via /gsd-docs-update (vault sync batch 2)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
[CL-REACT-DOCTOR] fix(app): 16 react-doctor errors (location-in-deps + effect-cleanup + nested-component)
Some checks failed
CI / API (pull_request) Has been cancelled
CI / App (pull_request) Has been cancelled
CI / Prisma Migrate Gate (pull_request) Has been cancelled
CI / Telegram Mini App (pull_request) Has been cancelled
CI / Python SDK (pull_request) Has been cancelled
CI / Contracts (pull_request) Has been cancelled
CI / Secrets Scan (pull_request) Has been cancelled
32239d08ca
## Что сделано

Закрыто 16 errors из react-doctor scan на app/src:
- **8× no-mutable-in-deps**: replaced location.pathname в useEffect deps на стабильные деривативы (location object или extracted const)
- **6× effect-needs-cleanup**: добавлены cleanup returns для setTimeout/setInterval/.on() subscribes
- **3× no-nested-component-definition**: SectionHeader/Row/SortBtn hoisted на module scope с explicit props

Затронуто 13 файлов в app/src/ (App.tsx, layout/*, shared/*, hooks/*, pages/*, portfolio/income/*, admin/create-object/*, cabinet/sponsor/*).

## Зачем

react-doctor (npm @millionco/react-doctor) — quality checker для AI-generated React.
Trial scan 2026-05-21 на europatech/app выявил 17 errors + 2130 warnings.
Эти 16 (один дубликат) — real bugs:
- location-in-deps: silent stale deps, useEffect не реагирует
- missing cleanup: memory leaks при re-run и unmount
- nested component def: re-instantiates каждый render, теряется state

## План тестирования

-  react-doctor re-scan: errorCount 17 → 0 (verified)
- Warnings 2130 → 2131 (один косметический side-effect)
- TSC: не запускался — node_modules отсутствует в worktree (pre-existing infra)
- Smoke test (manual): pnpm install && pnpm tsc --noEmit && pnpm test

## Где могу ошибаться

- location-in-deps fix: использован `[location]` (whole object) — может вызвать лишние re-renders если location.state часто меняется. Альтернатива: `[location.key]` (react-router stable id).
- usePropertyFeedSocket: socket.off() с named handlers — assumes socket.io API. Если используется другой transport, cleanup может не подключиться.
- Hoisted components получили explicit props — все call sites обновлены, но проверить runtime warnings про missing keys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
andrei merged commit 0ce1ce8597 into master 2026-05-21 05:00:54 +00:00
andrei referenced this pull request from a commit 2026-05-21 05:00:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
europa-tech-srl/europatech!101
No description provided.