Repository navigation
[Chore] Turn off unused-variable linting in src and remove dead code - #2038
Conversation
Turn off both no-unused-vars and @typescript-eslint/no-unused-vars in
src/eslint.config.mjs, and clean up all existing violations so the tree
stays tidy without the rule:
- Remove unused imports across src (autofixed, then hand-reviewed).
- Remove unused local variables, functions, interfaces, and type aliases.
- Convert unused catch bindings to optional catch binding (catch { ... }).
- Prefix intentionally unused function parameters with _ per the existing
argsIgnorePattern convention, and drop unused destructured properties.
- Remove never-read private members and convert never-read constructor
parameter properties to plain parameters.
- Prune reduced counts in eslint-suppressions.json (counts only decreased).
No behavior changes: side-effecting calls whose results were unused are
kept as expression statements.
Validated with:
- eslint with @typescript-eslint/no-unused-vars forced on: zero findings.
- tsc --noEmit --noUnusedLocals --noUnusedParameters cross-check: clean.
- pnpm lint, pnpm check-types, pnpm test (root, all workspaces): all pass.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Conflict resolution (upstream Zoo-Code-Org#2038 unused-variable linting + dead code removal vs this branch's abort wiring): - openai-compatible.ts / openai-native.ts completePrompt: keep the branch's request-local merged signal (upstream's _options variant predates the abort wiring that consumes options). - openai-native.ts responses-stream catch: keep the branch's post-loop aborted check and isRequestAborted classification (upstream's bare catch predates it). - openai-native.ts SSE reader: keep streamCompleted (used by the early-exit cancel guard); adopt upstream's removal of the dead totalInputTokens/totalOutputTokens locals. - Per the Stryker-directive policy, the two pre-existing "Stryker disable" comments in openai-native.ts are removed; the mutants they suppressed are killed by the existing dual-direction cancel assertions (normal completion asserts no cancel; early exit asserts cancel). - eslint-suppressions.json: merged with upstream's rebaselined counts; openai-native.ts no-explicit-any is upstream's 27 plus the branch's single pre-existing any (28, pruned to actual). - openai-native.spec.ts: rename the unused mock arg to _options per the upstream lint config. Verification at this merge: 147/147 green in openai-native.spec.ts + openai-compatible.spec.ts; tsc --noEmit 0 errors; eslint --max-warnings=0 clean with pruned suppression counts; prettier clean.
Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src and removed the tree's dead bindings. Replaying this unit onto that main exposed the bindings this unit's own code left unused once main's deletions landed: drop the ReadFileTool/SafeWriteTextOptions/lockfile imports and the never-read committed flag, prefix the four write-path destructurings whose value no assertion reads, and restore the safeWriteJson import main pruned (main had no reader; this unit's McpHub tests do). No behavior change: 357 tests green across the unit's specs, eslint clean, tsc adds no new errors beyond the pre-existing local donor-package drift.
Conflict resolution and post-merge repair for upstream Zoo-Code-Org#2038 (unused-variable linting re-enabled + dead code removal): - anthropic.ts: keep the branch's withFinallyCleanup import; adopt upstream's removal of the unused OpenAI import. - minimax.spec.ts / xai.spec.ts: keep the branch's test-util and APIUserAbortError imports (used by the abort tests); drop the unused Anthropic type import from xai.spec.ts. - anthropic.ts / anthropic-vertex.ts / minimax.ts / xai.ts: restore the options parameter name in completePrompt (upstream renamed it to _options where their body ignored it; this branch's abort wiring consumes it). - minimax.ts: restore the AnthropicStream import (used by the typed stream annotation). - anthropic-vertex.spec.ts: drop two unused mockCreate bindings (the spies remain). Verification at this merge: 273/273 green across anthropic, anthropic-vertex, minimax, xai, stream-cleanup and abort-signal specs; tsc --noEmit 0 errors; eslint --max-warnings=0 clean with suppression counts identical to upstream; prettier clean.
Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src, and Zoo-Code-Org#799 added pnpm format:check to the Code QA compile job. Replaying this unit onto that main exposed: - unused bindings left by main's dead-code removal (ReadFileTool / SafeWriteTextOptions / lockfile imports, the never-read committed flag, four write-path destructurings whose value no assertion reads), plus a duplicate Task import the conflict merge left behind; - prettier-canonical formatting under the repo config (the unit's files predate the format gate). No behavior change: 9 unit specs 505 passed / 1 skipped, eslint clean, prettier clean, tsc adds nothing beyond the pre-existing local donor-package drift.
Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src and Zoo-Code-Org#799 added pnpm format:check to Code QA. Replaying this unit onto that main exposed unused bindings left by main's dead-code removal (ReadFileTool / SafeWriteTextOptions / lockfile imports, the never-read committed flag, four write-path destructurings no assertion reads, dirPath/referent/ missing locals whose readers main deleted), a duplicate Task import the conflict merge left behind, and the path import main pruned from DiffViewProvider.spec that this unit's tests still need. Formatting brought to prettier-canonical under the repo config. No behavior change: 12 unit specs 545 passed / 6 skipped, eslint clean, prettier clean, tsc adds nothing beyond the pre-existing local donor-package drift.
Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src and Zoo-Code-Org#799 added pnpm format:check to Code QA. Replaying this unit onto that main exposed unused bindings left by main's dead-code removal (ReadFileTool / SafeWriteTextOptions / lockfile imports, the never-read committed flag, four write-path destructurings no assertion reads, the lockKey local this unit's safeWriteJson no longer reads, and the ownedTeardown binding in the rejected-save rollback path whose value nothing consumes - the await itself is unchanged), plus a duplicate Task import and the path import main pruned from DiffViewProvider.spec that this unit's tests need. Formatting brought to prettier-canonical under the repo config. No behavior change: DiffViewProvider.spec 166/166 including the teardown-lineage tests, 11 unit specs 537+ green (one local-only DaclRestoreError flake on this machine's temp dir), eslint clean, prettier clean, tsc adds nothing beyond the pre-existing local donor-package drift.
Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src and Zoo-Code-Org#799 added pnpm format:check to Code QA. Replaying this unit onto that main exposed unused bindings left by main's dead-code removal (ReadFileTool / SafeWriteTextOptions / lockfile imports, four write-path destructurings no assertion reads, an unused realpath callback parameter), a duplicate Task import, and the path import main pruned from DiffViewProvider.spec that this unit's tests still need. Formatting brought to prettier-canonical under the repo config. Conflict notes: the file-safety rollback commits (committed guard, RollbackFailureError message) were replayed onto main's untouched file-safety core; Task.ts kept main's runState/runRejections fields while applying this unit's isPaused removal; eslint-suppressions.json took main's pruned baseline and the unit's earned reductions. No behavior change: 21 unit specs 709 passed / 9 skipped, eslint clean, prettier clean, tsc adds nothing beyond the pre-existing local donor-package drift.
…rop Stryker directives Zoo-Code-Org#2038 turned @typescript-eslint/no-unused-vars back on in src and Zoo-Code-Org#799 added pnpm format:check to Code QA. Replaying this unit onto that main exposed unused bindings left by main's dead-code removal (ReadFileTool / SafeWriteTextOptions / lockfile imports, four write-path destructurings no assertion reads, an unused realpath callback parameter), a duplicate Task import, and the path import main pruned from DiffViewProvider.spec that this unit's tests still need. Per AGENTS.md the two Stryker suppression comments in the guarded save path are removed; their equivalence claims now live in the PR description (writeKind default StringLiteral is out of the changed-line selector and dispatches like "update" inside guardedWrite; the adoption-probe saveTask operand is provably non-null whenever evaluated). Formatting brought to prettier-canonical under the repo config. No behavior change: 15 unit specs 635 passed / 9 skipped, eslint clean, prettier clean, tsc adds nothing beyond the pre-existing local donor-package drift.
Related GitHub Issue
No linked issue. This change was requested directly in Discord (turn off
no-unused-varsinsrc/eslint.config.mjsand clean up unreferenced variables).Description
This PR turns off unused-variable linting for the
srcworkspace and removes the dead code that built up while the rule was off.How it was done:
src/eslint.config.mjsnow sets bothno-unused-varsand@typescript-eslint/no-unused-varsto"off". The@typescript-eslintvariant was already off. The base rule is now off too, so unused-variable checking is fully disabled for this workspace.@typescript-eslint/no-unused-varsforced on (same options as the shared base config:argsIgnorePattern/varsIgnorePattern/caughtErrorsIgnorePatternof^_). It reported 391 violations in 188 files.tsc --noUnusedLocals --noUnusedParameterswas used as a stricter cross-check afterwards.catch (e)bindings to the optional catch binding (catch { ... }), which the codebase already uses._, per the existing^_ignore-pattern convention.const { id: _id, ...rest } = detail) where the destructuring itself excludes a key.await collectStream(stream)in tests, ornew URL(trimmedUrl)used for validation) are kept as expression statements. No behavior changes are intended.OllamaModelInfoResponseSchemaanddynamicProviderExtrasare referenced in type position throughtypeof, so they are not unreferenced.src/eslint-suppressions.jsonwas pruned with--prune-suppressions. Counts only decreased (8 files reduced, 1 key removed), per the repo ratchet rule.Points reviewers may want to check with care:
src/services/mcp/McpHub.ts: therefreshServerspath no longer reads the global/project settings files into unused locals.initializeMcpServersre-reads them anyway, so the reads were dead.src/core/webview/ClineProvider.ts: removed two never-called private cloud-sync stub methods and the unused first parameter ofdownloadTaskinexport-markdown.ts(its only call site was updated).src/services/code-index/embedders/openrouter.ts: removed the write-only privateapiKeyproperty. The constructor still validates the key and passes it to the client directly.Test Procedure
pnpm testfrom the repository root: 13/13 turbo tasks pass. Thesrcsuite runs 532 test files, 10,574 tests, all green.pnpm lintfrom the repository root: 11/11 tasks pass.srcwas also checked witheslint --prune-suppressions --max-warnings=0.pnpm check-typesfrom the repository root: 11/11 tasks pass.@typescript-eslint/no-unused-varsforced on after the cleanup: zero actionable findings.tsc --noEmit --noUnusedLocals --noUnusedParameterscross-check: clean, except intentional_-prefixed names and compile-time assertion types, which follow existing conventions.Pre-Submission Checklist
*.visual.tsxsnapshot inwebview-ui/. Seewebview-ui/AGENTS.md→ "When a UI change needs a snapshot". — Not applicable; no UI change.Visual Snapshots
Not applicable. This PR changes no rendered UI.
Videos (interaction / animation only)
Not applicable.
Documentation Updates
This is an internal lint configuration and dead code cleanup. It changes no user-facing behavior or settings, so the docs site needs no update.
Additional Notes
Net diff: 208 files under
src/, about +500/−980 lines. The branch is rebased on the latestmain.Get in Touch
Requested by Discord user
0x7777777_.