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

@@ -113,7 +113,9 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
hints?: string[];
warnings?: string[];
}) => {
if (!json) return;
if (!json) {
return;
}
emitDaemonActionJson({ action: "install", ...payload });
};
const fail = (message: string, hints?: string[]) => {
@@ -127,7 +129,9 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
} else {
defaultRuntime.error(message);
if (hints?.length) {
for (const hint of hints) defaultRuntime.log(`Tip: ${hint}`);
for (const hint of hints) {
defaultRuntime.log(`Tip: ${hint}`);
}
}
}
defaultRuntime.exit(1);
@@ -187,8 +191,11 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
displayName: opts.displayName,
runtime: runtimeRaw,
warn: (message) => {
if (json) warnings.push(message);
else defaultRuntime.log(message);
if (json) {
warnings.push(message);
} else {
defaultRuntime.log(message);
}
},
});
@@ -235,12 +242,17 @@ export async function runNodeDaemonUninstall(opts: NodeDaemonLifecycleOptions =
notLoadedText: string;
};
}) => {
if (!json) return;
if (!json) {
return;
}
emitDaemonActionJson({ action: "uninstall", ...payload });
};
const fail = (message: string) => {
if (json) emit({ ok: false, error: message });
else defaultRuntime.error(message);
if (json) {
emit({ ok: false, error: message });
} else {
defaultRuntime.error(message);
}
defaultRuntime.exit(1);
};
@@ -286,12 +298,17 @@ export async function runNodeDaemonStart(opts: NodeDaemonLifecycleOptions = {})
notLoadedText: string;
};
}) => {
if (!json) return;
if (!json) {
return;
}
emitDaemonActionJson({ action: "start", ...payload });
};
const fail = (message: string, hints?: string[]) => {
if (json) emit({ ok: false, error: message, hints });
else defaultRuntime.error(message);
if (json) {
emit({ ok: false, error: message, hints });
} else {
defaultRuntime.error(message);
}
defaultRuntime.exit(1);
};
@@ -363,12 +380,17 @@ export async function runNodeDaemonRestart(opts: NodeDaemonLifecycleOptions = {}
notLoadedText: string;
};
}) => {
if (!json) return;
if (!json) {
return;
}
emitDaemonActionJson({ action: "restart", ...payload });
};
const fail = (message: string, hints?: string[]) => {
if (json) emit({ ok: false, error: message, hints });
else defaultRuntime.error(message);
if (json) {
emit({ ok: false, error: message, hints });
} else {
defaultRuntime.error(message);
}
defaultRuntime.exit(1);
};
@@ -439,12 +461,17 @@ export async function runNodeDaemonStop(opts: NodeDaemonLifecycleOptions = {}) {
notLoadedText: string;
};
}) => {
if (!json) return;
if (!json) {
return;
}
emitDaemonActionJson({ action: "stop", ...payload });
};
const fail = (message: string) => {
if (json) emit({ ok: false, error: message });
else defaultRuntime.error(message);
if (json) {
emit({ ok: false, error: message });
} else {
defaultRuntime.error(message);
}
defaultRuntime.exit(1);
};