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
+9 -3
View File
@@ -7,15 +7,21 @@ const windowsUncPath = /^\\\\/;
export function resolveHomeDir(env: Record<string, string | undefined>): string {
const home = env.HOME?.trim() || env.USERPROFILE?.trim();
if (!home) throw new Error("Missing HOME");
if (!home) {
throw new Error("Missing HOME");
}
return home;
}
export function resolveUserPathWithHome(input: string, home?: string): string {
const trimmed = input.trim();
if (!trimmed) return trimmed;
if (!trimmed) {
return trimmed;
}
if (trimmed.startsWith("~")) {
if (!home) throw new Error("Missing HOME");
if (!home) {
throw new Error("Missing HOME");
}
const expanded = trimmed.replace(/^~(?=$|[\\/])/, home);
return path.resolve(expanded);
}