Skip to content

chore(code-health): eliminate React Doctor exceptions from doctor.config.ts #147

Description

@masch

Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened

Problem Description

apps/mobile/doctor.config.ts currently has ~40 rule exceptions across 4 files — the core screens of the app:

  • experiences.tsx
  • explore.tsx
  • track-detail-view.tsx
  • track-map.tsx

These aren't false positives. They're documented technical debt masking 5 structural anti-patterns:

Exempted Rule What It Masks
set-state-in-effect Data fetching lives in useEffect instead of a custom hook
prefer-useReducer Multiple independent useState calls that should be a reducer
no-initialize-state State initialized from props without key sync
no-giant-component These screens are too large
react-compiler React Compiler can't optimize these components

Proposed Solution

Refactor each screen to eliminate the exceptions systematically:

  1. Extract data fetching — Move useEffect fetch patterns into a custom hook (e.g., useExperiences, useTrack). This kills set-state-in-effect.
  2. Group state into reducers — Replace multiple useState combos with useReducer. This kills prefer-useReducer and no-initialize-state.
  3. Split giant components — Break each screen into smaller, focused sub-components. This kills no-giant-component.
  4. React Compiler auto-fixes — Steps 1-2-3 naturally unblock the compiler.

Affected Area

Code quality / linting

Alternatives Considered

Keeping the exceptions indefinitely — but they're a growing source of false negatives and block React Compiler adoption.

Additional Context

File with all exceptions: apps/mobile/doctor.config.ts

The react-compiler exception is partially justified by try/finally in async data functions (a known compiler limitation), but the other 3 rules have no technical blocker — they need refactoring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions