chore: apply core lint cleanups · openclaw/openclaw@596b889
steipete
·
2026-04-23
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -456,7 +456,8 @@ export function collectForbiddenPackPaths(paths: Iterable<string>): string[] {
|
456 | 456 | return [...paths] |
457 | 457 | .filter( |
458 | 458 | (path) => |
459 | | -forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) || /node_modules\//.test(path), |
| 459 | +forbiddenPrefixes.some((prefix) => path.startsWith(prefix)) || |
| 460 | +path.includes("node_modules/"), |
460 | 461 | ) |
461 | 462 | .toSorted((left, right) => left.localeCompare(right)); |
462 | 463 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ import {
|
13 | 13 | |
14 | 14 | const logLevel = process.env.OPENCLAW_BUILD_VERBOSE ? "info" : "warn"; |
15 | 15 | const extraArgs = process.argv.slice(2); |
16 | | -const INEFFECTIVE_DYNAMIC_IMPORT_RE = /\[INEFFECTIVE_DYNAMIC_IMPORT\]/; |
| 16 | +const INEFFECTIVE_DYNAMIC_IMPORT_MARKER = "[INEFFECTIVE_DYNAMIC_IMPORT]"; |
17 | 17 | const UNRESOLVED_IMPORT_RE = /\[UNRESOLVED_IMPORT\]/; |
18 | 18 | const ANSI_ESCAPE_RE = new RegExp(String.raw`\u001B\[[0-9;]*m`, "g"); |
19 | 19 | const HASHED_ROOT_JS_RE = /^(?<base>.+)-[A-Za-z0-9_-]+\.js$/u; |
@@ -170,7 +170,7 @@ export function createTsdownOutputScanner(params = {}) {
|
170 | 170 | return { |
171 | 171 | append(chunk) { |
172 | 172 | const text = Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk); |
173 | | -if (INEFFECTIVE_DYNAMIC_IMPORT_RE.test(text)) { |
| 173 | +if (text.includes(INEFFECTIVE_DYNAMIC_IMPORT_MARKER)) { |
174 | 174 | hasIneffectiveDynamicImport = true; |
175 | 175 | } |
176 | 176 | scanLines(text); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -44,7 +44,7 @@ describe("getSoonestCooldownExpiry", () => {
|
44 | 44 | cooldownUntil: Infinity, |
45 | 45 | }, |
46 | 46 | "openai:p3": { |
47 | | -disabledUntil: NaN, |
| 47 | +disabledUntil: Number.NaN, |
48 | 48 | }, |
49 | 49 | "openai:p4": { |
50 | 50 | cooldownUntil: 1_700_000_005_000, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -249,7 +249,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
|
249 | 249 | profileId, |
250 | 250 | access: "secondary-stale", |
251 | 251 | refresh: "secondary-refresh", |
252 | | -expires: NaN, |
| 252 | +expires: Number.NaN, |
253 | 253 | }), |
254 | 254 | ); |
255 | 255 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -521,7 +521,7 @@ describe("clearExpiredCooldowns", () => {
|
521 | 521 | it("ignores NaN and Infinity cooldown values", () => { |
522 | 522 | const store = makeStore({ |
523 | 523 | "anthropic:default": { |
524 | | -cooldownUntil: NaN, |
| 524 | +cooldownUntil: Number.NaN, |
525 | 525 | errorCount: 2, |
526 | 526 | }, |
527 | 527 | "openai:default": { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -181,7 +181,7 @@ export function formatUserTime(
|
181 | 181 | if (!map.weekday || !map.year || !map.month || !map.day || !map.hour || !map.minute) { |
182 | 182 | return undefined; |
183 | 183 | } |
184 | | -const dayNum = parseInt(map.day, 10); |
| 184 | +const dayNum = Number.parseInt(map.day, 10); |
185 | 185 | const suffix = ordinalSuffix(dayNum); |
186 | 186 | const timePart = use24Hour |
187 | 187 | ? `${map.hour}:${map.minute}` |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -539,7 +539,7 @@ describe("runWithModelFallback – probe logic", () => {
|
539 | 539 | it("handles NaN soonest safely (treats as probe-worthy)", async () => { |
540 | 540 | const cfg = makeCfg(); |
541 | 541 | |
542 | | -mockedGetSoonestCooldownExpiry.mockReturnValue(NaN); |
| 542 | +mockedGetSoonestCooldownExpiry.mockReturnValue(Number.NaN); |
543 | 543 | |
544 | 544 | const run = vi.fn().mockResolvedValue("ok-nan"); |
545 | 545 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ function parseLspMessages(buffer: string): { messages: unknown[]; remaining: str
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | |
69 | | -const contentLength = parseInt(match[1], 10); |
| 69 | +const contentLength = Number.parseInt(match[1], 10); |
70 | 70 | const bodyStart = headerEnd + 4; |
71 | 71 | const bodyEnd = bodyStart + contentLength; |
72 | 72 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -146,7 +146,7 @@ describe("resolveCompactionTimeoutMs", () => {
|
146 | 146 | it("returns default for NaN", () => { |
147 | 147 | expect( |
148 | 148 | resolveCompactionTimeoutMs({ |
149 | | -agents: { defaults: { compaction: { timeoutSeconds: NaN } } }, |
| 149 | +agents: { defaults: { compaction: { timeoutSeconds: Number.NaN } } }, |
150 | 150 | }), |
151 | 151 | ).toBe(EMBEDDED_COMPACTION_TIMEOUT_MS); |
152 | 152 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -171,10 +171,10 @@ function parseModel(model: OpenRouterApiModel): OpenRouterModelCapabilities {
|
171 | 171 | model.max_output_tokens ?? |
172 | 172 | 8192, |
173 | 173 | cost: { |
174 | | -input: parseFloat(model.pricing?.prompt || "0") * 1_000_000, |
175 | | -output: parseFloat(model.pricing?.completion || "0") * 1_000_000, |
176 | | -cacheRead: parseFloat(model.pricing?.input_cache_read || "0") * 1_000_000, |
177 | | -cacheWrite: parseFloat(model.pricing?.input_cache_write || "0") * 1_000_000, |
| 174 | +input: Number.parseFloat(model.pricing?.prompt || "0") * 1_000_000, |
| 175 | +output: Number.parseFloat(model.pricing?.completion || "0") * 1_000_000, |
| 176 | +cacheRead: Number.parseFloat(model.pricing?.input_cache_read || "0") * 1_000_000, |
| 177 | +cacheWrite: Number.parseFloat(model.pricing?.input_cache_write || "0") * 1_000_000, |
178 | 178 | }, |
179 | 179 | }; |
180 | 180 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。