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
@@ -148,7 +148,7 @@ export function buildSeatbeltProfile(options: SeatbeltArgsOptions): string {
addedPaths.add(resolved);
profile += `(allow file-read* (subpath "${escapeSchemeString(resolved)}"))\n`;
}
} catch (_e) {
} catch {
// Ignore paths that do not exist or are inaccessible
}
}
+6 -6
View File
@@ -14,15 +14,15 @@ export function isErrnoException(e: unknown): e is NodeJS.ErrnoException {
export function tryRealpath(p: string): string {
try {
return fs.realpathSync(p);
} catch (_e) {
if (isErrnoException(_e) && _e.code === 'ENOENT') {
} catch (e) {
if (isErrnoException(e) && e.code === 'ENOENT') {
const parentDir = path.dirname(p);
if (parentDir === p) {
return p;
}
return path.join(tryRealpath(parentDir), path.basename(p));
}
throw _e;
throw e;
}
}
@@ -52,7 +52,7 @@ export function resolveGitWorktreePaths(workspacePath: string): {
if (tryRealpath(backlink) === tryRealpath(gitPath)) {
isValid = true;
}
} catch (_e) {
} catch {
// Fallback for submodules: check core.worktree in config
try {
const configPath = path.join(resolvedWorktreeGitDir, 'config');
@@ -67,7 +67,7 @@ export function resolveGitWorktreePaths(workspacePath: string): {
isValid = true;
}
}
} catch (_e2) {
} catch {
// Ignore
}
}
@@ -85,7 +85,7 @@ export function resolveGitWorktreePaths(workspacePath: string): {
};
}
}
} catch (_e) {
} catch {
// Ignore if .git doesn't exist, isn't readable, etc.
}
return {};