Skip to content

Remove dead declarations inside live files, barrel-only re-exports and unused default exports - #1171

Merged
yattias merged 2 commits into
mainfrom
cleanup/5-dead-exports
Oct 11, 2026
Merged

yattias merged 2 commits into
mainfrom
cleanup/5-dead-exports

Conversation

@yattias

@yattias yattias commented Oct 11, 2026

Copy link
Copy Markdown
Member

Fifth chunk of the dead-code removal plan (docs/dead-code-report.md, kept local), following #1169. This one works inside live files: the exports knip reports as imported nowhere, limited to declarations that are not used in their own file either. Symbols that are only used in-file keep their export (that mechanical pass is optional and left out).

What goes

  • 77 declarations deleted outright. The nine unused bounty helpers in bountyUtil.ts; BountyHubSelector (its Hub type moves next to useBounties, its only reader); the four unused BaseFeedItem sections; LabelBadge; the two collapsible wrappers; useNote, useMakeNotePrivate, useUpdateNotePermissions; useUpdateOrgDetails, useUpdateOrgCoverImage; createFeedEntryFromWork; transformHub, transformContent; getAuditContentPreview and the text helpers only it called; the formatCombinedBalance pair; isValidPassword / isValidName; toNumberOrNull; isPinchGesture; ALL_CONTENT_TYPES; the deprecated HotScoreTooltip alias; the grant template object only getInitialContent returned; and the one-line Transformed* / response type aliases nothing references.
  • 43 barrel re-export lines dropped (Activity, Embed, Editor/extensions, ui/Table, WorkHeader, PublishingForm, AuthorPosts, BaseFeedItem, plus a few single type re-exports). Everything behind them is still imported directly, except TopicAndJournalBadge, FUNDING_KIND_LABEL and the FundingRequest interface, which had no other reader and go too.
  • 38 trailing export default X; lines removed from files that also export X by name; nothing imported the default.
  • Dependencies: @tiptap/extension-bullet-list, -ordered-list and -paragraph leave package.json. The barrel re-export was their only reference, and StarterKit already provides those nodes (they stay in node_modules through it).
  • Imports and local types orphaned by the deletions are removed. Unused imports that already existed on main in untouched lines are left alone, so the diff stays attributable.

95 files changed, 1,867 lines removed, 22 added (the moved Hub type and trimmed import lines). No behaviour change intended.

Checks

  • npm run lint: 0 errors (2 pre-existing warnings in untouched files)
  • npm run type-check: clean
  • ESLint's no-unused-vars run ad hoc on every touched file: only findings that already existed on main remain
  • knip run three times (after the main pass, after the second-layer deletions, after the dependency removal): no unused files, no new unused exports
  • Dev server on the branch: all main routes return 200; the block editor still renders on a registered report page

Not in this chunk

knip still lists ~400 exports that are only used inside their own file (dropping the export keyword) and the undeclared transitive imports (highlight.js, @radix-ui/react-portal, @tanstack/react-query, wagmi). Both are separate, mechanical changes if wanted.

Next

Chunk 6 (retire/6-topic-pages) is the first product retirement and starts once this is merged.

🤖 Generated with Claude Code

…d unused default exports

Fifth chunk of the dead-code plan: the exports knip reports as imported
nowhere, limited to declarations that are not used in their own file
either (symbols that are only used in-file keep their export; that pass is
optional and left out).

- 77 declarations deleted outright: the nine unused bounty helpers,
  BountyHubSelector (its Hub type moves next to useBounties, its only
  reader), the four BaseFeedItem sections, LabelBadge, the two collapsible
  wrappers, useNote/useMakeNotePrivate/useUpdateNotePermissions,
  useUpdateOrgDetails/useUpdateOrgCoverImage, createFeedEntryFromWork,
  transformHub/transformContent, getAuditContentPreview and the text helpers
  only it called, the formatCombinedBalance pair, isValidPassword/isValidName,
  toNumberOrNull, isPinchGesture, ALL_CONTENT_TYPES, the deprecated
  HotScoreTooltip alias, the grant template object only getInitialContent
  returned, and the one-line Transformed* / response type aliases nothing
  references.
- 43 barrel re-export lines dropped (Activity, Embed, Editor extensions,
  Table, WorkHeader, PublishingForm, AuthorPosts, BaseFeedItem and a few
  single type re-exports); everything behind them is still imported directly
  except TopicAndJournalBadge, FUNDING_KIND_LABEL and the FundingRequest
  interface, which had no other reader and go too.
- 38 trailing `export default X;` lines removed from files that also export
  X by name; nothing imported the default.
- @tiptap/extension-bullet-list, -ordered-list and -paragraph leave
  package.json: the barrel re-export was their only reference and StarterKit
  already provides those nodes.
- Imports and local types orphaned by the deletions are removed; pre-existing
  unused imports in untouched lines are left alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yattias
yattias requested a review from a team as a code owner October 11, 2026 02:40
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@vercel

vercel Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
web Ready Ready Preview Oct 11, 2026 9:26pm UTC

Request Review

@sonarqubecloud

Copy link
Copy Markdown

@yattias
yattias merged commit 1db76f9 into main Oct 11, 2026
4 of 5 checks passed
@yattias
yattias deleted the cleanup/5-dead-exports branch October 11, 2026 21:29

This branch was successfully deployed

1 active deployment
Preview — f474067d Deployed Oct 11, 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