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

@@ -25,7 +25,9 @@ function hasGitWorkspace(workspaceDir?: string): boolean {
candidates.add(path.join(workspaceDir, ".git"));
}
for (const candidate of candidates) {
if (fs.existsSync(candidate)) return true;
if (fs.existsSync(candidate)) {
return true;
}
}
return false;
}
@@ -35,16 +37,22 @@ function resolveLocalPath(
workspaceDir: string | undefined,
allowLocal: boolean,
): string | null {
if (!allowLocal) return null;
if (!allowLocal) {
return null;
}
const raw = entry.install.localPath?.trim();
if (!raw) return null;
if (!raw) {
return null;
}
const candidates = new Set<string>();
candidates.add(path.resolve(process.cwd(), raw));
if (workspaceDir && workspaceDir !== process.cwd()) {
candidates.add(path.resolve(workspaceDir, raw));
}
for (const candidate of candidates) {
if (fs.existsSync(candidate)) return candidate;
if (fs.existsSync(candidate)) {
return candidate;
}
}
return null;
}
@@ -108,8 +116,12 @@ function resolveInstallDefaultChoice(params: {
return "npm";
}
const entryDefault = entry.install.defaultChoice;
if (entryDefault === "local") return localPath ? "local" : "npm";
if (entryDefault === "npm") return "npm";
if (entryDefault === "local") {
return localPath ? "local" : "npm";
}
if (entryDefault === "npm") {
return "npm";
}
return localPath ? "local" : "npm";
}