mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
Fix linting errors in a number of core and tool files (partial)
- As part of this work I also started building out errors.ts which will be a cumulation of error helpers to better handle the challenging `catch (error: unknown)` requirement. - More changes are to come, this is truly a partial change in order to not disrupt as many people as possible. Part of https://b.corp.google.com/issues/411384603
This commit is contained in:
parent
93fd6a9160
commit
7cd3b95317
9 changed files with 62 additions and 62 deletions
|
|
@ -20,16 +20,11 @@ export interface GlobToolParams {
|
|||
path?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result from the GlobTool
|
||||
*/
|
||||
export interface GlobToolResult extends ToolResult {}
|
||||
|
||||
/**
|
||||
* Implementation of the GlobTool that finds files matching patterns,
|
||||
* sorted by modification time (newest first).
|
||||
*/
|
||||
export class GlobTool extends BaseTool<GlobToolParams, GlobToolResult> {
|
||||
export class GlobTool extends BaseTool<GlobToolParams, ToolResult> {
|
||||
/**
|
||||
* The root directory that this tool is grounded in.
|
||||
* All file operations will be restricted to this directory.
|
||||
|
|
@ -125,9 +120,9 @@ export class GlobTool extends BaseTool<GlobToolParams, GlobToolResult> {
|
|||
if (!fs.statSync(searchDirAbsolute).isDirectory()) {
|
||||
return `Search path is not a directory: ${shortenPath(makeRelative(searchDirAbsolute, this.rootDirectory))} (absolute: ${searchDirAbsolute})`;
|
||||
}
|
||||
} catch (e: any) {
|
||||
} catch (e: unknown) {
|
||||
// Catch potential permission errors during sync checks
|
||||
return `Error accessing search path: ${e.message}`;
|
||||
return `Error accessing search path: ${e}`;
|
||||
}
|
||||
|
||||
// Validate glob pattern (basic non-empty check)
|
||||
|
|
@ -165,7 +160,7 @@ export class GlobTool extends BaseTool<GlobToolParams, GlobToolResult> {
|
|||
* @param params Parameters for the glob search
|
||||
* @returns Result of the glob search
|
||||
*/
|
||||
async execute(params: GlobToolParams): Promise<GlobToolResult> {
|
||||
async execute(params: GlobToolParams): Promise<ToolResult> {
|
||||
const validationError = this.invalidParams(params);
|
||||
if (validationError) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue