Unused error variables in catch block are not allowed (#24487)

This commit is contained in:
Alisa
2026-04-01 21:33:07 -07:00
committed by GitHub
parent 84936dc85d
commit 3344f6849c
92 changed files with 162 additions and 157 deletions

View File

@@ -43,7 +43,7 @@ export function runSyncCleanup() {
for (const fn of syncCleanupFunctions) {
try {
fn();
} catch (_) {
} catch {
// Ignore errors during cleanup.
}
}
@@ -67,7 +67,7 @@ export async function runExitCleanup() {
for (const fn of cleanupFunctions) {
try {
await fn();
} catch (_) {
} catch {
// Ignore errors during cleanup.
}
}
@@ -76,14 +76,14 @@ export async function runExitCleanup() {
// Close persistent browser sessions before disposing config
try {
await resetBrowserSession();
} catch (_) {
} catch {
// Ignore errors during browser cleanup
}
if (configForTelemetry) {
try {
await configForTelemetry.dispose();
} catch (_) {
} catch {
// Ignore errors during disposal
}
}
@@ -93,7 +93,7 @@ export async function runExitCleanup() {
if (configForTelemetry && isTelemetrySdkInitialized()) {
try {
await shutdownTelemetry(configForTelemetry);
} catch (_) {
} catch {
// Ignore errors during telemetry shutdown
}
}

View File

@@ -23,9 +23,9 @@ export const isGitHubRepository = (): boolean => {
const pattern = /github\.com/;
return pattern.test(remotes);
} catch (_error) {
} catch (error) {
// If any filesystem error occurs, assume not a git repo
debugLogger.debug(`Failed to get git remote:`, _error);
debugLogger.debug(`Failed to get git remote:`, error);
return false;
}
};
@@ -85,10 +85,10 @@ export const getLatestGitHubRelease = async (
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return releaseTag;
} catch (_error) {
} catch (error) {
debugLogger.debug(
`Failed to determine latest run-gemini-cli release:`,
_error,
error,
);
throw new Error(
`Unable to determine the latest run-gemini-cli release on GitHub.`,

View File

@@ -110,7 +110,7 @@ export function getInstallationInfo(
'Installed via Homebrew. Please update with "brew upgrade gemini-cli".',
};
}
} catch (_error) {
} catch {
// Brew is not installed or gemini-cli is not installed via brew.
// Continue to the next check.
}

View File

@@ -42,7 +42,7 @@ export function tryParseJSON(input: string): object | null {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return parsed;
} catch (_err) {
} catch {
return null;
}
}

View File

@@ -60,7 +60,7 @@ export async function shouldUseCurrentUserInSandbox(): Promise<boolean> {
);
return true;
}
} catch (_err) {
} catch {
// Silently ignore if /etc/os-release is not found or unreadable.
// The default (false) will be applied in this case.
debugLogger.warn(

View File

@@ -43,7 +43,7 @@ describe('SessionSelector', () => {
// Clean up test files
try {
await fs.rm(tmpDir, { recursive: true, force: true });
} catch (_error) {
} catch {
// Ignore cleanup errors
}
});

View File

@@ -52,7 +52,7 @@ const homeDirectoryCheck: WarningCheck = {
return 'Warning you are running Gemini CLI in your home directory.\nThis warning can be disabled in /settings';
}
return null;
} catch (_err: unknown) {
} catch {
return 'Could not verify the current directory due to a file system error.';
}
},
@@ -73,7 +73,7 @@ const rootDirectoryCheck: WarningCheck = {
}
return null;
} catch (_err: unknown) {
} catch {
return 'Could not verify the current directory due to a file system error.';
}
},