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

@@ -216,7 +216,9 @@ export async function approveNodePairing(
return await withLock(async () => {
const state = await loadState(baseDir);
const pending = state.pendingById[requestId];
if (!pending) return null;
if (!pending) {
return null;
}
const now = Date.now();
const existing = state.pairedByNodeId[pending.nodeId];
@@ -252,7 +254,9 @@ export async function rejectNodePairing(
return await withLock(async () => {
const state = await loadState(baseDir);
const pending = state.pendingById[requestId];
if (!pending) return null;
if (!pending) {
return null;
}
delete state.pendingById[requestId];
await persistState(state, baseDir);
return { requestId, nodeId: pending.nodeId };
@@ -267,7 +271,9 @@ export async function verifyNodeToken(
const state = await loadState(baseDir);
const normalized = normalizeNodeId(nodeId);
const node = state.pairedByNodeId[normalized];
if (!node) return { ok: false };
if (!node) {
return { ok: false };
}
return node.token === token ? { ok: true, node } : { ok: false };
}
@@ -280,7 +286,9 @@ export async function updatePairedNodeMetadata(
const state = await loadState(baseDir);
const normalized = normalizeNodeId(nodeId);
const existing = state.pairedByNodeId[normalized];
if (!existing) return;
if (!existing) {
return;
}
const next: NodePairingPairedNode = {
...existing,
@@ -313,9 +321,13 @@ export async function renamePairedNode(
const state = await loadState(baseDir);
const normalized = normalizeNodeId(nodeId);
const existing = state.pairedByNodeId[normalized];
if (!existing) return null;
if (!existing) {
return null;
}
const trimmed = displayName.trim();
if (!trimmed) throw new Error("displayName required");
if (!trimmed) {
throw new Error("displayName required");
}
const next: NodePairingPairedNode = { ...existing, displayName: trimmed };
state.pairedByNodeId[normalized] = next;
await persistState(state, baseDir);