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

@@ -92,14 +92,18 @@ export function bumpSkillsSnapshotVersion(params?: {
}
export function getSkillsSnapshotVersion(workspaceDir?: string): number {
if (!workspaceDir) return globalVersion;
if (!workspaceDir) {
return globalVersion;
}
const local = workspaceVersions.get(workspaceDir) ?? 0;
return Math.max(globalVersion, local);
}
export function ensureSkillsWatcher(params: { workspaceDir: string; config?: OpenClawConfig }) {
const workspaceDir = params.workspaceDir.trim();
if (!workspaceDir) return;
if (!workspaceDir) {
return;
}
const watchEnabled = params.config?.skills?.load?.watch !== false;
const debounceMsRaw = params.config?.skills?.load?.watchDebounceMs;
const debounceMs =
@@ -111,7 +115,9 @@ export function ensureSkillsWatcher(params: { workspaceDir: string; config?: Ope
if (!watchEnabled) {
if (existing) {
watchers.delete(workspaceDir);
if (existing.timer) clearTimeout(existing.timer);
if (existing.timer) {
clearTimeout(existing.timer);
}
void existing.watcher.close().catch(() => {});
}
return;
@@ -124,7 +130,9 @@ export function ensureSkillsWatcher(params: { workspaceDir: string; config?: Ope
}
if (existing) {
watchers.delete(workspaceDir);
if (existing.timer) clearTimeout(existing.timer);
if (existing.timer) {
clearTimeout(existing.timer);
}
void existing.watcher.close().catch(() => {});
}
@@ -143,7 +151,9 @@ export function ensureSkillsWatcher(params: { workspaceDir: string; config?: Ope
const schedule = (changedPath?: string) => {
state.pendingPath = changedPath ?? state.pendingPath;
if (state.timer) clearTimeout(state.timer);
if (state.timer) {
clearTimeout(state.timer);
}
state.timer = setTimeout(() => {
const pendingPath = state.pendingPath;
state.pendingPath = undefined;