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

@@ -7,14 +7,19 @@ type RestoreEntry = { key: string; value: string | undefined };
function restoreEnv(entries: RestoreEntry[]): void {
for (const { key, value } of entries) {
if (value === undefined) delete process.env[key];
else process.env[key] = value;
if (value === undefined) {
delete process.env[key];
} else {
process.env[key] = value;
}
}
}
function loadProfileEnv(): void {
const profilePath = path.join(os.homedir(), ".profile");
if (!fs.existsSync(profilePath)) return;
if (!fs.existsSync(profilePath)) {
return;
}
try {
const output = execFileSync(
"/bin/bash",
@@ -24,11 +29,17 @@ function loadProfileEnv(): void {
const entries = output.split("\0");
let applied = 0;
for (const entry of entries) {
if (!entry) continue;
if (!entry) {
continue;
}
const idx = entry.indexOf("=");
if (idx <= 0) continue;
if (idx <= 0) {
continue;
}
const key = entry.slice(0, idx);
if (!key || (process.env[key] ?? "") !== "") continue;
if (!key || (process.env[key] ?? "") !== "") {
continue;
}
process.env[key] = entry.slice(idx + 1);
applied += 1;
}