Skip to content

Commit hook fails on every TypeScript change: 74 unused exports on main #256

Closed

Description

@tannerpolley

Found while landing #240 (PR #255), 2026-10-29.

The pre-commit hook (vite.config.ts → staged → vp run knip:check) runs knip's export check across every workspace for any staged code change. main at 5952dd1 fails it with 74 unused exports, so every TypeScript commit fails the hook, whatever it changes. Workers have been skipping the hook (--no-verify) to commit. #255 already cleared the unused-file findings.

Reproduce: run PATH=$HOME/.local/share/vite-plus/fallback-bin:$PATH vp run knip:check from the repo root. Examples: isContextMenuPointerDown, resolveThreadRowClassName, threadLocationKey and formatWorkingDurationLabel in Sidebar.logic.ts, SidebarCaret, inlineShellContext, tokenizeShell, t3OrchestrationBaseInstructions.

Done means

  • vp run knip:check passes on main.
  • For each export, choose one:
    • drop the export when only its own file uses it;
    • delete it when nothing uses it;
    • keep it with a knip ignore entry that has a reason, if something knip can't see uses it (for example a test-only seam or a public package export).
  • Upstream-owned exports that upstream also leaves unused can stay ignored rather than diverging from upstream. Record which ones in the PR.
  • No behavior change. Run the affected typechecks and the tests beside changed files.

Out of scope: knip's dependency and catalog findings, which knip:check doesn't gate.

Activity

  1. tannerpolley commented on Nov 13, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code status: Done

    Issue: #256 Commit hook fails on every TypeScript change: 74 unused exports on main

    Thread: thread:delegated-task:command%3Amcp%3Af7dbe326-b11b-455a-a927-ca05430dc653%3Adelegate-task%3Aissue-256-build-1

    Model: claude-sonnet-5-5

    Branch: issue-256-commit-hook-fails-on-every-typescript

    Updated: 2026-11-13T20:27:02.577Z

  2. tannerpolley commented on Nov 13, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code closeout: done

    Issue: #256 Commit hook fails on every TypeScript change: 74 unused exports on main
    Thread: thread:delegated-task:command%3Amcp%3Af7dbe326-b11b-455a-a927-ca05430dc653%3Adelegate-task%3Aissue-256-build-1
    Model: claude-sonnet-5-5
    Branch: issue-256-commit-hook-fails-on-every-typescript
    Completed: 2026-11-13T20:22:55.229Z

    PR #392 (draft, not merged), head c2277848ad71e3b698ed1ace18f1b4c6cb0011f1. CI checks and reviews haven't run yet.

    Knip: vp run knip:check passes (both passes). The commit hook (format, lint, knip) also passed without --no-verify.

    Typecheck: passes in every affected package except apps/mobile, which has 3 errors in files I didn't touch:

    • ComposerCommandPopover.tsx
    • projectIcon.ts
    • asset-url-state.ts

    None involve a removed name, and I grepped mobile, marketing, evals and scripts to confirm. I did not run those errors on main, so I can't say for certain they predate this branch.

    Tests: the tests beside the changed files passed (28 files, 749 tests). The React Compiler check passed too.

    What changed for the 81 exports:

    • I dropped export where only the file itself uses the name.
    • I deleted what nothing uses. That is mostly dead helpers in the Codex, Claude and port-scanner test harnesses (about 780 lines), unused web helpers, and subagentResultOwed.
    • I also removed two dead re-exports, one from OrchestratorMcpService.ts and one from session-logic.ts, plus the imports and constants the deleted code left behind.

    Ignored exports: none. No knip ignore entries were needed, and no upstream-owned exports were left ignored, so the PR lists none.

    Beyond the issue's scope: shellCommand.ts and inlineShell.ts already had lint errors, and the hook lints staged files, so they would have blocked the commit. I trimmed two over-length comments in shellCommand.ts and removed one unused lint directive in inlineShell.ts. The formatter also reflowed two lines in inlineShell.ts.

    PR 392 is linked to this thread.

    PR #392, head c227784, checks and reviews not yet run

  3. tannerpolley commented on Nov 13, 2026

    @tannerpolley
    OwnerAuthor

    T3 Code closeout: done

    Issue: #256 Commit hook fails on every TypeScript change: 74 unused exports on main
    Thread: thread:delegated-task:command%3Amcp%3Af7dbe326-b11b-455a-a927-ca05430dc653%3Adelegate-task%3Aissue-256-build-1
    Model: claude-sonnet-5-5
    Branch: issue-256-commit-hook-fails-on-every-typescript
    Completed: 2026-11-13T20:27:08.623Z

    PR #392 is now ready for review, and StorageSettings.tsx matches origin/main exactly again. Head SHA: d8e085e6718eba317e77e47af6bdd15dbf02b05e.

    • Knip: vp run knip:check passes (both passes). The commit hook also passed without --no-verify.
    • Typecheck: the web typecheck (effect-tsgo tsrs --noEmit) passes. Both ran through agent-heavy, and I waited on the PID. I didn't re-run the other packages' typechecks, since this change only touches knip.jsonc and restores one web file. The 3 mobile errors are untouched, as you said.
    • Ignore entry added: in knip.jsonc under apps/web, ignoreIssues["src/components/settings/StorageSettings.tsx"] = ["exports"]. The comment says the unused WorktreesDirectoryRow export is upstream-owned and upstream leaves it unused. It is also listed in the PR body, and I removed StorageSettings from the body's list of deleted code.

    Everything else in the PR is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions