Repository navigation
chore: delete 23 unused shadcn/ui components and 17 orphaned deps - #34
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change removes unused UI components, hooks, dependencies, theme tokens, build entries, and Skeleton test coverage. It also adds documentation checks to the verification script. ChangesUI Cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Note 🎁 Summarized by CodeRabbit FreeYour 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 |
babda50 to
b910cb0
Compare
|
@coderabbitai review |
|
b910cb0 to
6abe86a
Compare
|
Interim independent review while CodeRabbit is rate limited (Free plan allows 1 review/hour). Reviewer: Claude Opus 4.5, run locally against CodeRabbit will still review this PR when its hourly window resets; this does not replace it. |
|
@coderabbitai review |
|
… 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.
6abe86a to
2dd694e
Compare
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Independent review, second pass, model upgraded to Claude Opus 5 (the earlier comment on this PR used Opus 4.5). Run locally against Every should-fix finding below has been addressed in the current head. Full output: |
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.
2dd694e to
6447087
Compare
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
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.tsxwas imported only bytoggle-group.tsx, itself unusedskeleton.tsxwas imported only bysidebar.tsx(unused) and by a one-assertion render test inui.test.tsxThe other 21 had no importer at all. There is no
src/components/uibarrel file. On dynamic reachability I grepped forimport(rather than onlylazy(), since a bareawait import(...)or a string-built specifier would not show up in alazy()enumeration: every dynamic import in the codebase is an explicit page import insrc/App.tsxorsrc/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) plusreact-day-picker,embla-carousel-react,cmdk,vaul,input-otp,react-resizable-panels.rechartsstays.AdminPage.tsxandSparringScorecard.tsximport it directly. Only the shadcnchart.tsxwrapper around it was dead.@radix-ui/react-collapsiblecorrectly remains in the lockfile as a transitive of the retained@radix-ui/react-accordion.Orphans cleaned up
Everything the deletion orphaned goes with it:
Skeletondescribe block and import insrc/test/components/ui.test.tsxsrc/hooks/use-mobile.tsx— onmain, its only importer wassidebar.tsx, so deleting the sidebar orphaned the hooksidebarcolor scale intailwind.config.tsand all 18--sidebar-*custom properties insrc/index.css—sidebar.tsxreferenced these 32 times and nothing else uses them.git grep -nE "(bg|text|border|ring|from|to)-sidebar" -- src e2e publicreturns zero matches, and there are novar(--sidebar…)usages in CSS either[cmdk-input]:focusselector insrc/index.css, which can no longer match anything@radix-ui/react-dropdown-menuentry in thevendor-radixmanual chunk invite.config.ts, which would otherwise name an uninstalled packageuse-mobile.tsxline in the README project-structure treeNoted, deliberately not removed
--chart-1through--chart-5insrc/index.cssare also unused: there is nochartcolor scale intailwind.config.tsand novar(--chart-N)reference anywhere. But the deletedchart.tsxnever referenced them either (shadcn's chart component generates its own CSS vars from a config object), so these were already dead onmainrather 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 currentmain(c7d3437):npm run lintnpm run typechecknpm test -- --coveragenpm run test:edgenpm run buildnpm run test:e2eTest count is 924 against
main's 925: the one removed test rendered the deletedSkeleton. Coverage thresholds are unaffected becausevitest.config.tsrestricts the coverage scope to a named list of runtime modules and never includedsrc/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 whatcomponents.jsonis for. That is why deleting them now is cheap rather than lossy. Re-addingsidebarwould also re-add its design tokens.Summary by CodeRabbit