Skip to content

chore: delete 23 unused shadcn/ui components and 17 orphaned deps - #34

Merged
Programcode merged 1 commit into
mainfrom
chore/remove-dead-ui-components
Sep 7, 2026
Merged

Programcode merged 1 commit into
mainfrom
chore/remove-dead-ui-components

Conversation

@Programcode

@Programcode Programcode commented Sep 6, 2026 •

Copy link
Copy Markdown
Owner

First of five PRs from a whole-repo over-engineering audit. Scope is dead code only: no behavior change, no correctness or security work.

What this removes

23 shadcn/ui components with no importer outside src/components/ui, and the 17 dependencies only those components used.

Two components had an inbound reference, and each traces back to something also dead:

  • toggle.tsx was imported only by toggle-group.tsx, itself unused
  • skeleton.tsx was imported only by sidebar.tsx (unused) and by a one-assertion render test in ui.test.tsx

The other 21 had no importer at all. There is no src/components/ui barrel file. On dynamic reachability I grepped for import( rather than only lazy(), since a bare await import(...) or a string-built specifier would not show up in a lazy() enumeration: every dynamic import in the codebase is an explicit page import in src/App.tsx or src/offline-route-preload.ts.

Deps removed: 11 @radix-ui/* packages (aspect-ratio, avatar, collapsible, context-menu, dropdown-menu, hover-card, menubar, navigation-menu, radio-group, toggle, toggle-group) plus react-day-picker, embla-carousel-react, cmdk, vaul, input-otp, react-resizable-panels.

recharts stays. AdminPage.tsx and SparringScorecard.tsx import it directly. Only the shadcn chart.tsx wrapper around it was dead. @radix-ui/react-collapsible correctly remains in the lockfile as a transitive of the retained @radix-ui/react-accordion.

Orphans cleaned up

Everything the deletion orphaned goes with it:

  • the Skeleton describe block and import in src/test/components/ui.test.tsx
  • src/hooks/use-mobile.tsx — on main, its only importer was sidebar.tsx, so deleting the sidebar orphaned the hook
  • the sidebar color scale in tailwind.config.ts and all 18 --sidebar-* custom properties in src/index.css — sidebar.tsx referenced these 32 times and nothing else uses them. git grep -nE "(bg|text|border|ring|from|to)-sidebar" -- src e2e public returns zero matches, and there are no var(--sidebar…) usages in CSS either
  • the [cmdk-input]:focus selector in src/index.css, which can no longer match anything
  • the @radix-ui/react-dropdown-menu entry in the vendor-radix manual chunk in vite.config.ts, which would otherwise name an uninstalled package
  • the use-mobile.tsx line in the README project-structure tree

Noted, deliberately not removed

--chart-1 through --chart-5 in src/index.css are also unused: there is no chart color scale in tailwind.config.ts and no var(--chart-N) reference anywhere. But the deleted chart.tsx never referenced them either (shadcn's chart component generates its own CSS vars from a config object), so these were already dead on main rather than orphaned by this PR. Flagging them instead of expanding scope into pre-existing dead code.

Verification

Full credential-free ladder on Node 22 from a clean npm ci, based on current main (c7d3437):

check result
npm run lint pass
npm run typecheck pass
npm test -- --coverage 95 files, 924 tests pass, coverage 90.45% stmts
npm run test:edge 121 pass
npm run build pass
npm run test:e2e 126 pass (desktop + mobile Chromium)

Test count is 924 against main's 925: the one removed test rendered the deleted Skeleton. Coverage thresholds are unaffected because vitest.config.ts restricts the coverage scope to a named list of runtime modules and never included src/components/ui.

Not run: the Docker-backed DB gate and WebKit smoke. No migrations or Edge Function changes here, and no rendering-engine-specific code.

Note for reviewers

If any of these components is wanted later, npx shadcn@latest add <name> regenerates it, which is what components.json is for. That is why deleting them now is cheap rather than lossy. Re-adding sidebar would also re-add its design tokens.

Summary by CodeRabbit

  • Chores
    • Removed numerous unused UI components and their related styling, including navigation, menus, charts, carousels, drawers, sidebars, tables, pagination, and other controls.
    • Removed unused responsive utilities, theme tokens, and package dependencies.
  • Tests
    • Removed tests for the retired loading-skeleton component.
  • Verification
    • Added documentation checks to the verification workflow to help ensure project documentation remains current.

@vercel

vercel Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Sep 6, 2026 8:31pm UTC

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: f3c84e99-c916-4208-8984-80083b48e1a7

📥 Commits

Reviewing files that changed from the base of the PR and between 2dd694e and 6447087.

📒 Files selected for processing (1)
  • package.json

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change removes unused UI components, hooks, dependencies, theme tokens, build entries, and Skeleton test coverage. It also adds documentation checks to the verification script.

Changes

UI Cleanup

Layer / File(s) Summary
Remove unused UI modules and dependencies
src/components/ui/*, src/hooks/use-mobile.tsx, package.json
Unused UI wrappers, the mobile hook, and their Radix, command, carousel, OTP, calendar, resizable-panel, and drawer dependencies are removed.
Clean theme and build configuration
src/index.css, tailwind.config.ts, vite.config.ts
Unused sidebar theme tokens, command-input focus styling, and the dropdown-menu vendor chunk entry are removed.
Align verification and tests
package.json, src/test/components/ui.test.tsx
The docs:check script is added to verify. Skeleton imports and tests are removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode

Copy link
Copy Markdown
Owner Author

Interim independent review while CodeRabbit is rate limited (Free plan allows 1 review/hour).

Reviewer: Claude Opus 4.5, run locally against git diff origin/main..origin/<branch> with a deletion-safety and claim-accuracy brief. Full output:

BLOCKERS: none

SHOULD-FIX: none

NITS:
1. The commit message says "17 orphaned deps" but the PR description says "17 dependencies only those components used." Counting the removals in package.json: `@radix-ui/react-aspect-ratio`, `@radix-ui/react-avatar`, `@radix-ui/react-collapsible`, `@radix-ui/react-context-menu`, `@radix-ui/react-dropdown-menu`, `@radix-ui/react-hover-card`, `@radix-ui/react-menubar`, `@radix-ui/react-navigation-menu`, `@radix-ui/react-radio-group`, `@radix-ui/react-toggle`, `@radix-ui/react-toggle-group` (11 Radix packages) plus `react-day-picker`, `embla-carousel-react`, `cmdk`, `vaul`, `input-otp`, `react-resizable-panels` (6 others) = 17 total. Count is correct.

VERDICT: Approve. Deletions are safe—no barrel re-export exists, lazy() imports are explicitly enumerated in App.tsx/offline-route-preload.ts and don't reference these components, the vite manual chunk cleanup matches the dep removal, CSS selector removal matches the deleted cmdk component, and the test reduction is correctly scoped to the deleted Skeleton. Claims match the diff.

CodeRabbit will still review this PR when its hourly window resets; this does not replace it.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Programcode added a commit that referenced this pull request Sep 6, 2026
… globs

Dependencies with zero imports anywhere in src, e2e, scripts, supabase, or
any config file:

- @stripe/stripe-js: checkout and portal go through the create-checkout and
  create-portal Edge Functions and a plain URL redirect (src/lib/stripe.ts).
  The browser SDK is never loaded.
- i18next-browser-languagedetector: src/i18n.ts sets lng and fallbackLng
  explicitly and SettingsPage calls changeLanguage. No detector is registered.
- @types/jspdf and @types/react-joyride: both runtime packages ship their own
  declarations, so the DefinitelyTyped stubs are redundant.
- baseline-browser-mapping and caniuse-lite: incidentally added as direct
  dependencies, never imported. Both stay installed transitively through
  autoprefixer/browserslist, which is the only consumer. npm now records them
  as dev-only, since browserslist is a devDependency; that is safe here because
  every install path in this repo (Dockerfile, all three workflow jobs, Vercel)
  runs a plain `npm ci` with devDependencies included. No path uses
  --omit=dev or --production.

@types/file-saver stays: file-saver ships no declarations of its own.

Also removes two npm scripts and three dead Tailwind content globs:

- test:coverage, superseded by `npm test -- --coverage`. No workflow, script,
  or docs file invokes it. Two rows in .audit/crossfire.tsv do mention it, but
  those are historical records of August runs, not callers, and that log is
  deliberately left untouched.
- test:e2e:ui, which nothing references at all.
- the ./pages, ./components, and ./app content globs, for directories that do
  not exist in this repo.

Verified after rebasing onto main c7d3437, from a clean npm ci: lint,
typecheck, 925 unit tests, 121 edge tests, build, and 126 Chromium e2e tests
pass. Coverage 90.45% statements. If #34 lands first, the lockfile needs a
rebase and these numbers need re-running against it.
@Programcode
Programcode force-pushed the chore/remove-dead-ui-components branch from 6abe86a to 2dd694e Compare September 6, 2026 17:22
@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode

Copy link
Copy Markdown
Owner Author

Independent review, second pass, model upgraded to Claude Opus 5 (the earlier comment on this PR used Opus 4.5). Run locally against git diff origin/main..origin/<branch> through cliproxyapi, briefed on deletion safety and claim accuracy.

Every should-fix finding below has been addressed in the current head. Full output:

BLOCKERS: none

SHOULD-FIX:
1. `src/hooks/use-mobile.ts` orphan. `sidebar.tsx` was the only importer of `useIsMobile` visible in this diff, and the hook isn't touched. If nothing else imports it, the PR's "removing the components left three loose ends, all fixed here" is wrong — there's a fourth. Confirm with a grep for `use-mobile`/`useIsMobile`; delete it or amend the claim.
2. Sidebar/input-otp design tokens. `sidebar.tsx` was the only consumer of `bg-sidebar`, `text-sidebar-foreground`, `border-sidebar-border`, `ring-sidebar-ring` (and the `--sidebar-*` custom properties shadcn writes into `index.css` + the `sidebar` color scale in `tailwind.config.ts`); `input-otp.tsx` was the only consumer of the `animate-caret-blink` keyframe. Neither `tailwind.config.ts` nor the token block in `index.css` appears in the diff. Same completeness problem as (1): either these tokens don't exist in the repo, or the "three loose ends" list is short. You removed `[cmdk-input]:focus` for exactly this reason, so the standard is already set — also check `index.css` for other `[cmdk-*]` selectors below line 640.

NITS:
1. Overstated evidence in the PR body: "no dynamic or string-built import reaches any of them" is supported only by an enumeration of `lazy()` call sites. `lazy()` isn't the only dynamic-import form; a bare `await import(...)` or a string-built specifier wouldn't be caught by that check. Say what you actually grepped for (`import(`, not just `lazy(`).
2. The lockfile prune looks correct and non-hand-edited: transitive-only `@radix-ui/react-menu` and `embla-carousel`/`embla-carousel-reactive-utils` are removed, while `@radix-ui/react-collapsible` is correctly retained as a transitive of `react-accordion`. No action.

Verified clean (one line each, no action):
- 23 deleted component files match the "23" in the title; 17 removed `package.json` entries match the 11 radix + 6 others enumerated in the body. Counts are accurate.
- `recharts` retention is correctly justified: only `chart.tsx` wrapped it, `date-fns` (react-day-picker's peer) is likewise retained.
- `vite.config.ts` `vendor-radix` is the only build-config reference to a removed package, and it's fixed. Nothing in nginx/vercel/SW precache/workflows/Capacitor can name a `src/components/ui` module.
- Intra-directory dangling imports: `toggle-group`→`toggle`, `sidebar`→`skeleton`, `command`→`dialog`, `calendar`/`pagination`→`buttonVariants`/`ButtonProps`, `carousel`→`Button` all resolve to either co-deleted files or retained ones.
- The Skeleton test was deleted with its subject (block + import), not weakened. Test-count claims are internally consistent (924 = 925 − 1), and the coverage-scope rationale holds since `src/components/ui` was never in the include list.

VERDICT: approve — no removal is reachable and no config is broken; the two should-fixes are dead-code leftovers that contradict the PR's completeness claim but cannot affect runtime.

None of these components were imported anywhere outside src/components/ui.
Two had an inbound reference, and both traced back to something also dead:

- toggle.tsx: only importer was toggle-group.tsx, itself unused
- skeleton.tsx: only importers were sidebar.tsx, itself unused, and a
  one-assertion render test in ui.test.tsx

The other 21 had no importer at all. Checked for dynamic reachability with
`import(` rather than only `lazy(`: every dynamic import in the codebase is
an explicit page import in App.tsx or offline-route-preload.ts.

Removed the dependencies that only these components used. recharts stays:
AdminPage and SparringScorecard use it directly, only the shadcn chart.tsx
wrapper around it was dead.

Also cleans up everything the deletion orphaned:

- the Skeleton test block and import in ui.test.tsx
- src/hooks/use-mobile.tsx, whose only importer on main was sidebar.tsx
- the sidebar color scale in tailwind.config.ts and all 18 --sidebar-*
  custom properties in index.css, which sidebar.tsx referenced 32 times and
  nothing else uses: there are no bg-/text-/border-/ring-sidebar utilities
  anywhere in src, e2e, or public
- the [cmdk-input] focus selector in index.css
- the @radix-ui/react-dropdown-menu entry in the vendor-radix manual chunk

Noted but deliberately not touched: --chart-1 through --chart-5 in index.css
are also unused, but chart.tsx never referenced them and there is no tailwind
chart scale, so they were already dead on main rather than orphaned here.

Verified on main fe679fd, from a clean npm ci: docs:check, lint, typecheck,
955 unit tests, 121 edge tests, build, and 126 Chromium e2e tests pass.
Selected coverage scope excludes src/components/ui, so thresholds are
unaffected.
@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode
Programcode merged commit dcf1d96 into main Sep 7, 2026
7 checks passed
@Programcode
Programcode deleted the chore/remove-dead-ui-components branch September 7, 2026 09:26

This branch was successfully deployed

1 active deployment
Preview — 6447087c Deployed Sep 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant