fix(lint): resolve typescript strict typing errors and unused variables
swadhinbiswas committed 3 months ago
e800281
1 parent e00f76e
commit e800281
8 files changed
+14 -14
Showing 8 changed files+14-14
▼scripts/ai-review.ts
+7-8
| @@ -1,7 +1,6 @@ | ||
1 | 1 | import { execSync } from 'child_process'; |
2 | 2 | import { Mistral } from '@mistralai/mistralai'; |
3 | 3 | import { GoogleGenAI } from '@google/genai'; |
4 | -import type { Interactions } from '@google/genai'; | |
5 | 4 | import dotenv from 'dotenv'; |
6 | 5 | |
7 | 6 | dotenv.config(); |
| @@ -61,15 +60,15 @@ ${diff} | ||
61 | 60 | if (AGENT_API_KEY) { |
62 | 61 | console.log("Requesting review from Mistral Agent..."); |
63 | 62 | const client = new Mistral({ apiKey: AGENT_API_KEY }); |
64 | - const messages = [{ "role": "user", "content": prompt }]; | |
63 | + const messages = [{ "role": "user" as const, "content": prompt }]; | |
65 | 64 | |
66 | 65 | const response = await client.beta.conversations.start({ |
67 | 66 | agentId: 'ag_019f4ae0eb2e764aaa3f1dec318fc748', |
68 | 67 | agentVersion: 0, |
69 | - inputs: messages, | |
68 | + inputs: messages as any, | |
70 | 69 | }); |
71 | 70 | |
72 | - reviewComment = response?.choices?.[0]?.message?.content || response?.message?.content || ""; | |
71 | + reviewComment = (response as any)?.choices?.[0]?.message?.content || (response as any)?.message?.content || ""; | |
73 | 72 | |
74 | 73 | if (!reviewComment) { |
75 | 74 | console.log("Could not find standard content in response. Fallback to full response."); |
| @@ -80,7 +79,7 @@ ${diff} | ||
80 | 79 | } else if (GEMINI_API_KEY) { |
81 | 80 | console.log("Requesting review from Gemini 3.5 Flash..."); |
82 | 81 | const ai = new GoogleGenAI({ apiKey: GEMINI_API_KEY }); |
83 | - const tools: Interactions.Tool[] = [{ type: 'google_search' }]; | |
82 | + const tools: any[] = [{ type: 'google_search' }]; | |
84 | 83 | |
85 | 84 | // Fixed config: Using camelCase and nested thinkingConfig |
86 | 85 | const generationConfig = { |
| @@ -92,11 +91,11 @@ ${diff} | ||
92 | 91 | model: 'models/gemini-3.5-flash', |
93 | 92 | input: prompt, |
94 | 93 | tools: tools, |
95 | - generation_config: generationConfig, // the sdk still expects the property to be named generation_config | |
96 | - }); | |
94 | + generation_config: generationConfig as any, // the sdk still expects the property to be named generation_config | |
95 | + } as any); | |
97 | 96 | |
98 | 97 | const step = interaction.steps?.at(-1); |
99 | - reviewComment = step?.text || step?.parts?.[0]?.text || ""; | |
98 | + reviewComment = (step as any)?.text || (step as any)?.parts?.[0]?.text || ""; | |
100 | 99 | |
101 | 100 | if (!reviewComment) { |
102 | 101 | console.error("No content received from Gemini."); |
103 | 102 | |
▼scripts/reset-database.cjs
+1-0
| @@ -30,6 +30,7 @@ async function resetDatabase() { | ||
30 | 30 | |
31 | 31 | const sql = postgres(connectionString, { max: 1 }); |
32 | 32 | const db = drizzle(sql); |
33 | + void db; | |
33 | 34 | |
34 | 35 | try { |
35 | 36 | // Get all tables |
36 | 37 | |
▼scripts/security/audit.mjs
+1-1
| @@ -15,7 +15,7 @@ | ||
15 | 15 | * 1 — fail (disallowed high/critical vulnerability present) |
16 | 16 | * 2 — script error |
17 | 17 | */ |
18 | -import { existsSync, readFileSync, statSync, copyFileSync, mkdtempSync, rmSync, copyFileSync as copyFileSyncEsm } from "node:fs"; | |
18 | +import { existsSync, readFileSync, statSync, copyFileSync, mkdtempSync, rmSync } from "node:fs"; | |
19 | 19 | import { resolve, join } from "node:path"; |
20 | 20 | import { tmpdir } from "node:os"; |
21 | 21 | import { spawnSync } from "node:child_process"; |
22 | 22 | |
▼scripts/test-storage-config.ts
+1-1
| @@ -1,5 +1,5 @@ | ||
1 | 1 | |
2 | -import { getStorage, getStorageConfig, resetStorage } from "../src/lib/storage"; | |
2 | +import { getStorage, getStorageConfig } from "../src/lib/storage"; | |
3 | 3 | |
4 | 4 | async function main() { |
5 | 5 | console.log("--- Testing Storage Configuration ---"); |
6 | 6 | |
▼scripts/worker.ts
+1-1
| @@ -5,7 +5,7 @@ import { logger } from "@/lib/logger"; | ||
5 | 5 | import { syncAllMirrors } from "@/lib/mirror-sync"; |
6 | 6 | import { queueWorker } from "@/lib/queue-worker"; |
7 | 7 | import { runDueDigests } from "@/lib/chat-notifications"; |
8 | -import { and, eq, lt } from "drizzle-orm"; | |
8 | +import { eq } from "drizzle-orm"; | |
9 | 9 | import { createServer } from "http"; |
10 | 10 | |
11 | 11 | // ── Configuration ───────────────────────────────────────────────────────────── |
12 | 12 | |
▼src/pages/settings/ai-review-rules.astro
+1-1
| @@ -1,7 +1,7 @@ | ||
1 | 1 | --- |
2 | 2 | import BaseLayout from "@/layouts/BaseLayout.astro"; |
3 | 3 | import { getDatabase, schema } from "@/db"; |
4 | -import { eq, and, desc } from "drizzle-orm"; | |
4 | +import { eq, desc } from "drizzle-orm"; | |
5 | 5 | import { |
6 | 6 | Bot, |
7 | 7 | Plus, |
8 | 8 | |
▼src/runner/executor.ts
+1-1
| @@ -202,7 +202,7 @@ export class Executor { | ||
202 | 202 | let container: Docker.Container | null = null; |
203 | 203 | |
204 | 204 | const logStream = new Writable({ |
205 | - write: (chunk, encoding, callback) => { | |
205 | + write: (chunk, _encoding, callback) => { | |
206 | 206 | const chunkStr = chunk.toString(); |
207 | 207 | const redactedChunk = this.redactSecrets(chunkStr); |
208 | 208 | |
209 | 209 | |
▼src/runner/index.ts
+1-1
| @@ -2,7 +2,7 @@ | ||
2 | 2 | import { RunnerClient } from './client'; |
3 | 3 | import { Executor } from './executor'; |
4 | 4 | import pino from 'pino'; |
5 | -import path from 'node:path'; | |
5 | + | |
6 | 6 | import os from 'node:os'; |
7 | 7 | |
8 | 8 | const logger = pino({ |
9 | 9 | |