chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user