mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 11:02:12 +03:00
chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.
This commit is contained in:
+2
-2
@@ -45,8 +45,8 @@ export function registerPluginCliCommands(program: Command, cfg?: OpenClawConfig
|
||||
workspaceDir,
|
||||
logger,
|
||||
});
|
||||
if (result && typeof (result as Promise<void>).then === "function") {
|
||||
void (result as Promise<void>).catch((err) => {
|
||||
if (result && typeof result.then === "function") {
|
||||
void result.catch((err) => {
|
||||
log.warn(`plugin CLI register failed (${entry.pluginId}): ${String(err)}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ function getHooksForName<K extends PluginHookName>(
|
||||
): PluginHookRegistration<K>[] {
|
||||
return (registry.typedHooks as PluginHookRegistration<K>[])
|
||||
.filter((h) => h.hookName === hookName)
|
||||
.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
||||
.toSorted((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
if (catchErrors) {
|
||||
logger?.error(msg);
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
throw new Error(msg, { cause: err });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -159,7 +159,7 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
if (catchErrors) {
|
||||
logger?.error(msg);
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
throw new Error(msg, { cause: err });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ export function createHookRunner(registry: PluginRegistry, options: HookRunnerOp
|
||||
if (catchErrors) {
|
||||
logger?.error(msg);
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
throw new Error(msg, { cause: err });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
|
||||
|
||||
try {
|
||||
const result = register(api);
|
||||
if (result && typeof (result as Promise<void>).then === "function") {
|
||||
if (result && typeof result.then === "function") {
|
||||
registry.diagnostics.push({
|
||||
level: "warn",
|
||||
pluginId: record.id,
|
||||
|
||||
@@ -33,7 +33,7 @@ const state: RegistryState = (() => {
|
||||
key: null,
|
||||
};
|
||||
}
|
||||
return globalState[REGISTRY_STATE] as RegistryState;
|
||||
return globalState[REGISTRY_STATE];
|
||||
})();
|
||||
|
||||
export function setActivePluginRegistry(registry: PluginRegistry, cacheKey?: string) {
|
||||
|
||||
@@ -29,7 +29,7 @@ export function validateJsonSchemaValue(params: {
|
||||
}): { ok: true } | { ok: false; errors: string[] } {
|
||||
let cached = schemaCache.get(params.cacheKey);
|
||||
if (!cached || cached.schema !== params.schema) {
|
||||
const validate = ajv.compile(params.schema) as ValidateFunction;
|
||||
const validate = ajv.compile(params.schema);
|
||||
cached = { validate, schema: params.schema };
|
||||
schemaCache.set(params.cacheKey, cached);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function startPluginServices(params: {
|
||||
|
||||
return {
|
||||
stop: async () => {
|
||||
for (const entry of running.reverse()) {
|
||||
for (const entry of running.toReversed()) {
|
||||
if (!entry.stop) continue;
|
||||
try {
|
||||
await entry.stop();
|
||||
|
||||
@@ -76,7 +76,9 @@ export function applyExclusiveSlotSelection(params: {
|
||||
}
|
||||
|
||||
if (disabledIds.length > 0) {
|
||||
warnings.push(`Disabled other "${slotKey}" slot plugins: ${disabledIds.sort().join(", ")}.`);
|
||||
warnings.push(
|
||||
`Disabled other "${slotKey}" slot plugins: ${disabledIds.toSorted().join(", ")}.`,
|
||||
);
|
||||
}
|
||||
|
||||
const changed = prevSlot !== params.selectedId || disabledIds.length > 0;
|
||||
|
||||
Reference in New Issue
Block a user