Skip to content

[Chore] Turn off unused-variable linting in src and remove dead code - #2038

Merged
edelauna merged 3 commits into
mainfrom
chore/disable-no-unused-vars-0kir94mbcjovf
Oct 14, 2026
Merged

edelauna merged 3 commits into
mainfrom
chore/disable-no-unused-vars-0kir94mbcjovf

Conversation

@zoomote

@zoomote zoomote Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

No linked issue. This change was requested directly in Discord (turn off no-unused-vars in src/eslint.config.mjs and clean up unreferenced variables).

Description

This PR turns off unused-variable linting for the src workspace and removes the dead code that built up while the rule was off.

How it was done:

  • src/eslint.config.mjs now sets both no-unused-vars and @typescript-eslint/no-unused-vars to "off". The @typescript-eslint variant was already off. The base rule is now off too, so unused-variable checking is fully disabled for this workspace.
  • Violations were found first, then removed. The scan ran ESLint with @typescript-eslint/no-unused-vars forced on (same options as the shared base config: argsIgnorePattern/varsIgnorePattern/caughtErrorsIgnorePattern of ^_). It reported 391 violations in 188 files. tsc --noUnusedLocals --noUnusedParameters was used as a stricter cross-check afterwards.
  • Cleanup types:
    • Removed unused imports (about 70 files, autofixed then hand-reviewed).
    • Removed unused local variables, private functions, interfaces, and type aliases.
    • Converted unused catch (e) bindings to the optional catch binding (catch { ... }), which the codebase already uses.
    • Prefixed intentionally unused function parameters with _, per the existing ^_ ignore-pattern convention.
    • Removed unused destructured properties where the binding was not needed. Kept the rest-omission pattern (for example const { id: _id, ...rest } = detail) where the destructuring itself excludes a key.
    • Removed never-read private methods and properties, and converted never-read constructor parameter properties to plain parameters.
  • Side-effecting calls whose results were unused (for example await collectStream(stream) in tests, or new URL(trimmedUrl) used for validation) are kept as expression statements. No behavior changes are intended.
  • Two consts are kept on purpose: OllamaModelInfoResponseSchema and dynamicProviderExtras are referenced in type position through typeof, so they are not unreferenced.
  • src/eslint-suppressions.json was 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: the refreshServers path no longer reads the global/project settings files into unused locals. initializeMcpServers re-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 of downloadTask in export-markdown.ts (its only call site was updated).
  • src/services/code-index/embedders/openrouter.ts: removed the write-only private apiKey property. The constructor still validates the key and passes it to the client directly.

Test Procedure

  • pnpm test from the repository root: 13/13 turbo tasks pass. The src suite runs 532 test files, 10,574 tests, all green.
  • pnpm lint from the repository root: 11/11 tasks pass. src was also checked with eslint --prune-suppressions --max-warnings=0.
  • pnpm check-types from the repository root: 11/11 tasks pass.
  • ESLint re-scan with @typescript-eslint/no-unused-vars forced on after the cleanup: zero actionable findings.
  • tsc --noEmit --noUnusedLocals --noUnusedParameters cross-check: clean, except intentional _-prefixed names and compile-time assertion types, which follow existing conventions.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above). — No issue exists; the request came from Discord.
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable). — No new tests needed; this is dead code removal only. Existing suites all pass.
  • Visual Snapshot (UI changes only): If a user would notice this change at a glance (layout, theme tokens, brand elements, empty/error states), I added or updated a *.visual.tsx snapshot in webview-ui/. See webview-ui/AGENTS.md → "When a UI change needs a snapshot". — Not applicable; no UI change.
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

Visual Snapshots

Not applicable. This PR changes no rendered UI.

Videos (interaction / animation only)

Not applicable.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required. (Describe what to update, or link to a PR in the docs repository).

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 latest main.

Get in Touch

Requested by Discord user 0x7777777_.

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.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 595a819c-2bf4-4e79-9c54-af2a9a73ca38

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This 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. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna marked this pull request as ready for review October 13, 2026 23:17
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 13, 2026
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 14, 2026
@edelauna
edelauna added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 58341d8 Oct 14, 2026
23 of 24 checks passed
@edelauna
edelauna deleted the chore/disable-no-unused-vars-0kir94mbcjovf branch October 14, 2026 01:30
easonLiangWorldedtech pushed a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech pushed a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
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.
easonLiangWorldedtech added a commit to easonLiangWorldedtech/Zoo-Code that referenced this pull request Oct 14, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit coderabbit-review-active Required CI passed; CodeRabbit review is active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants