fix(lint): clean up main lint regressions · openclaw/openclaw@1831e12
vincentkoc
·
2026-05-07
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -102,15 +102,23 @@ function parseNodeCandidates(raw: unknown): CanvasNodeCandidate[] {
|
102 | 102 | connected?: unknown; |
103 | 103 | clientId?: unknown; |
104 | 104 | }; |
105 | | -return typeof node.nodeId === "string" |
106 | | - ? { |
107 | | -nodeId: node.nodeId, |
108 | | - ...(typeof node.displayName === "string" && { displayName: node.displayName }), |
109 | | - ...(typeof node.remoteIp === "string" && { remoteIp: node.remoteIp }), |
110 | | - ...(typeof node.connected === "boolean" && { connected: node.connected }), |
111 | | - ...(typeof node.clientId === "string" && { clientId: node.clientId }), |
112 | | -} |
113 | | - : null; |
| 105 | +if (typeof node.nodeId !== "string") { |
| 106 | +return null; |
| 107 | +} |
| 108 | +const candidate: CanvasNodeCandidate = { nodeId: node.nodeId }; |
| 109 | +if (typeof node.displayName === "string") { |
| 110 | +candidate.displayName = node.displayName; |
| 111 | +} |
| 112 | +if (typeof node.remoteIp === "string") { |
| 113 | +candidate.remoteIp = node.remoteIp; |
| 114 | +} |
| 115 | +if (typeof node.connected === "boolean") { |
| 116 | +candidate.connected = node.connected; |
| 117 | +} |
| 118 | +if (typeof node.clientId === "string") { |
| 119 | +candidate.clientId = node.clientId; |
| 120 | +} |
| 121 | +return candidate; |
114 | 122 | }) |
115 | 123 | .filter((entry): entry is CanvasNodeCandidate => entry !== null); |
116 | 124 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,10 +11,7 @@ function mergeHostConfig(params: {
|
11 | 11 | legacyHost: MutableRecord; |
12 | 12 | existingHost: MutableRecord | undefined; |
13 | 13 | }): MutableRecord { |
14 | | -return { |
15 | | - ...params.legacyHost, |
16 | | - ...(params.existingHost ?? {}), |
17 | | -}; |
| 14 | +return Object.assign({}, params.legacyHost, params.existingHost); |
18 | 15 | } |
19 | 16 | |
20 | 17 | export function migrateLegacyCanvasHostConfig(config: OpenClawConfig): { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -59,9 +59,7 @@ export function parseCanvasPluginConfig(value: unknown): CanvasPluginConfig {
|
59 | 59 | return {}; |
60 | 60 | } |
61 | 61 | const host = parseCanvasHostConfig(value.host); |
62 | | -return { |
63 | | - ...(host ? { host } : {}), |
64 | | -}; |
| 62 | +return host ? { host } : {}; |
65 | 63 | } |
66 | 64 | |
67 | 65 | export function isCanvasPluginEnabled(config?: OpenClawConfig): boolean { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -497,7 +497,6 @@ export function createGatewayHttpServer(opts: {
|
497 | 497 | strictTransportSecurityHeader, |
498 | 498 | handleHooksRequest, |
499 | 499 | handlePluginRequest, |
500 | | - handlePluginUpgrade, |
501 | 500 | shouldEnforcePluginGatewayAuth, |
502 | 501 | resolvePluginNodeCapabilityRoute, |
503 | 502 | resolvedAuth, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -23,8 +23,6 @@ import {
|
23 | 23 | startConnectedServerWithClient, |
24 | 24 | startGatewayServer, |
25 | 25 | startServerWithClient, |
26 | | -testState, |
27 | | -testTailnetIPv4, |
28 | 26 | trackConnectChallengeNonce, |
29 | 27 | } from "./test-helpers.js"; |
30 | 28 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,10 +34,11 @@ export function findMatchingPluginNodeCapabilityRoutes(
|
34 | 34 | ): PluginNodeCapabilityRoute[] { |
35 | 35 | return findMatchingPluginHttpRoutes(registry, context) |
36 | 36 | .filter(hasNodeCapabilityRoute) |
37 | | -.map((route) => ({ |
38 | | - ...route, |
39 | | -nodeCapability: resolvePluginNodeCapabilityRouteSurface(route), |
40 | | -})); |
| 37 | +.map((route) => |
| 38 | +Object.assign({}, route, { |
| 39 | +nodeCapability: resolvePluginNodeCapabilityRouteSurface(route), |
| 40 | +}), |
| 41 | +); |
41 | 42 | } |
42 | 43 | |
43 | 44 | export function findMatchingPluginNodeCapabilityRoute( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1293,18 +1293,17 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
|
1293 | 1293 | } |
1294 | 1294 | const serializeCommandPath = (command: string) => [...normalizedParentPath, command].join(" "); |
1295 | 1295 | const commandPaths = commands.map(serializeCommandPath); |
| 1296 | +const commandPathSet = new Set(commandPaths); |
1296 | 1297 | const existing = registry.cliRegistrars.find((entry) => |
1297 | 1298 | entry.commands |
1298 | 1299 | .map((command) => [...(entry.parentPath ?? []), command].join(" ")) |
1299 | | -.some((commandPath) => commandPaths.includes(commandPath)), |
| 1300 | +.some((commandPath) => commandPathSet.has(commandPath)), |
1300 | 1301 | ); |
1301 | 1302 | if (existing) { |
1302 | | -const existingCommandPaths = existing.commands.map((command) => |
1303 | | -[...(existing.parentPath ?? []), command].join(" "), |
1304 | | -); |
1305 | | -const overlap = commandPaths.find((commandPath) => |
1306 | | -existingCommandPaths.includes(commandPath), |
| 1303 | +const existingCommandPaths = new Set( |
| 1304 | +existing.commands.map((command) => [...(existing.parentPath ?? []), command].join(" ")), |
1307 | 1305 | ); |
| 1306 | +const overlap = commandPaths.find((commandPath) => existingCommandPaths.has(commandPath)); |
1308 | 1307 | pushDiagnostic({ |
1309 | 1308 | level: "error", |
1310 | 1309 | pluginId: record.id, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。