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

@@ -19,13 +19,17 @@ export function parseLsofOutput(output: string): PortProcess[] {
let current: Partial<PortProcess> = {};
for (const line of lines) {
if (line.startsWith("p")) {
if (current.pid) results.push(current as PortProcess);
if (current.pid) {
results.push(current as PortProcess);
}
current = { pid: Number.parseInt(line.slice(1), 10) };
} else if (line.startsWith("c")) {
current.command = line.slice(1);
}
}
if (current.pid) results.push(current as PortProcess);
if (current.pid) {
results.push(current as PortProcess);
}
return results;
}
@@ -42,7 +46,9 @@ export function listPortListeners(port: number): PortProcess[] {
if (code === "ENOENT") {
throw new Error("lsof not found; required for --force", { cause: err });
}
if (status === 1) return []; // no listeners
if (status === 1) {
return [];
} // no listeners
throw err instanceof Error ? err : new Error(String(err));
}
}