Skip to content

Commit 58341d8

Browse files
zoomote[bot]roomoteedelauna
authored
[Chore] Turn off unused-variable linting in src and remove dead code (#2038)
* chore(eslint): turn off no-unused-vars in src and remove dead code 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. * chore(eslint): turn on no-unused-vars in src * chore(eslint): enforce unused-vars rules in src and remove dead code --------- Co-authored-by: Roomote <[email protected]> Co-authored-by: Elliott de Launay <[email protected]>
1 parent f315cf4 commit 58341d8

223 files changed

Lines changed: 558 additions & 1029 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/__tests__/ClineProvider.history-resume-delegation.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,8 +1878,8 @@ describe("History resume delegation - parent metadata transitions", () => {
18781878

18791879
const atomicUpdatePair = vi.fn(
18801880
async (
1881-
firstId: string,
1882-
secondId: string,
1881+
_firstId: string,
1882+
_secondId: string,
18831883
firstUpdater: (h: HistoryItem) => HistoryItem,
18841884
secondUpdater: (h: HistoryItem) => HistoryItem,
18851885
) => {
@@ -1988,8 +1988,8 @@ describe("History resume delegation - parent metadata transitions", () => {
19881988
const taskHistoryStore = {
19891989
atomicUpdatePair: vi.fn(
19901990
async (
1991-
firstId: string,
1992-
secondId: string,
1991+
_firstId: string,
1992+
_secondId: string,
19931993
firstUpdater: (h: any) => any,
19941994
secondUpdater: (h: any) => any,
19951995
) => {

‎src/__tests__/command-mentions.spec.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ npm install
272272

273273
describe("command mention regex patterns", () => {
274274
it("should match valid command mention patterns anywhere", () => {
275-
const commandRegex = /\/([a-zA-Z0-9_\.-]+)(?=\s|$)/g
275+
const commandRegex = /\/([a-zA-Z0-9_.-]+)(?=\s|$)/g
276276

277277
const validPatterns = ["/setup", "/build-prod", "/test_suite", "/my-command", "/command123"]
278278

@@ -284,19 +284,19 @@ npm install
284284
})
285285

286286
it("should match command patterns in middle of text", () => {
287-
const commandRegex = /\/([a-zA-Z0-9_\.-]+)(?=\s|$)/g
287+
const commandRegex = /\/([a-zA-Z0-9_.-]+)(?=\s|$)/g
288288

289289
const validPatterns = ["Please /setup", "Run /build now", "Use /deploy here"]
290290

291291
validPatterns.forEach((pattern) => {
292292
const match = pattern.match(commandRegex)
293293
expect(match).toBeTruthy()
294-
expect(match![0]).toMatch(/^\/[a-zA-Z0-9_\.-]+$/)
294+
expect(match![0]).toMatch(/^\/[a-zA-Z0-9_.-]+$/)
295295
})
296296
})
297297

298298
it("should match commands at start of new lines", () => {
299-
const commandRegex = /\/([a-zA-Z0-9_\.-]+)(?=\s|$)/g
299+
const commandRegex = /\/([a-zA-Z0-9_.-]+)(?=\s|$)/g
300300

301301
const multilineText = "First line\n/setup the project\nAnother line\n/deploy when ready"
302302
const matches = multilineText.match(commandRegex)
@@ -309,7 +309,7 @@ npm install
309309
})
310310

311311
it("should match multiple commands in message", () => {
312-
const commandRegex = /(?:^|\s)\/([a-zA-Z0-9_\.-]+)(?=\s|$)/g
312+
const commandRegex = /(?:^|\s)\/([a-zA-Z0-9_.-]+)(?=\s|$)/g
313313

314314
const validText = "/setup the project\nThen /deploy later"
315315
const matches = validText.match(commandRegex)
@@ -321,7 +321,7 @@ npm install
321321
})
322322

323323
it("should not match invalid command patterns", () => {
324-
const commandRegex = /\/([a-zA-Z0-9_\.-]+)(?=\s|$)/g
324+
const commandRegex = /\/([a-zA-Z0-9_.-]+)(?=\s|$)/g
325325

326326
const invalidPatterns = ["/ space", "/with space", "/with/slash", "//double", "/with@symbol"]
327327

‎src/__tests__/nested-delegation-resume.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import { attemptCompletionTool } from "../core/tools/AttemptCompletionTool"
5555
import { ClineProvider } from "../core/webview/ClineProvider"
5656
import type { Task } from "../core/task/Task"
5757
import { readTaskMessages } from "../core/task-persistence/taskMessages"
58-
import { readApiMessages, saveApiMessages, saveTaskMessages } from "../core/task-persistence"
58+
import { readApiMessages } from "../core/task-persistence"
5959

6060
describe("Nested delegation resume (A → B → C)", () => {
6161
beforeEach(() => {

‎src/__tests__/removeClineFromStack-delegation.spec.ts‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// npx vitest run __tests__/removeClineFromStack-delegation.spec.ts
22

3-
import { describe, it, expect, vi, type MockedFunction } from "vitest"
3+
import { describe, it, expect, vi } from "vitest"
44
import { ClineProvider } from "../core/webview/ClineProvider"
55
import { TaskRegistry } from "../core/task/TaskRegistry"
66
import { PendingActionSettlementError, type Task } from "../core/task/Task"
77
import { makeProviderStub } from "./helpers/provider-stub"
88

9-
type MockTask = Pick<Task, "taskId" | "instanceId"> &
10-
Partial<Pick<Task, "parentTaskId" | "abort" | "abandoned">> & {
11-
emit: ReturnType<typeof vi.fn>
12-
abortTask: ReturnType<typeof vi.fn>
13-
}
14-
159
type PrivateClineProviderMethods = {
1610
removeClineFromStack: (this: ClineProvider) => ReturnType<ClineProvider["removeClineFromStack"]>
1711
cleanupFailedHistoryTask: (this: ClineProvider, task: Task, error: unknown) => Promise<void>
@@ -686,18 +680,6 @@ describe("onTaskCompleted callback — writes completed status before re-emittin
686680
// Wire up the real taskCreationCallback by calling the closure that ClineProvider
687681
// sets on `this.taskCreationCallback` during construction. We extract it from the
688682
// prototype's init code by calling the relevant portion directly.
689-
const listeners: Record<string, ((...args: unknown[]) => unknown)[]> = {}
690-
const fakeTask = {
691-
taskId: "task-1",
692-
on: vi.fn((event: string, fn: (...args: unknown[]) => unknown) => {
693-
listeners[event] = listeners[event] || []
694-
listeners[event].push(fn)
695-
}),
696-
emit: vi.fn((event: string, ...args: unknown[]) => {
697-
listeners[event]?.forEach((fn) => fn(...args))
698-
}),
699-
}
700-
701683
const provider = makeProviderStub({
702684
taskHistoryStore: { get: taskHistoryStoreGet },
703685
updateTaskHistory,

‎src/__tests__/single-open-invariant.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ describe("Single-open-task invariant", () => {
398398
createTask,
399399
getValues: vi.fn(() => ({})),
400400
providerSettingsManager: { saveConfig: vi.fn() },
401-
on: vi.fn((ev: unknown, cb: unknown) => {
401+
on: vi.fn((ev: unknown, _cb: unknown) => {
402402
if (ev === "taskCreated") {
403403
// no-op for this test
404404
}

‎src/activate/registerCommands.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import delay from "delay"
44
import type { CommandId } from "@roo-code/types"
55
import { TelemetryService } from "@roo-code/telemetry"
66

7-
import { Package } from "../shared/package"
87
import { getCommand } from "../utils/commands"
98
import { ClineProvider } from "../core/webview/ClineProvider"
109
import type { WebviewFocusTracker } from "../core/webview/WebviewFocusTracker"
@@ -14,7 +13,6 @@ import { handleNewTask } from "./handleTask"
1413
import { importSettingsWithFeedback } from "../core/config/importExport"
1514
import { MdmService } from "../services/mdm/MdmService"
1615
import { registerRipgrepDiagnosticCommand } from "../services/ripgrep/diagnostic"
17-
import { t } from "../i18n"
1816

1917
/**
2018
* Helper to get the visible ClineProvider instance or log if not found.
@@ -239,7 +237,7 @@ export const openClineInNewTab = async ({ context, outputChannel, webviewFocusTr
239237
let mdmService: MdmService | undefined
240238
try {
241239
mdmService = MdmService.getInstance()
242-
} catch (error) {
240+
} catch {
243241
// MDM service not initialized, which is fine - extension can work without it
244242
mdmService = undefined
245243
}

‎src/api/providers/__tests__/anthropic-vertex.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ describe("VertexHandler", () => {
626626
vertexRegion: "us-central1",
627627
})
628628

629-
const mockCreate = vitest.fn().mockImplementation(async (options) =>
629+
const mockCreate = vitest.fn().mockImplementation(async (_options) =>
630630
asyncStreamFrom([
631631
{
632632
type: "message_start",
@@ -675,7 +675,7 @@ describe("VertexHandler", () => {
675675
]
676676

677677
const stream = handler.createMessage(systemPrompt, messagesWithReasoning)
678-
const chunks = await collectStream(stream)
678+
await collectStream(stream)
679679

680680
// Verify the API was called with filtered messages (no reasoning blocks)
681681
const calledMessages = mockCreate.mock.calls[0][0].messages
@@ -702,7 +702,7 @@ describe("VertexHandler", () => {
702702
vertexRegion: "us-central1",
703703
})
704704

705-
const mockCreate = vitest.fn().mockImplementation(async (options) =>
705+
const mockCreate = vitest.fn().mockImplementation(async (_options) =>
706706
asyncStreamFrom([
707707
{
708708
type: "message_start",
@@ -739,7 +739,7 @@ describe("VertexHandler", () => {
739739
]
740740

741741
const stream = handler.createMessage(systemPrompt, messagesWithOnlyReasoning)
742-
const chunks = await collectStream(stream)
742+
await collectStream(stream)
743743

744744
// Verify empty message was filtered out
745745
const calledMessages = mockCreate.mock.calls[0][0].messages

‎src/api/providers/__tests__/anthropic.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ describe("AnthropicHandler", () => {
10961096
]
10971097

10981098
const stream = handler.createMessage(systemPrompt, messagesWithReasoning)
1099-
const chunks: any[] = await collectStream(stream)
1099+
await collectStream(stream)
11001100

11011101
// Verify the API was called with filtered messages (no reasoning blocks)
11021102
const calledMessages = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0].messages
@@ -1139,7 +1139,7 @@ describe("AnthropicHandler", () => {
11391139
]
11401140

11411141
const stream = handler.createMessage(systemPrompt, messagesWithOnlyReasoning)
1142-
const chunks: any[] = await collectStream(stream)
1142+
await collectStream(stream)
11431143

11441144
// Verify empty message was filtered out
11451145
const calledMessages = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0].messages

‎src/api/providers/__tests__/base-openai-compatible-provider.spec.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// npx vitest run api/providers/__tests__/base-openai-compatible-provider.spec.ts
22

33
import { Anthropic } from "@anthropic-ai/sdk"
4-
import OpenAI from "openai"
54

65
import { type ModelInfo, openAiModelInfoSaneDefaults } from "@roo-code/types"
76

‎src/api/providers/__tests__/bedrock-error-handling.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ describe("AwsBedrockHandler Error Handling", () => {
328328
for await (const chunk of generator) {
329329
chunks.push(chunk)
330330
}
331-
} catch (error) {
331+
} catch {
332332
// Expected to throw after yielding chunks
333333
}
334334

0 commit comments

Comments
 (0)