Skip to content

Commit af62a2c

Browse files
committed
style: fix extension lint violations
1 parent e814171 commit af62a2c

380 files changed

Lines changed: 2061 additions & 1495 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/acpx/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function resolveConfiguredMcpServers(params: {
176176
pluginToolsMcpBridge: boolean;
177177
moduleUrl?: string;
178178
}): Record<string, McpServerConfig> {
179-
const resolved = { ...(params.mcpServers ?? {}) };
179+
const resolved = { ...params.mcpServers };
180180
if (!params.pluginToolsMcpBridge) {
181181
return resolved;
182182
}

extensions/acpx/src/runtime-internals/events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function resolveStatusTextForTag(params: {
120120
}
121121
if (tag === "plan") {
122122
const entries = Array.isArray(payload.entries) ? payload.entries : [];
123-
const first = entries.find((entry) => isRecord(entry)) as Record<string, unknown> | undefined;
123+
const first = entries.find((entry) => isRecord(entry));
124124
const content = asTrimmedString(first?.content);
125125
return content ? `plan: ${content}` : null;
126126
}
@@ -227,12 +227,12 @@ export function parsePromptEventLine(line: string): AcpRuntimeEvent | null {
227227
case "tool_call":
228228
return createToolCallEvent({
229229
payload,
230-
tag: (tag ?? "tool_call") as AcpSessionUpdateTag,
230+
tag: tag ?? "tool_call",
231231
});
232232
case "tool_call_update":
233233
return createToolCallEvent({
234234
payload,
235-
tag: (tag ?? "tool_call_update") as AcpSessionUpdateTag,
235+
tag: tag ?? "tool_call_update",
236236
});
237237
case "agent_message_chunk":
238238
return resolveTextChunk({

extensions/amazon-bedrock-mantle/discovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export async function discoverMantleModels(params: {
227227
contextWindow: DEFAULT_CONTEXT_WINDOW,
228228
maxTokens: DEFAULT_MAX_TOKENS,
229229
}))
230-
.sort((a, b) => a.id.localeCompare(b.id));
230+
.toSorted((a, b) => a.id.localeCompare(b.id));
231231

232232
discoveryCache.set(cacheKey, { models, fetchedAt: now() });
233233
return models;

extensions/amazon-bedrock/discovery.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,16 @@ function resolveBaseModelId(profile: InferenceProfileSummary): string | undefine
177177
const firstArn = profile.models?.[0]?.modelArn;
178178
if (firstArn) {
179179
const arnMatch = /foundation-model\/(.+)$/.exec(firstArn);
180-
if (arnMatch) return arnMatch[1];
180+
if (arnMatch) {
181+
return arnMatch[1];
182+
}
181183
}
182184
if (profile.type === "SYSTEM_DEFINED") {
183185
const id = profile.inferenceProfileId ?? "";
184186
const prefixMatch = /^(?:us|eu|ap|jp|global)\.(.+)$/i.exec(id);
185-
if (prefixMatch) return prefixMatch[1];
187+
if (prefixMatch) {
188+
return prefixMatch[1];
189+
}
186190
}
187191
return undefined;
188192
}
@@ -236,8 +240,12 @@ function resolveInferenceProfiles(
236240
): ModelDefinitionConfig[] {
237241
const discovered: ModelDefinitionConfig[] = [];
238242
for (const profile of profiles) {
239-
if (!profile.inferenceProfileId?.trim()) continue;
240-
if (profile.status !== "ACTIVE") continue;
243+
if (!profile.inferenceProfileId?.trim()) {
244+
continue;
245+
}
246+
if (profile.status !== "ACTIVE") {
247+
continue;
248+
}
241249

242250
// Apply provider filter: check if any of the underlying models match.
243251
if (providerFilter.length > 0) {
@@ -246,7 +254,9 @@ function resolveInferenceProfiles(
246254
const provider = m.modelArn?.split("/")?.[1]?.split(".")?.[0];
247255
return provider ? providerFilter.includes(provider.toLowerCase()) : false;
248256
});
249-
if (!matchesFilter) continue;
257+
if (!matchesFilter) {
258+
continue;
259+
}
250260
}
251261

252262
// Look up the underlying foundation model to inherit its capabilities.
@@ -366,7 +376,9 @@ export async function discoverBedrockModels(params: {
366376
return discovered.toSorted((a, b) => {
367377
const aGlobal = a.id.startsWith("global.") ? 0 : 1;
368378
const bGlobal = b.id.startsWith("global.") ? 0 : 1;
369-
if (aGlobal !== bGlobal) return aGlobal - bGlobal;
379+
if (aGlobal !== bGlobal) {
380+
return aGlobal - bGlobal;
381+
}
370382
return a.name.localeCompare(b.name);
371383
});
372384
})();
@@ -409,8 +421,8 @@ export async function resolveImplicitBedrockProvider(params: {
409421
}): Promise<ModelProviderConfig | null> {
410422
const env = params.env ?? process.env;
411423
const discoveryConfig = {
412-
...(params.config?.models?.bedrockDiscovery ?? {}),
413-
...(params.pluginConfig?.discovery ?? {}),
424+
...params.config?.models?.bedrockDiscovery,
425+
...params.pluginConfig?.discovery,
414426
};
415427
const enabled = discoveryConfig?.enabled;
416428
const hasAwsCreds = resolveAwsSdkEnvVarName(env) !== undefined;

extensions/amazon-bedrock/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ async function registerWithConfig(
3333
});
3434
await amazonBedrockPlugin.register(api);
3535
const provider = providers[0];
36-
if (!provider) throw new Error("provider registration missing");
36+
if (!provider) {
37+
throw new Error("provider registration missing");
38+
}
3739
return provider;
3840
}
3941

extensions/amazon-bedrock/register.sync.runtime.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ function createGuardrailWrapStreamFn(
4040
): (ctx: { modelId: string; streamFn?: StreamFn }) => StreamFn | null | undefined {
4141
return (ctx) => {
4242
const inner = innerWrapStreamFn(ctx);
43-
if (!inner) return inner;
43+
if (!inner) {
44+
return inner;
45+
}
4446
return (model, context, options) => {
4547
return streamWithPayloadPatch(inner, model, context, options, (payload) => {
4648
const gc: Record<string, unknown> = {
@@ -88,7 +90,9 @@ export function registerAmazonBedrockPlugin(api: OpenClawPluginApi): void {
8890

8991
/** Extract the AWS region from a bedrock-runtime baseUrl. */
9092
function extractRegionFromBaseUrl(baseUrl: string | undefined): string | undefined {
91-
if (!baseUrl) return undefined;
93+
if (!baseUrl) {
94+
return undefined;
95+
}
9296
return bedrockRegionRe.exec(baseUrl)?.[1];
9397
}
9498

@@ -108,13 +112,19 @@ export function registerAmazonBedrockPlugin(api: OpenClawPluginApi): void {
108112
const exact = (providers[providerId] as { baseUrl?: string } | undefined)?.baseUrl;
109113
if (exact) {
110114
const region = extractRegionFromBaseUrl(exact);
111-
if (region) return region;
115+
if (region) {
116+
return region;
117+
}
112118
}
113119
// Fall back to alias matches (e.g. "bedrock" instead of "amazon-bedrock").
114120
for (const [key, value] of Object.entries(providers)) {
115-
if (key === providerId || normalizeProviderId(key) !== providerId) continue;
121+
if (key === providerId || normalizeProviderId(key) !== providerId) {
122+
continue;
123+
}
116124
const region = extractRegionFromBaseUrl((value as { baseUrl?: string }).baseUrl);
117-
if (region) return region;
125+
if (region) {
126+
return region;
127+
}
118128
}
119129
}
120130
return config?.models?.bedrockDiscovery?.region;

extensions/anthropic/cli-backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CliBackendPlugin, CliBackendConfig } from "openclaw/plugin-sdk/cli-backend";
1+
import type { CliBackendPlugin } from "openclaw/plugin-sdk/cli-backend";
22
import {
33
CLI_FRESH_WATCHDOG_DEFAULTS,
44
CLI_RESUME_WATCHDOG_DEFAULTS,

extensions/anthropic/register.runtime.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ import type {
88
} from "openclaw/plugin-sdk/plugin-entry";
99
import {
1010
applyAuthProfileConfig,
11-
createProviderApiKeyAuthMethod,
11+
type AuthProfileStore,
1212
buildTokenProfileId,
13-
ensureApiKeyFromOptionEnvOrPrompt,
13+
createProviderApiKeyAuthMethod,
1414
listProfilesForProvider,
15-
normalizeApiKeyInput,
1615
type OpenClawConfig as ProviderAuthConfig,
17-
suggestOAuthProfileIdForLegacyDefault,
18-
type AuthProfileStore,
1916
type ProviderAuthResult,
17+
suggestOAuthProfileIdForLegacyDefault,
2018
upsertAuthProfile,
2119
validateAnthropicSetupToken,
22-
validateApiKeyInput,
2320
} from "openclaw/plugin-sdk/provider-auth";
2421
import { cloneFirstTemplateModel } from "openclaw/plugin-sdk/provider-model-shared";
2522
import { fetchClaudeUsage } from "openclaw/plugin-sdk/provider-usage";
@@ -54,7 +51,7 @@ const ANTHROPIC_MODERN_MODEL_PREFIXES = [
5451
"claude-sonnet-4-5",
5552
"claude-haiku-4-5",
5653
] as const;
57-
const ANTHROPIC_OAUTH_ALLOWLIST = [
54+
const _ANTHROPIC_OAUTH_ALLOWLIST = [
5855
"anthropic/claude-sonnet-4-6",
5956
"anthropic/claude-opus-4-6",
6057
"anthropic/claude-opus-4-5",
@@ -372,7 +369,7 @@ export function registerAnthropicPlugin(api: OpenClawPluginApi): void {
372369
const claudeCliProfileId = "anthropic:claude-cli";
373370
const providerId = "anthropic";
374371
const defaultAnthropicModel = "anthropic/claude-sonnet-4-6";
375-
const anthropicOauthAllowlist = [
372+
const _anthropicOauthAllowlist = [
376373
"anthropic/claude-sonnet-4-6",
377374
"anthropic/claude-opus-4-6",
378375
"anthropic/claude-opus-4-5",

extensions/bluebubbles/src/accounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function resolveBlueBubblesAccount(params: {
5252
const merged = mergeBlueBubblesAccountConfig(params.cfg, accountId);
5353
const accountEnabled = merged.enabled !== false;
5454
const serverUrl = normalizeSecretInputString(merged.serverUrl);
55-
const password = normalizeSecretInputString(merged.password);
55+
const _password = normalizeSecretInputString(merged.password);
5656
const configured = Boolean(serverUrl && hasConfiguredSecretInput(merged.password));
5757
const baseUrl = serverUrl ? normalizeBlueBubblesServerUrl(serverUrl) : undefined;
5858
return {

extensions/bluebubbles/src/attachments.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ import { resolveRequestUrl } from "./request-url.js";
1010
import type { OpenClawConfig } from "./runtime-api.js";
1111
import { getBlueBubblesRuntime, warnBlueBubbles } from "./runtime.js";
1212
import { extractBlueBubblesMessageId, resolveBlueBubblesSendTarget } from "./send-helpers.js";
13-
import { resolveChatGuidForTarget, createChatForHandle } from "./send.js";
13+
import { createChatForHandle, resolveChatGuidForTarget } from "./send.js";
1414
import {
1515
blueBubblesFetchWithTimeout,
1616
buildBlueBubblesApiUrl,
1717
type BlueBubblesAttachment,
18-
type BlueBubblesSendTarget,
1918
type SsrFPolicy,
2019
} from "./types.js";
2120

@@ -127,10 +126,12 @@ export async function downloadBlueBubblesAttachment(
127126
};
128127
} catch (error) {
129128
if (readMediaFetchErrorCode(error) === "max_bytes") {
130-
throw new Error(`BlueBubbles attachment too large (limit ${maxBytes} bytes)`);
129+
throw new Error(`BlueBubbles attachment too large (limit ${maxBytes} bytes)`, {
130+
cause: error,
131+
});
131132
}
132133
const text = error instanceof Error ? error.message : String(error);
133-
throw new Error(`BlueBubbles attachment download failed: ${text}`);
134+
throw new Error(`BlueBubbles attachment download failed: ${text}`, { cause: error });
134135
}
135136
}
136137

0 commit comments

Comments
 (0)