whisper-money/resources/js/pages
Víctor Falcón 2a1286e98a
chore(frontend): add orphan component detection and remove dead components (#181)
## 🚪 Why?

### Problem

Dead frontend components were accumulating in the codebase with no
automated way to detect them. Unused code increases maintenance burden,
confuses contributors, and inflates bundle analysis noise. Additionally,
several React hooks had incorrect dependency arrays causing stale
closures or unnecessary re-renders, and an unused variable was left in
the new test file.

## 🔑 What?

### Changes

- Add `resources/js/lib/orphan-components.test.ts` — a Vitest test that
scans every file under `resources/js/components/` and fails if any
component is never imported anywhere in the codebase (supports `@/`
alias imports, relative imports, and barrel `index.*` re-exports)
- Delete 14 orphan components identified by the new test:
-
`accounts/import-balances/import-balance-step-{account,mapping,preview,upload}`
  - `app-mobile-nav`
  - `appearance-dropdown`
  - `dashboard/stat-card`
  - `landing/encryption-video-player`
  - `sync-status-button`
  - `transactions/date-header`
  - `ui/{icon,input-group,navigation-menu,placeholder-pattern}`
- Restore `ui/avatar.tsx` which was incorrectly included in the deletion
(it is imported via relative path in `user-info.tsx`)
- Fix ESLint warnings across 5 files:
- `orphan-components.test.ts` — remove unused `componentDir` variable in
`importStrings()`
- `transaction-list.tsx` — remove `categories`, `accounts`, `banks`,
`automationRules` from `useCallback` deps (none referenced in callback
body)
- `amount-input.tsx` — add missing `locale` dep to `useEffect` (used in
`formatCurrency`)
- `use-dashboard-data.ts` — wrap `fetchData` in `useCallback([locale])`
and add to `useEffect` deps to prevent stale closure on locale
- `dashboard.tsx` — wrap `netWorthEvolution` fallback in
`useMemo([props.netWorthEvolution])` to stabilise the reference passed
to the downstream `useMemo`

##  Verification

### Tests

The new test runs as part of `bun run test` (Vitest), already executed
in the `linter` CI job. All 48 tests pass:

```
✓ resources/js/lib/chart-calculations.test.ts (32 tests)
✓ resources/js/lib/file-parser.test.ts (15 tests)
✓ resources/js/lib/orphan-components.test.ts (1 test)
```

`bun run lint` and `bun run build` now exit clean.

Going forward, any new component added to `resources/js/components/`
that is not imported anywhere will fail CI automatically.
2026-03-02 12:43:27 +01:00
..
Accounts fix: Missing space between page sections and create button 2026-03-01 19:31:28 +00:00
auth feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
budgets fix: Missing space between page sections and create button 2026-03-01 19:31:28 +00:00
cashflow feat(cashflow): promote trend chart above money flow and increase height (#166) 2026-02-28 18:53:02 +00:00
onboarding Remove plaintext-transactions feature flag & E2E references (#116) 2026-02-13 11:10:21 +01:00
open-banking feat: Integrate EnableBanking as open banking provider (#106) 2026-02-12 09:09:28 +01:00
settings fix(i18n): localize billing settings page into Spanish (#176) 2026-03-01 18:43:09 +01:00
subscription feat(i18n): localize Spanish translations and currency formatting (#160) 2026-02-28 18:46:18 +00:00
transactions fix(transactions): fix toolbar overflow on mobile and shorten button label (#175) 2026-03-01 17:57:59 +00:00
dashboard.tsx chore(frontend): add orphan component detection and remove dead components (#181) 2026-03-02 12:43:27 +01:00
privacy.tsx Remove plaintext-transactions feature flag & E2E references (#116) 2026-02-13 11:10:21 +01:00
terms.tsx Replace E2E encryption mentions with privacy-first messaging (#124) 2026-02-14 16:59:50 +01:00
welcome.tsx chore: Welcome header text UI 2026-03-02 08:33:06 +00:00