diff --git a/js/eslint.config.ts b/js/eslint.config.ts index d75d38091..34cc632c7 100644 --- a/js/eslint.config.ts +++ b/js/eslint.config.ts @@ -58,9 +58,8 @@ export default [ ...tseslint.configs.recommended.rules, // TODO: Fix violations and re-enable as "error" "@typescript-eslint/no-explicit-any": "warn", - // TODO: Fix violations and re-enable as "error" "@typescript-eslint/no-unused-vars": [ - "warn", + "error", { vars: "all", args: "none", diff --git a/js/src/cli/functions/upload.ts b/js/src/cli/functions/upload.ts index 78b11a4ac..841f24f5e 100644 --- a/js/src/cli/functions/upload.ts +++ b/js/src/cli/functions/upload.ts @@ -1,9 +1,6 @@ import { - CodeBundle as CodeBundleSchema, type CodeBundleType as CodeBundle, - Function as FunctionObjectSchema, type FunctionType as FunctionObject, - IfExists as IfExistsSchema, type IfExistsType as IfExists, } from "../../generated_types"; import type { BuildSuccess, EvaluatorState, FileHandle } from "../types"; diff --git a/js/src/cli/reporters/eval.ts b/js/src/cli/reporters/eval.ts index 82eebe716..f10c1fc17 100644 --- a/js/src/cli/reporters/eval.ts +++ b/js/src/cli/reporters/eval.ts @@ -152,7 +152,7 @@ function formatExperimentSummaryFancy(summary: ExperimentSummary) { borderStyle: "round", }) ); - } catch (error) { + } catch { return "\n" + chalk.gray("Experiment summary") + "\n" + boxContent + "\n"; } } diff --git a/js/src/cli/util/pull.ts b/js/src/cli/util/pull.ts index 91dbe3033..a6e5e7a79 100644 --- a/js/src/cli/util/pull.ts +++ b/js/src/cli/util/pull.ts @@ -1,9 +1,7 @@ import { Function as functionSchema, type FunctionType as FunctionObject, - SavedFunctionId as SavedFunctionIdSchema, type SavedFunctionIdType as SavedFunctionId, - ToolFunctionDefinition as ToolFunctionDefinitionSchema, type ToolFunctionDefinitionType as ToolFunctionDefinition, } from "../../generated_types"; import { _internalGetGlobalState } from "../../logger"; diff --git a/js/src/framework2.ts b/js/src/framework2.ts index 210a61c4f..898a17416 100644 --- a/js/src/framework2.ts +++ b/js/src/framework2.ts @@ -5,19 +5,14 @@ import { slugify } from "../util/string_util"; import { z } from "zod/v3"; import { type FunctionTypeEnumType as FunctionType, - IfExists as IfExistsSchema, type IfExistsType as IfExists, - SavedFunctionId as SavedFunctionIdSchema, type SavedFunctionIdType as SavedFunctionId, - PromptBlockData as PromptBlockDataSchema, type PromptBlockDataType as PromptBlockData, - PromptData as PromptDataSchema, type PromptDataType as PromptData, ToolFunctionDefinition as toolFunctionDefinitionSchema, type ToolFunctionDefinitionType as ToolFunctionDefinition, FunctionData as functionDataSchema, Project as projectSchema, - ExtendedSavedFunctionId as ExtendedSavedFunctionIdSchema, type ExtendedSavedFunctionIdType as ExtendedSavedFunctionId, } from "./generated_types"; import { loadPrettyXact, TransactionId } from "../util/index"; diff --git a/js/src/functions/stream.ts b/js/src/functions/stream.ts index 92421515b..43314c251 100644 --- a/js/src/functions/stream.ts +++ b/js/src/functions/stream.ts @@ -1,5 +1,4 @@ import { - CallEvent as CallEventSchemaImport, type CallEventType as CallEventSchema, CallEvent as callEventSchema, SSEConsoleEventData as sseConsoleEventDataSchema, diff --git a/js/src/gitutil.ts b/js/src/gitutil.ts index 5a62c5baf..8550e87b3 100644 --- a/js/src/gitutil.ts +++ b/js/src/gitutil.ts @@ -1,7 +1,5 @@ import { - GitMetadataSettings as GitMetadataSettingsSchema, type GitMetadataSettingsType as GitMetadataSettings, - RepoInfo as RepoInfoSchema, type RepoInfoType as RepoInfo, } from "./generated_types"; import { simpleGit } from "simple-git"; @@ -19,7 +17,7 @@ export async function currentRepo() { } else { return null; } - } catch (e) { + } catch { return null; } } @@ -95,7 +93,7 @@ async function getBaseBranchAncestor(remote: string | undefined = undefined) { `${remoteName}/${baseBranch}`, ]); return ancestor.trim(); - } catch (e) { + } catch { /* console.warn( `Warning: Could not find a common ancestor with ${remoteName}/${baseBranch}` @@ -133,7 +131,7 @@ export async function getPastNAncestors( async function attempt(fn: () => Promise): Promise { try { return await fn(); - } catch (e) { + } catch { return undefined; } } diff --git a/js/src/graph-framework.ts b/js/src/graph-framework.ts index 5c2671afb..f60ff3fba 100644 --- a/js/src/graph-framework.ts +++ b/js/src/graph-framework.ts @@ -1,14 +1,9 @@ import { newId, Prompt } from "./logger"; import { - FunctionId as FunctionIdSchema, type FunctionIdType as FunctionId, - GraphData as GraphDataSchema, type GraphDataType as GraphData, - GraphNode as GraphNodeSchema, type GraphNodeType as GraphNode, - GraphEdge as GraphEdgeSchema, type GraphEdgeType as GraphEdge, - PromptBlockData as PromptBlockDataSchema, type PromptBlockDataType as PromptBlockData, } from "./generated_types"; diff --git a/js/src/instrumentation/plugins/ai-sdk-plugin.ts b/js/src/instrumentation/plugins/ai-sdk-plugin.ts index c2f3535f4..4f362269f 100644 --- a/js/src/instrumentation/plugins/ai-sdk-plugin.ts +++ b/js/src/instrumentation/plugins/ai-sdk-plugin.ts @@ -1,9 +1,9 @@ import { tracingChannel } from "dc-browser"; import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core"; -import type { StartEvent, EndEvent, ErrorEvent } from "../core"; -import { startSpan, Attachment } from "../../logger"; +import type { StartEvent } from "../core"; +import { startSpan } from "../../logger"; import type { Span } from "../../logger"; -import { SpanTypeAttribute, isObject } from "../../../util/index"; +import { SpanTypeAttribute } from "../../../util/index"; import { getCurrentUnixTimestamp } from "../../util"; import { processInputAttachments } from "../../wrappers/attachment-utils"; diff --git a/js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts b/js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts index 5f3fdaca7..0e17b9e70 100644 --- a/js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts +++ b/js/src/instrumentation/plugins/claude-agent-sdk-plugin.ts @@ -3,9 +3,8 @@ import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core"; import type { StartEvent } from "../core"; import { startSpan } from "../../logger"; import type { Span } from "../../logger"; -import { SpanTypeAttribute, isObject } from "../../../util/index"; +import { SpanTypeAttribute } from "../../../util/index"; import { getCurrentUnixTimestamp } from "../../util"; -import { processInputAttachments } from "../../wrappers/attachment-utils"; import { extractAnthropicCacheTokens, finalizeAnthropicTokens, @@ -325,15 +324,6 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { return; } - const { - span, - startTime, - conversationHistory, - currentMessages, - currentMessageStartTime, - accumulatedOutputTokens, - } = spanData; - // Check if result is a stream if (isAsyncIterable(event.result)) { // Patch the stream to collect chunks and trace them @@ -357,7 +347,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { spanData.conversationHistory, options, spanData.currentMessageStartTime, - await span.export(), + await spanData.span.export(), ); if (finalMessage) { @@ -425,7 +415,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { result_metadata.session_id = message.session_id; } if (Object.keys(result_metadata).length > 0) { - span.log({ + spanData.span.log({ metadata: result_metadata, }); } @@ -447,7 +437,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { spanData.conversationHistory, options, spanData.currentMessageStartTime, - await span.export(), + await spanData.span.export(), ); if (finalMessage) { @@ -456,7 +446,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { } // Log final output to top-level span - just the last message content - span.log({ + spanData.span.log({ output: spanData.conversationHistory.length > 0 ? spanData.conversationHistory[ @@ -470,15 +460,15 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { error, ); } finally { - span.end(); + spanData.span.end(); spans.delete(event); } }, onError: (error: Error) => { - span.log({ + spanData.span.log({ error: error.message, }); - span.end(); + spanData.span.end(); spans.delete(event); }, }); @@ -487,7 +477,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { } else { // Non-streaming response (shouldn't happen for query, but handle gracefully) try { - span.log({ + spanData.span.log({ output: event.result, }); } catch (error) { @@ -496,7 +486,7 @@ export class ClaudeAgentSDKPlugin extends BasePlugin { error, ); } finally { - span.end(); + spanData.span.end(); spans.delete(event); } } diff --git a/js/src/instrumentation/plugins/google-genai-plugin.ts b/js/src/instrumentation/plugins/google-genai-plugin.ts index 184eb14a9..4642b07c7 100644 --- a/js/src/instrumentation/plugins/google-genai-plugin.ts +++ b/js/src/instrumentation/plugins/google-genai-plugin.ts @@ -3,7 +3,7 @@ import { BasePlugin, isAsyncIterable, patchStreamIfNeeded } from "../core"; import type { StartEvent } from "../core"; import { startSpan, Attachment } from "../../logger"; import type { Span } from "../../logger"; -import { SpanTypeAttribute, isObject } from "../../../util/index"; +import { SpanTypeAttribute } from "../../../util/index"; import { getCurrentUnixTimestamp } from "../../util"; /** diff --git a/js/src/instrumentation/plugins/openai-plugin.ts b/js/src/instrumentation/plugins/openai-plugin.ts index 81c97c770..970c8ce13 100644 --- a/js/src/instrumentation/plugins/openai-plugin.ts +++ b/js/src/instrumentation/plugins/openai-plugin.ts @@ -186,7 +186,7 @@ export class OpenAIPlugin extends BasePlugin { // Extract metadata - preserve response fields except usage and output if (response) { - const { usage, output, ...metadata } = response; + const { usage: _usage, output: _output, ...metadata } = response; if (Object.keys(metadata).length > 0) { data.metadata = metadata; } diff --git a/js/src/isomorph.ts b/js/src/isomorph.ts index 9b479eb52..fc5db582b 100644 --- a/js/src/isomorph.ts +++ b/js/src/isomorph.ts @@ -1,7 +1,5 @@ import { - GitMetadataSettings as GitMetadataSettingsSchema, type GitMetadataSettingsType as GitMetadataSettings, - RepoInfo as RepoInfoSchema, type RepoInfoType as RepoInfo, } from "./generated_types"; diff --git a/js/src/logger.ts b/js/src/logger.ts index c348056c0..50eaea3c3 100644 --- a/js/src/logger.ts +++ b/js/src/logger.ts @@ -121,7 +121,7 @@ import { SyncLazyValue, runCatchFinally, } from "./util"; -import { lintTemplate as lintMustacheTemplate } from "./template/mustache-utils"; +import { lintTemplate as _lintMustacheTemplate } from "./template/mustache-utils"; import { prettifyXact } from "../util/index"; import { SpanCache, CachedSpan } from "./span-cache"; import type { EvalParameters, InferParameters } from "./eval-parameters"; @@ -1046,7 +1046,7 @@ class HTTPConnection { try { const resp = await this.get("ping"); return resp.status === 200; - } catch (e) { + } catch { return false; } } diff --git a/js/src/queue.bench.ts b/js/src/queue.bench.ts index a5578e410..fe691e171 100644 --- a/js/src/queue.bench.ts +++ b/js/src/queue.bench.ts @@ -10,7 +10,6 @@ const partialData = Array.from({ length: 100 }, (_, i) => i); // Initialize queues once const fullQueue = new Queue(1000); const wrappedQueue = new Queue(1000); -const smallQueue = new Queue(50); const partialQueue = new Queue(1000); bench diff --git a/js/src/wrappers/ai-sdk/ai-sdk.ts b/js/src/wrappers/ai-sdk/ai-sdk.ts index e4527f9a4..d9e605ce1 100644 --- a/js/src/wrappers/ai-sdk/ai-sdk.ts +++ b/js/src/wrappers/ai-sdk/ai-sdk.ts @@ -1139,10 +1139,6 @@ const serializeError = (error: unknown) => { return String(error); }; -const serializeModel = (model: any) => { - return typeof model === "string" ? model : model?.modelId; -}; - /** * Parses a gateway model string like "openai/gpt-5-mini" into provider and model. * Returns { provider, model } if parseable, otherwise { model } only. diff --git a/js/src/wrappers/attachment-utils.ts b/js/src/wrappers/attachment-utils.ts index 0b40637f7..c4030304b 100644 --- a/js/src/wrappers/attachment-utils.ts +++ b/js/src/wrappers/attachment-utils.ts @@ -63,7 +63,7 @@ export function convertDataToBlob(data: any, mediaType: string): Blob | null { } else if (typeof Buffer !== "undefined" && data instanceof Buffer) { return new Blob([data as any], { type: mediaType }); } - } catch (error) { + } catch { // If conversion fails, return null return null; } diff --git a/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts b/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts index d1dfb7f31..ccf3fb4c8 100644 --- a/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts +++ b/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts @@ -20,35 +20,9 @@ type QueryOptions = { [key: string]: any; }; -type CallToolResult = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - content: Array; - isError?: boolean; -}; - -type ToolHandler = ( - args: T, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - extra: any, -) => Promise; - -type SdkMcpToolDefinition = { - name: string; - description: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - inputSchema: any; - handler: ToolHandler; -}; - /** * Hook types from @anthropic-ai/claude-agent-sdk */ -type HookEvent = - | "PreToolUse" - | "PostToolUse" - | "PostToolUseFailure" - | "SubagentStart" - | "SubagentStop"; type BaseHookInput = { session_id: string; diff --git a/js/src/wrappers/oai.ts b/js/src/wrappers/oai.ts index ae38c662c..08a639f32 100644 --- a/js/src/wrappers/oai.ts +++ b/js/src/wrappers/oai.ts @@ -367,7 +367,7 @@ function wrapChatCompletion< const { data: ret, response } = await completionResponse.withResponse(); logHeaders(response, span); - const { messages, ...rest } = params; + const { messages: _messages, ...rest } = params; span.log({ metadata: { ...rest, diff --git a/js/src/wrappers/oai_responses.ts b/js/src/wrappers/oai_responses.ts index 0a83c2505..4878e1e87 100644 --- a/js/src/wrappers/oai_responses.ts +++ b/js/src/wrappers/oai_responses.ts @@ -65,7 +65,7 @@ function parseEventFromResponseCreateResult(result: any) { // Extract metadata - preserve all response fields except output and usage if (result) { - const { output, usage, ...metadata } = result; + const { output: _output, usage: _usage, ...metadata } = result; if (Object.keys(metadata).length > 0) { data.metadata = metadata; } @@ -154,7 +154,7 @@ function parseEventFromResponseParseResult(result: any) { // Extract metadata - preserve all response fields except output and usage if (result) { - const { output, usage, ...metadata } = result; + const { output: _output, usage: _usage, ...metadata } = result; if (Object.keys(metadata).length > 0) { data.metadata = metadata; } @@ -214,7 +214,7 @@ function parseLogFromItem(item: any): {} { // Extract metadata - preserve response fields except usage and output if (response) { - const { usage, output, ...metadata } = response; + const { usage: _usage, output: _output, ...metadata } = response; if (Object.keys(metadata).length > 0) { data.metadata = metadata; } diff --git a/js/src/zod/zod-serialization-test-shared.ts b/js/src/zod/zod-serialization-test-shared.ts index 862bbe7e9..a78f4b708 100644 --- a/js/src/zod/zod-serialization-test-shared.ts +++ b/js/src/zod/zod-serialization-test-shared.ts @@ -1,4 +1,3 @@ -import { expect } from "vitest"; /** * Shared test expectations for zod serialization tests *