chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -12,7 +12,9 @@ function isExecutable(filePath: string): boolean {
}
function normalizePathValue(value: unknown): string | undefined {
if (typeof value !== "string") return undefined;
if (typeof value !== "string") {
return undefined;
}
const trimmed = value.trim();
return trimmed ? trimmed : undefined;
}
@@ -51,10 +53,14 @@ export function resolveBrewExecutable(opts?: {
const candidates: string[] = [];
const brewFile = normalizePathValue(env.HOMEBREW_BREW_FILE);
if (brewFile) candidates.push(brewFile);
if (brewFile) {
candidates.push(brewFile);
}
const prefix = normalizePathValue(env.HOMEBREW_PREFIX);
if (prefix) candidates.push(path.join(prefix, "bin", "brew"));
if (prefix) {
candidates.push(path.join(prefix, "bin", "brew"));
}
// Linuxbrew defaults.
candidates.push(path.join(homeDir, ".linuxbrew", "bin", "brew"));
@@ -64,7 +70,9 @@ export function resolveBrewExecutable(opts?: {
candidates.push("/opt/homebrew/bin/brew", "/usr/local/bin/brew");
for (const candidate of candidates) {
if (isExecutable(candidate)) return candidate;
if (isExecutable(candidate)) {
return candidate;
}
}
return undefined;