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

@@ -58,7 +58,9 @@ function normalizeExecAsk(value?: string | null): ExecAsk | null {
}
function mergePathPrepend(existing: string | undefined, prepend: string[]) {
if (prepend.length === 0) return existing;
if (prepend.length === 0) {
return existing;
}
const partsExisting = (existing ?? "")
.split(path.delimiter)
.map((part) => part.trim())
@@ -66,7 +68,9 @@ function mergePathPrepend(existing: string | undefined, prepend: string[]) {
const merged: string[] = [];
const seen = new Set<string>();
for (const part of [...prepend, ...partsExisting]) {
if (seen.has(part)) continue;
if (seen.has(part)) {
continue;
}
seen.add(part);
merged.push(part);
}
@@ -78,10 +82,16 @@ function applyPathPrepend(
prepend: string[] | undefined,
options?: { requireExisting?: boolean },
) {
if (!Array.isArray(prepend) || prepend.length === 0) return;
if (options?.requireExisting && !env.PATH) return;
if (!Array.isArray(prepend) || prepend.length === 0) {
return;
}
if (options?.requireExisting && !env.PATH) {
return;
}
const merged = mergePathPrepend(env.PATH, prepend);
if (merged) env.PATH = merged;
if (merged) {
env.PATH = merged;
}
}
function resolveExecDefaults(
@@ -341,8 +351,12 @@ export function registerNodesInvokeCommands(nodes: Command) {
const timedOut = payload?.timedOut === true;
const success = payload?.success === true;
if (stdout) process.stdout.write(stdout);
if (stderr) process.stderr.write(stderr);
if (stdout) {
process.stdout.write(stdout);
}
if (stderr) {
process.stderr.write(stderr);
}
if (timedOut) {
const { error } = getNodesTheme();
defaultRuntime.error(error("run timed out"));