Skip to content

Commit 7471c8b

Browse files
op7418claude
andcommitted
fix: resolve all ESLint errors blocking CI build
- require() imports: added eslint-disable-next-line for intentional dynamic imports (chat/route, ai-provider, conversation-engine, 6 builtin-tools lazy-loading try/catch patterns) - prefer-const: totalUsage changed to const (object mutated not reassigned) - unsafe Function type: changed to (...args: unknown[]) => unknown - misplaced any disable: moved to correct line in ai-provider 0 errors, 11 warnings remaining (warnings don't block CI). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 15ba536 commit 7471c8b

6 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/app/api/chat/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export async function POST(request: NextRequest) {
255255
// Load MCP servers for the predicted runtime:
256256
// - SDK Runtime: only needs servers with ${...} env placeholders (SDK loads the rest via settingSources)
257257
// - Native Runtime: needs ALL servers (it manages MCP connections independently)
258+
// eslint-disable-next-line @typescript-eslint/no-require-imports
258259
const { predictNativeRuntime } = require('@/lib/runtime') as typeof import('@/lib/runtime');
259260
const mcpServers = predictNativeRuntime(effectiveProviderId)
260261
? loadAllMcpServers()

src/lib/agent-loop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export function runAgentLoop(options: AgentLoopOptions): ReadableStream<string>
218218
emitEvent('session:start', { sessionId, model: modelId });
219219
onRuntimeStatusChange?.('streaming');
220220
let step = 0;
221-
let totalUsage: TokenUsage = { input_tokens: 0, output_tokens: 0 };
221+
const totalUsage: TokenUsage = { input_tokens: 0, output_tokens: 0 };
222222
let lastToolNames: string[] = []; // for doom loop detection
223223
let messages = historyMessages;
224224

src/lib/agent-tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function wrapWithPermissions(
119119
}
120120

121121
// Wrap execute with permission check
122-
const original = t as { description?: string; inputSchema?: unknown; execute?: Function };
122+
const original = t as { description?: string; inputSchema?: unknown; execute?: (...args: unknown[]) => unknown };
123123
wrapped[name] = tool({
124124
description: original.description || name,
125125
inputSchema: (original.inputSchema || z.object({})) as z.ZodType,

src/lib/ai-provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ function createLanguageModel(config: AiSdkConfig, isThirdPartyProxy: boolean): L
168168
}
169169

170170
case 'claude-code-compat': {
171+
// eslint-disable-next-line @typescript-eslint/no-require-imports
171172
const { createClaudeCodeCompatModel } = require('./claude-code-compat') as typeof import('./claude-code-compat');
172173
return createClaudeCodeCompatModel({
173174
apiKey: config.apiKey,
@@ -331,8 +332,8 @@ function applyMiddleware(
331332
if (middlewares.length === 0) return model;
332333

333334
// wrapLanguageModel expects LanguageModelV3, cast through any for union type compat
334-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
335335
return wrapLanguageModel({
336+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
336337
model: model as any,
337338
middleware: middlewares,
338339
}) as unknown as LanguageModel;

src/lib/bridge/conversation-engine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export async function processMessage(
213213
}
214214

215215
// Load MCP servers using shared runtime prediction (same logic as chat route)
216+
// eslint-disable-next-line @typescript-eslint/no-require-imports
216217
const { predictNativeRuntime } = require('../runtime') as typeof import('../runtime');
217218
const mcpServers = predictNativeRuntime(effectiveProviderId)
218219
? loadAllMcpServers()

src/lib/builtin-tools/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
5858

5959
// Notification tools — always available
6060
try {
61+
// eslint-disable-next-line @typescript-eslint/no-require-imports
6162
const { createNotificationTools, NOTIFICATION_SYSTEM_PROMPT } = require('./notification');
6263
groups.push({
6364
name: 'codepilot-notify',
@@ -69,6 +70,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
6970

7071
// Widget guidelines — keyword-gated
7172
try {
73+
// eslint-disable-next-line @typescript-eslint/no-require-imports
7274
const { createWidgetGuidelinesTools, WIDGET_SYSTEM_PROMPT } = require('./widget-guidelines');
7375
groups.push({
7476
name: 'codepilot-widget-guidelines',
@@ -80,6 +82,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
8082

8183
// Dashboard tools — keyword-gated
8284
try {
85+
// eslint-disable-next-line @typescript-eslint/no-require-imports
8386
const { createDashboardTools, DASHBOARD_SYSTEM_PROMPT } = require('./dashboard');
8487
groups.push({
8588
name: 'codepilot-dashboard',
@@ -91,6 +94,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
9194

9295
// Media tools — keyword-gated
9396
try {
97+
// eslint-disable-next-line @typescript-eslint/no-require-imports
9498
const { createMediaTools, MEDIA_SYSTEM_PROMPT } = require('./media');
9599
groups.push({
96100
name: 'codepilot-media',
@@ -103,6 +107,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
103107
// Memory search tools — workspace-gated
104108
if (options.workspacePath) {
105109
try {
110+
// eslint-disable-next-line @typescript-eslint/no-require-imports
106111
const { createMemorySearchTools, MEMORY_SEARCH_SYSTEM_PROMPT } = require('./memory-search');
107112
groups.push({
108113
name: 'codepilot-memory',
@@ -115,6 +120,7 @@ function getToolGroups(options: { workspacePath?: string }): BuiltinToolGroup[]
115120

116121
// CLI tools — keyword-gated
117122
try {
123+
// eslint-disable-next-line @typescript-eslint/no-require-imports
118124
const { createCliToolsTools, CLI_TOOLS_SYSTEM_PROMPT } = require('./cli-tools');
119125
groups.push({
120126
name: 'codepilot-cli-tools',

0 commit comments

Comments
 (0)