Skip to content

Commit ab648c1

Browse files
committed
Fix lint errors in file_list implementation
- Remove unused FileListToolArgs import - Remove unused 'err' variables in catch blocks - Replace {} as any with proper AbortController signal in tests
1 parent 50c143f commit ab648c1

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/services/tools/file_list.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("file_list tool", () => {
3131
{
3232
path: ".",
3333
},
34-
{} as any
34+
{ abortSignal: new AbortController().signal }
3535
)) as Extract<FileListToolResult, { success: true }>;
3636

3737
expect(result.success).toBe(true);
@@ -58,7 +58,7 @@ describe("file_list tool", () => {
5858
path: ".",
5959
max_depth: 2,
6060
},
61-
{} as any
61+
{ abortSignal: new AbortController().signal }
6262
)) as Extract<FileListToolResult, { success: true }>;
6363

6464
expect(result.success).toBe(true);
@@ -80,7 +80,7 @@ describe("file_list tool", () => {
8080
{
8181
path: ".",
8282
},
83-
{} as any
83+
{ abortSignal: new AbortController().signal }
8484
)) as Extract<FileListToolResult, { success: true }>;
8585

8686
expect(result.success).toBe(true);
@@ -92,7 +92,7 @@ describe("file_list tool", () => {
9292
{
9393
path: ".",
9494
},
95-
{} as any
95+
{ abortSignal: new AbortController().signal }
9696
)) as Extract<FileListToolResult, { success: true }>;
9797

9898
expect(result.success).toBe(true);
@@ -112,7 +112,7 @@ describe("file_list tool", () => {
112112
path: ".",
113113
pattern: "*.ts",
114114
},
115-
{} as any
115+
{ abortSignal: new AbortController().signal }
116116
)) as Extract<FileListToolResult, { success: true }>;
117117

118118
expect(result.success).toBe(true);
@@ -133,7 +133,7 @@ describe("file_list tool", () => {
133133
pattern: "*.ts",
134134
max_depth: 2,
135135
},
136-
{} as any
136+
{ abortSignal: new AbortController().signal }
137137
)) as Extract<FileListToolResult, { success: true }>;
138138

139139
expect(result.success).toBe(true);
@@ -158,7 +158,7 @@ describe("file_list tool", () => {
158158
{
159159
path: ".",
160160
},
161-
{} as any
161+
{ abortSignal: new AbortController().signal }
162162
)) as Extract<FileListToolResult, { success: true }>;
163163

164164
expect(result.success).toBe(true);
@@ -179,7 +179,7 @@ describe("file_list tool", () => {
179179
path: ".",
180180
gitignore: false,
181181
},
182-
{} as any
182+
{ abortSignal: new AbortController().signal }
183183
)) as Extract<FileListToolResult, { success: true }>;
184184

185185
expect(result.success).toBe(true);
@@ -196,7 +196,7 @@ describe("file_list tool", () => {
196196
path: ".",
197197
gitignore: false,
198198
},
199-
{} as any
199+
{ abortSignal: new AbortController().signal }
200200
)) as Extract<FileListToolResult, { success: true }>;
201201

202202
expect(result.success).toBe(true);
@@ -212,7 +212,7 @@ describe("file_list tool", () => {
212212
{
213213
path: ".",
214214
},
215-
{} as any
215+
{ abortSignal: new AbortController().signal }
216216
)) as Extract<FileListToolResult, { success: true }>;
217217

218218
expect(result.success).toBe(true);
@@ -232,7 +232,7 @@ describe("file_list tool", () => {
232232
{
233233
path: ".",
234234
},
235-
{} as any
235+
{ abortSignal: new AbortController().signal }
236236
)) as Extract<FileListToolResult, { success: false }>;
237237

238238
expect(result.success).toBe(false);
@@ -251,7 +251,7 @@ describe("file_list tool", () => {
251251
path: ".",
252252
max_entries: 10,
253253
},
254-
{} as any
254+
{ abortSignal: new AbortController().signal }
255255
)) as Extract<FileListToolResult, { success: false }>;
256256

257257
expect(result.success).toBe(false);
@@ -268,7 +268,7 @@ describe("file_list tool", () => {
268268
path: ".",
269269
max_entries: 200, // Try to exceed hard cap
270270
},
271-
{} as any
271+
{ abortSignal: new AbortController().signal }
272272
)) as Extract<FileListToolResult, { success: true }>;
273273

274274
expect(result.success).toBe(true);
@@ -282,7 +282,7 @@ describe("file_list tool", () => {
282282
{
283283
path: "nonexistent",
284284
},
285-
{} as any
285+
{ abortSignal: new AbortController().signal }
286286
)) as Extract<FileListToolResult, { success: false }>;
287287

288288
expect(result.success).toBe(false);
@@ -296,7 +296,7 @@ describe("file_list tool", () => {
296296
{
297297
path: "file.txt",
298298
},
299-
{} as any
299+
{ abortSignal: new AbortController().signal }
300300
)) as Extract<FileListToolResult, { success: false }>;
301301

302302
expect(result.success).toBe(false);
@@ -308,7 +308,7 @@ describe("file_list tool", () => {
308308
{
309309
path: "..",
310310
},
311-
{} as any
311+
{ abortSignal: new AbortController().signal }
312312
)) as Extract<FileListToolResult, { success: false }>;
313313

314314
expect(result.success).toBe(false);
@@ -331,7 +331,7 @@ describe("file_list tool", () => {
331331
path: ".",
332332
max_depth: 15, // Try to exceed max
333333
},
334-
{} as any
334+
{ abortSignal: new AbortController().signal }
335335
)) as Extract<FileListToolResult, { success: true }>;
336336

337337
expect(result.success).toBe(true);
@@ -348,7 +348,7 @@ describe("file_list tool", () => {
348348
path: ".",
349349
max_depth: 1,
350350
},
351-
{} as any
351+
{ abortSignal: new AbortController().signal }
352352
)) as Extract<FileListToolResult, { success: true }>;
353353

354354
expect(result.success).toBe(true);

src/services/tools/file_list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fs from "fs/promises";
33
import * as path from "path";
44
import { minimatch } from "minimatch";
55
import ignore from "ignore";
6-
import type { FileEntry, FileListToolArgs, FileListToolResult } from "@/types/tools";
6+
import type { FileEntry, FileListToolResult } from "@/types/tools";
77
import { TOOL_DEFINITIONS } from "@/utils/tools/toolDefinitions";
88
import { validatePathInCwd } from "./fileCommon";
99
import {
@@ -81,7 +81,7 @@ export function createFileListTool(config: { cwd: string }) {
8181
let stats;
8282
try {
8383
stats = await fs.stat(resolvedPath);
84-
} catch (err) {
84+
} catch {
8585
return {
8686
success: false,
8787
error: `Path does not exist: ${targetPath}`,
@@ -131,7 +131,7 @@ export function createFileListTool(config: { cwd: string }) {
131131
let dirents;
132132
try {
133133
dirents = await fs.readdir(dir, { withFileTypes: true });
134-
} catch (err) {
134+
} catch {
135135
// If we can't read the directory (permissions, etc.), skip it
136136
return { entries: [], totalCount: currentCount.value, exceeded: false };
137137
}

0 commit comments

Comments
 (0)