Skip to content

refactor: drop unused exports detected by fallow auto-fix#944

Merged
jrusso1020 merged 1 commit into
mainfrom
cleanup/fallow-auto-fix
May 19, 2026
Merged

refactor: drop unused exports detected by fallow auto-fix#944
jrusso1020 merged 1 commit into
mainfrom
cleanup/fallow-auto-fix

Conversation

@jrusso1020
Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 commented May 18, 2026

What

Run fallow fix --auto-fixable to drop the export keyword from symbols fallow identifies as unreachable from any entry point, restricted to cases where the symbol is still used internally in its own file.

Why

After #938 + #942 landed the config + CI audit gate, fallow reports 276 dead-code findings. The biggest mechanical chunk is unused exports — symbols exported "in case someone needs them" that nothing currently imports. Removing the export keyword makes them module-private, shrinks the public surface, and lets future cleanup catch genuinely-orphaned declarations.

How

npx fallow@2.75.0 fix --yes would have applied 165 de-exports. Inspecting the result against typecheck + lint + the fallow audit surfaced three problem categories:

False positives (4 files reverted):

  • captureCost.tsrenderOrchestrator.ts has two separate import { ... } from "./render/captureCost.js" blocks. Fallow only saw the first and incorrectly flagged symbols from the second block as unused. (Real bug to file upstream.)
  • propertyPanelHelpers.ts, domEditingLayers.ts — internal uses fallow's reachability missed.
  • render.ts — exports consumed via await import("./render.js") dynamic imports in tests; fallow's static analysis doesn't follow these.

Cascading dead code (20 files reverted):
When fallow removed export from a symbol that wasn't used in-file either, oxlint immediately surfaces no-unused-vars. Those cases are properly cleaned up by deleting the declaration, not just dropping export. Doing that touches different code shapes (cascading unused imports, dead helpers) and is better as a separate, narrower PR.

Barrel cascades (4 more files reverted):
After force-rebasing onto main, fallow audit caught a third pattern: dropping a single re-export from a barrel file or a single export from a tightly-coupled file made the other symbols in that file become unused. Examples:

  • Button.tsx — removing Button's and IconButton's exports orphaned the whole file
  • renderOrchestrator.ts — removing one captureCost re-export left other dead re-exports
  • telemetry/index.ts, portUtils.ts, ui/index.ts, hyperframeRuntimeLoader.ts — similar barrel-cleanup cascades

These need a "whole-file cleanup" pass, not a per-symbol auto-fix.

Kept the remaining 38 files where the de-export is purely an access-modifier change — symbol is still used internally, no follow-on findings.

Result

  • Fallow dead-code findings: 276 → 208 (68 fewer unused exports)
  • No behavior change — each symbol is still defined and used identically inside its file
  • Zero lint / format / typecheck regressions
  • Fallow audit passes on this PR (all remaining findings are inherited)

Test plan

  • bun run --filter '*' typecheck — clean across all 8 packages
  • bun run lint — 0 errors
  • bun run format:check — clean
  • npx fallow@2.75.0 audit --base origin/main --fail-on-issues — exit 0 (all 19 remaining changed-file findings are inherited)
  • vitest: packages/cli 335/335, packages/core 917/917, packages/studio 576/576, packages/engine 605/605

Follow-ups

  • Delete fully-dead declarations (the 20 files reverted) — properly clean up code where the export had no consumers internally either
  • Barrel/cascade file cleanupButton.tsx, renderOrchestrator.ts re-export barrel, telemetry/index.ts, ui/index.ts, etc. Each is its own small whole-file decision.
  • File multi-import-block bug with fallow upstream
  • Producer renderOrchestrator hub cycle — 8 circular deps, real refactor

Copy link
Copy Markdown
Collaborator Author

jrusso1020 commented May 18, 2026

Base automatically changed from 05-18-ci_add_fallow_audit_job_pr-scoped_new-only_gate_ to main May 19, 2026 00:46
Run `fallow fix --auto-fixable` to remove `export` keywords from symbols
fallow's reachability analysis identifies as unused. Keeps only the cases
where the symbol is still referenced internally in its own file (so
removing `export` doesn't surface a new oxlint `no-unused-vars` error).

Result: fallow dead-code findings drop from 276 → 208 (68 fewer unused
exports), with no behavior change — each symbol is still defined and used
exactly the same way within its file.

Reverted ~20 files where fallow's auto-fix would have created cascading
"declared but never used" lint errors — those are cases where the symbol
isn't used at all, and properly cleaning them up means deleting the
declaration, not just dropping `export`. Better to land that as a
separate, narrower PR rather than mixing it into a mechanical de-export.

Also reverted four false positives where fallow missed real consumers:
- `captureCost.ts` (renderOrchestrator has two separate import blocks
  from the same module; fallow only saw the first)
- `propertyPanelHelpers.ts`, `domEditingLayers.ts` (real internal uses
  fallow's reachability missed)
- `render.ts` (functions imported via `await import()` dynamic import,
  which fallow's static analysis doesn't follow)

Test plan: bun run --filter '*' typecheck (clean), oxlint + oxfmt clean,
cli/core/studio/engine vitest suites pass (335 + 917 + 576 + 605 tests).
@jrusso1020 jrusso1020 force-pushed the cleanup/fallow-auto-fix branch from 4a464aa to 7e0a447 Compare May 19, 2026 00:52
@jrusso1020 jrusso1020 merged commit 2d56633 into main May 19, 2026
49 of 58 checks passed
@jrusso1020 jrusso1020 deleted the cleanup/fallow-auto-fix branch May 19, 2026 01:19
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