diff --git a/js/eslint.config.ts b/js/eslint.config.ts index b45d6ba6b..d2484fef2 100644 --- a/js/eslint.config.ts +++ b/js/eslint.config.ts @@ -77,13 +77,10 @@ export default [ "warn", { assertionStyle: "never" }, ], - // TODO: Fix violations and re-enable as "error" - "no-unused-expressions": ["warn", { allowShortCircuit: true }], + "no-unused-expressions": ["error", { allowShortCircuit: true }], "@typescript-eslint/no-unused-expressions": "off", - // TODO: Fix violations and re-enable as "error" - "@typescript-eslint/no-empty-object-type": "warn", - // TODO: Fix violations and re-enable as "error" - "@typescript-eslint/no-unsafe-function-type": "warn", + "@typescript-eslint/no-empty-object-type": "error", + "@typescript-eslint/no-unsafe-function-type": "error", "@typescript-eslint/prefer-as-const": "error", // Require node: protocol for Node.js built-in imports (for Deno compatibility) // This plugin automatically detects ALL Node.js built-ins - no manual list needed! @@ -149,16 +146,5 @@ export default [ plugins: { "@typescript-eslint": tseslint, }, - rules: { - // TODO: Fix violations and re-enable as "error" - "no-restricted-syntax": [ - "warn", - { - selector: "ExportAllDeclaration[exported=null]", - message: - "Bare 'export *' is forbidden in entry point files. Use explicit named exports instead for better tree-shaking and clarity.", - }, - ], - }, }, ]; diff --git a/js/src/instrumentation/core/types.ts b/js/src/instrumentation/core/types.ts index e58abaccd..885c83352 100644 --- a/js/src/instrumentation/core/types.ts +++ b/js/src/instrumentation/core/types.ts @@ -74,14 +74,14 @@ export interface ErrorEvent extends BaseContext { * Event emitted when a promise begins to settle. * This fires after the synchronous portion and when the async continuation starts. */ -export interface AsyncStartEvent extends StartEvent {} +export type AsyncStartEvent = StartEvent; /** * Event emitted when a promise finishes settling. * This fires BEFORE control returns to user code after await. * This is where you should extract output data and finalize spans. */ -export interface AsyncEndEvent extends EndEvent {} +export type AsyncEndEvent = EndEvent; /** * Subscription handlers for a TracingChannel. diff --git a/js/src/logger.ts b/js/src/logger.ts index 0533ca85c..0ec16aa69 100644 --- a/js/src/logger.ts +++ b/js/src/logger.ts @@ -6503,6 +6503,7 @@ export class SpanImpl implements Span { default: { // trigger a compile-time error if we add a new object type const _exhaustive: never = this.parentObjectType; + // eslint-disable-next-line no-unused-expressions _exhaustive; return NOOP_SPAN_PERMALINK; } @@ -6944,7 +6945,8 @@ export type CompiledPrompt = ? ChatPrompt : Flavor extends "completion" ? CompletionPrompt - : {}); + : // eslint-disable-next-line @typescript-eslint/no-empty-object-type + {}); export type DefaultPromptArgs = Partial< CompiledPromptParams & AnyModelParam & ChatPrompt & CompletionPrompt 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 ccf3fb4c8..d48923342 100644 --- a/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts +++ b/js/src/wrappers/claude-agent-sdk/claude-agent-sdk.ts @@ -981,13 +981,13 @@ export function wrapClaudeAgentSDK(sdk: T): T { // Tool tracing is now handled via PreToolUse/PostToolUse hooks injected in wrapClaudeAgentQuery. // We just pass through the original tool function - no need to wrap it. if (prop === "tool" && typeof value === "function") { - const bound = (value as Function).bind(target); + const bound = value.bind(target); cache.set(prop, bound); return bound; } if (typeof value === "function") { - const bound = (value as Function).bind(target); + const bound = value.bind(target); cache.set(prop, bound); return bound; } diff --git a/js/src/wrappers/oai_responses.ts b/js/src/wrappers/oai_responses.ts index 4878e1e87..d5b707895 100644 --- a/js/src/wrappers/oai_responses.ts +++ b/js/src/wrappers/oai_responses.ts @@ -198,7 +198,7 @@ function traceResponseCreateStream( }; } -function parseLogFromItem(item: any): {} { +function parseLogFromItem(item: any): Record { if (!item || !item?.type || !item?.response) { return {}; } @@ -323,7 +323,7 @@ export function parseMetricsFromUsage(usage: unknown): Record { } type ParamsToSpanFunc = (params: any) => TimedSpan; -type ResultToEventFunc = (result: any) => {}; +type ResultToEventFunc = (result: any) => Record; type TraceStreamFunc = (stream: AsyncIterator, span: TimedSpan) => void; type CreateProxyHooks = {