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

@@ -2,7 +2,9 @@ import { createServer } from "node:net";
import { isMainThread, threadId } from "node:worker_threads";
async function isPortFree(port: number): Promise<boolean> {
if (!Number.isFinite(port) || port <= 0 || port > 65535) return false;
if (!Number.isFinite(port) || port <= 0 || port > 65535) {
return false;
}
return await new Promise((resolve) => {
const server = createServer();
server.once("error", () => resolve(false));
@@ -66,7 +68,9 @@ export async function getDeterministicFreePortBlock(params?: {
const ok = (await Promise.all(offsets.map((offset) => isPortFree(start + offset)))).every(
Boolean,
);
if (!ok) continue;
if (!ok) {
continue;
}
nextTestPortOffset = (nextTestPortOffset + attempt + blockSize) % usable;
return start;
}
@@ -79,7 +83,9 @@ export async function getDeterministicFreePortBlock(params?: {
const ok = (await Promise.all(offsets.map((offset) => isPortFree(port + offset)))).every(
Boolean,
);
if (ok) return port;
if (ok) {
return port;
}
}
throw new Error("failed to acquire a free port block");