fix: clean up 49 unused variables, catch params, and stale imports (#22695)
This commit is contained in:
@@ -4,7 +4,6 @@ import { EffectBridge } from "@/effect/bridge"
|
||||
import { Log } from "../util/log"
|
||||
import { BusEvent } from "./bus-event"
|
||||
import { GlobalBus } from "./global"
|
||||
import { WorkspaceContext } from "@/control-plane/workspace-context"
|
||||
import { InstanceState } from "@/effect/instance-state"
|
||||
import { makeRuntime } from "@/effect/run-service"
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ export function Autocomplete(props: {
|
||||
|
||||
const position = createMemo(() => {
|
||||
if (!store.visible) return { x: 0, y: 0, width: 0 }
|
||||
const dims = dimensions()
|
||||
dimensions()
|
||||
positionTick()
|
||||
const anchor = props.anchor()
|
||||
const parent = anchor.parent
|
||||
|
||||
@@ -157,10 +157,10 @@ export function Session() {
|
||||
const [showThinking, setShowThinking] = kv.signal("thinking_visibility", true)
|
||||
const [timestamps, setTimestamps] = kv.signal<"hide" | "show">("timestamps", "hide")
|
||||
const [showDetails, setShowDetails] = kv.signal("tool_details_visibility", true)
|
||||
const [showAssistantMetadata, setShowAssistantMetadata] = kv.signal("assistant_metadata_visibility", true)
|
||||
const [showAssistantMetadata, _setShowAssistantMetadata] = kv.signal("assistant_metadata_visibility", true)
|
||||
const [showScrollbar, setShowScrollbar] = kv.signal("scrollbar_visible", false)
|
||||
const [diffWrapMode] = kv.signal<"word" | "none">("diff_wrap_mode", "word")
|
||||
const [animationsEnabled, setAnimationsEnabled] = kv.signal("animations_enabled", true)
|
||||
const [_animationsEnabled, _setAnimationsEnabled] = kv.signal("animations_enabled", true)
|
||||
const [showGenericToolOutput, setShowGenericToolOutput] = kv.signal("generic_tool_output_visibility", false)
|
||||
|
||||
const wide = createMemo(() => dimensions().width > 120)
|
||||
|
||||
@@ -599,7 +599,7 @@ function Prompt<const T extends Record<string, string>>(props: {
|
||||
})
|
||||
|
||||
const hint = createMemo(() => (store.expanded ? "minimize" : "fullscreen"))
|
||||
const renderer = useRenderer()
|
||||
useRenderer()
|
||||
|
||||
const content = () => (
|
||||
<box
|
||||
|
||||
@@ -59,7 +59,7 @@ export function SubagentFooter() {
|
||||
const keybind = useKeybind()
|
||||
const command = useCommandDialog()
|
||||
const [hover, setHover] = createSignal<"parent" | "prev" | "next" | null>(null)
|
||||
const dimensions = useTerminalDimensions()
|
||||
useTerminalDimensions()
|
||||
|
||||
return (
|
||||
<box flexShrink={0}>
|
||||
|
||||
@@ -43,8 +43,6 @@ export async function resolveNetworkOptions(args: NetworkOptions) {
|
||||
const hostnameExplicitlySet = process.argv.includes("--hostname")
|
||||
const mdnsExplicitlySet = process.argv.includes("--mdns")
|
||||
const mdnsDomainExplicitlySet = process.argv.includes("--mdns-domain")
|
||||
const corsExplicitlySet = process.argv.includes("--cors")
|
||||
|
||||
const mdns = mdnsExplicitlySet ? args.mdns : (config?.server?.mdns ?? args.mdns)
|
||||
const mdnsDomain = mdnsDomainExplicitlySet ? args["mdns-domain"] : (config?.server?.mdnsDomain ?? args["mdns-domain"])
|
||||
const port = portExplicitlySet ? args.port : (config?.server?.port ?? args.port)
|
||||
|
||||
@@ -8,13 +8,10 @@ import z from "zod"
|
||||
import { Config } from "../config"
|
||||
import { MCP } from "../mcp"
|
||||
import { Skill } from "../skill"
|
||||
import { Log } from "../util/log"
|
||||
import PROMPT_INITIALIZE from "./template/initialize.txt"
|
||||
import PROMPT_REVIEW from "./template/review.txt"
|
||||
|
||||
export namespace Command {
|
||||
const log = Log.create({ service: "command" })
|
||||
|
||||
type State = {
|
||||
commands: Record<string, Info>
|
||||
}
|
||||
|
||||
@@ -1095,7 +1095,7 @@ function patchJsonc(input: string, patch: unknown, path: string[] = []): string
|
||||
}
|
||||
|
||||
function writable(info: Info) {
|
||||
const { plugin_origins, ...next } = info
|
||||
const { plugin_origins: _plugin_origins, ...next } = info
|
||||
return next
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ export namespace Workspace {
|
||||
try {
|
||||
const adaptor = await getAdaptor(info.projectID, row.type)
|
||||
await adaptor.remove(info)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
log.error("adaptor not available when removing workspace", { type: row.type })
|
||||
}
|
||||
Database.use((db) => db.delete(WorkspaceTable).where(eq(WorkspaceTable.id, id)).run())
|
||||
@@ -404,7 +404,7 @@ export namespace Workspace {
|
||||
return synced(state)
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
} catch {
|
||||
if (signal?.aborted) throw signal.reason ?? new Error("Request aborted")
|
||||
throw new Error(`Timed out waiting for sync fence: ${JSON.stringify(state)}`)
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ export namespace McpOAuthCallback {
|
||||
log.info("oauth callback server stopped")
|
||||
}
|
||||
|
||||
for (const [name, pending] of pendingAuths) {
|
||||
for (const [_name, pending] of pendingAuths) {
|
||||
clearTimeout(pending.timeout)
|
||||
pending.reject(new Error("OAuth callback server stopped"))
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export function parse(headers: Headers) {
|
||||
|
||||
try {
|
||||
data = JSON.parse(raw)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ import { AppFileSystem } from "@opencode-ai/shared/filesystem"
|
||||
|
||||
type Rule = { method?: string; path: string; exact?: boolean; action: "local" | "forward" }
|
||||
|
||||
const OPENCODE_WORKSPACE = process.env.OPENCODE_WORKSPACE
|
||||
|
||||
const RULES: Array<Rule> = [
|
||||
{ path: "/session/status", action: "forward" },
|
||||
{ method: "GET", path: "/session", action: "local" },
|
||||
|
||||
@@ -10,11 +10,8 @@ import { AppRuntime } from "../../effect/app-runtime"
|
||||
import { mapValues } from "remeda"
|
||||
import { errors } from "../error"
|
||||
import { lazy } from "../../util/lazy"
|
||||
import { Log } from "../../util/log"
|
||||
import { Effect } from "effect"
|
||||
|
||||
const log = Log.create({ service: "server" })
|
||||
|
||||
export const ProviderRoutes = lazy(() =>
|
||||
new Hono()
|
||||
.get(
|
||||
|
||||
@@ -1825,7 +1825,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
|
||||
onSuccess: (output: unknown) => void
|
||||
}): AITool {
|
||||
// Remove $schema property if present (not needed for tool input)
|
||||
const { $schema, ...toolSchema } = input.schema
|
||||
const { $schema: _, ...toolSchema } = input.schema
|
||||
|
||||
return tool({
|
||||
id: "StructuredOutput" as any,
|
||||
|
||||
@@ -176,7 +176,7 @@ export namespace ToolRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
const cfg = yield* config.get()
|
||||
yield* config.get()
|
||||
const questionEnabled =
|
||||
["app", "cli", "desktop"].includes(Flag.OPENCODE_CLIENT) || Flag.OPENCODE_ENABLE_QUESTION_TOOL
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ describe("file/index Filesystem patterns", () => {
|
||||
|
||||
test("returns empty array buffer on error for images", async () => {
|
||||
await using tmp = await tmpdir()
|
||||
const filepath = path.join(tmp.path, "broken.png")
|
||||
const _filepath = path.join(tmp.path, "broken.png")
|
||||
// Don't create the file
|
||||
|
||||
await Instance.provide({
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Simple JSON-RPC 2.0 LSP-like fake server over stdio
|
||||
// Implements a minimal LSP handshake and triggers a request upon notification
|
||||
|
||||
const net = require("net")
|
||||
|
||||
let nextId = 1
|
||||
|
||||
function encode(message) {
|
||||
|
||||
@@ -2,8 +2,6 @@ import { describe, expect, test } from "bun:test"
|
||||
import { ProviderTransform } from "../../src/provider/transform"
|
||||
import { ModelID, ProviderID } from "../../src/provider/schema"
|
||||
|
||||
const OUTPUT_TOKEN_MAX = 32000
|
||||
|
||||
describe("ProviderTransform.options - setCacheKey", () => {
|
||||
const sessionID = "test-session-123"
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ describe("session.list", () => {
|
||||
await Instance.provide({
|
||||
directory: tmp.path,
|
||||
fn: async () => {
|
||||
const session = await svc.create({ title: "new-session" })
|
||||
await svc.create({ title: "new-session" })
|
||||
const futureStart = Date.now() + 86400000
|
||||
|
||||
const sessions = [...svc.list({ start: futureStart })]
|
||||
|
||||
@@ -1181,7 +1181,6 @@ describe("session.llm.stream", () => {
|
||||
const providerID = "google"
|
||||
const modelID = "gemini-2.5-flash"
|
||||
const fixture = await loadFixture(providerID, modelID)
|
||||
const provider = fixture.provider
|
||||
const model = fixture.model
|
||||
const pathSuffix = `/v1beta/models/${model.id}:streamGenerateContent`
|
||||
|
||||
|
||||
@@ -724,7 +724,7 @@ describe("MessageV2.filterCompacted", () => {
|
||||
|
||||
const u1 = await addUser(session.id, "hello")
|
||||
await addCompactionPart(session.id, u1)
|
||||
const u2 = await addUser(session.id, "world")
|
||||
await addUser(session.id, "world")
|
||||
|
||||
const result = MessageV2.filterCompacted(MessageV2.stream(session.id))
|
||||
expect(result).toHaveLength(2)
|
||||
@@ -748,7 +748,7 @@ describe("MessageV2.filterCompacted", () => {
|
||||
isRetryable: true,
|
||||
}).toObject() as MessageV2.Assistant["error"]
|
||||
await addAssistant(session.id, u1, { summary: true, finish: "end_turn", error })
|
||||
const u2 = await addUser(session.id, "retry")
|
||||
await addUser(session.id, "retry")
|
||||
|
||||
const result = MessageV2.filterCompacted(MessageV2.stream(session.id))
|
||||
// Error assistant doesn't add to completed, so compaction boundary never triggers
|
||||
@@ -770,7 +770,7 @@ describe("MessageV2.filterCompacted", () => {
|
||||
|
||||
// summary=true but no finish
|
||||
await addAssistant(session.id, u1, { summary: true })
|
||||
const u2 = await addUser(session.id, "next")
|
||||
await addUser(session.id, "next")
|
||||
|
||||
const result = MessageV2.filterCompacted(MessageV2.stream(session.id))
|
||||
expect(result).toHaveLength(3)
|
||||
@@ -892,7 +892,7 @@ describe("MessageV2 consistency", () => {
|
||||
directory: root,
|
||||
fn: async () => {
|
||||
const session = await svc.create({})
|
||||
const ids = await fill(session.id, 4)
|
||||
await fill(session.id, 4)
|
||||
|
||||
const filtered = MessageV2.filterCompacted(MessageV2.stream(session.id))
|
||||
const all = Array.from(MessageV2.stream(session.id)).reverse()
|
||||
|
||||
Reference in New Issue
Block a user