Skip to content

chore: enable noUnusedLocals in schema, server, sdk and smaller packages - #52850

Merged
kitlangton merged 1 commit into
v2from
unused-locals-small
Oct 2, 2026
Merged

kitlangton merged 1 commit into
v2from
unused-locals-small

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why

Every package tsconfig extends @tsconfig/bun (or @tsconfig/node22), and those bases leave noUnusedLocals off. Nobody turned it off on purpose, so unused imports, variables, types and helpers have been piling up without anyone noticing. This PR turns the flag on for the packages listed below.

What Changes

Package tsconfig(s) flagged Unused locals removed
schema tsconfig.json (tsconfig.build.json extends it) test/event-manifest.test.ts: Schema import
server tsconfig.json (tsconfig.build.json extends it) src/handlers/event.ts: Bus import
sdk tsconfig.json none of its own (errors came from referenced server/simulation/httpapi-codegen sources)
simulation tsconfig.json src/backend/simulated-provider.ts: JsonSchema import
enterprise tsconfig.json none of its own (errors came from session-ui)
http-recorder tsconfig.json (test/tsconfig.json extends it) RequestSnapshot / CassetteMetadata type imports. The export type { … } from re-exports stay
httpapi-codegen tsconfig.json src/index.ts: unused const [first, ...rest] = expanded. test/generated-consumer.ts: the type assertion _requiresHttpClient is now exported as requiresHttpClient instead of deleted, so the compile-time check still runs
session-ui tsconfig.json markdown-worker.ts: unused instance binding. The getWorker() call stays because it starts the worker, same as in projectMarkdown. session-review.tsx: unused Item type
merman tsconfig.json decodeMermaidText import, GanttCellStyle type import, centeredStart helper, stateDiagramNoteConnector value import (the type import stays)
gui-extensions tsconfig.json terminal/serialize.ts: write-only fields _lastCursorRow, _lastCursorCol and _lastContentCursorCol, plus their assignments
stats/app, stats/core, stats/server each tsconfig.json stats/app: formatModelRankMoveLabel and its only helper formatRankMove, plus the ComparisonModelRef type import
storybook tsconfig.json none of its own

Notable:

  • gui-extensions serialize.ts: in the upstream xterm serialize addon, _lastCursorRow/Col are used to put the cursor back in place. This port already does that differently: it writes a CUP sequence from the buffer's live cursorX/cursorY. That made the fields write-only, so removing them doesn't change output. Serializer tests pass.
  • stats/app: the merge in chore: merge dev into v2 #35591 (hero redesign) removed the model-rank-panel that rendered formatModelRankMoveLabel. Its i18n keys (model.noUsageLastWeek, model.newThisWeek, model.sameAsPreviousWeek, model.vsPreviousWeek) are now unused but are left alone here. If the rank-move label should come back, that is a separate fix.
  • storybook has no typecheck script, and its tsconfig already fails with unrelated errors (unresolved @/… aliases and others). The flag is added for consistency, but nothing enforces it yet.
  • identity and effect-drizzle-sqlite have no tsconfig, so they are unchanged.
  • noUnusedParameters is still off.

Scope

This is one of a series of PRs that turn on noUnusedLocals package by package. It only touches the packages listed above.

Verification

# each package: schema server sdk simulation enterprise http-recorder httpapi-codegen session-ui merman gui-extensions stats/{app,core,server}
bun typecheck
(cd packages/storybook && bunx tsgo -p tsconfig.json --noEmit | grep -E 'TS6(133|192|196|198)')
(cd packages/schema && bun test test/event-manifest.test.ts)
# each package: http-recorder httpapi-codegen session-ui merman gui-extensions simulation
bun run test
(cd packages/server && bun run test test/event-feed.test.ts)
bun run check
  • All of these typechecks pass. Storybook reports no unused-local errors.
  • Tests pass: schema 7, http-recorder 48, httpapi-codegen 96, session-ui 200, merman 504, gui-extensions 94, simulation 47, server event-feed 6. One merman timing assertion failed once and passed on rerun.
  • bun run check: Tasks: 36 successful, 36 total.

@kitlangton
kitlangton enabled auto-merge (squash) October 2, 2026 22:23
@kitlangton
kitlangton merged commit eb1a9ea into v2 Oct 2, 2026
11 checks passed
@kitlangton
kitlangton deleted the unused-locals-small branch October 2, 2026 22:24
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant