diff --git a/.oxlintrc.json b/.oxlintrc.json index 3b9bf192265..0855b026474 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -11,6 +11,7 @@ "eslint-plugin-unicorn/prefer-array-find": "error", "eslint/no-array-constructor": "error", "eslint/no-await-in-loop": "off", + "eslint/no-constructor-return": "error", "eslint/no-div-regex": "error", "eslint/no-extra-label": "error", "eslint/no-empty-pattern": ["error", { "allowObjectPatternsAsParameters": false }], @@ -22,6 +23,7 @@ "eslint/no-regex-spaces": "error", "eslint/no-return-assign": "error", "eslint/no-sequences": "error", + "eslint/no-self-compare": "error", "eslint/no-shadow": "off", "eslint/no-useless-call": "error", "eslint/no-useless-computed-key": "error", @@ -32,16 +34,24 @@ "eslint/prefer-exponentiation-operator": "error", "eslint/prefer-numeric-literals": "error", "eslint/unicode-bom": "error", + "import/no-absolute-path": "error", + "import/no-empty-named-blocks": "error", + "import/no-self-import": "error", + "node/no-exports-assign": "error", "eslint-plugin-unicorn/prefer-set-size": "error", "oxc/no-accumulating-spread": "error", "oxc/no-async-endpoint-handlers": "error", "oxc/no-map-spread": "error", + "promise/no-new-statics": "error", + "typescript/adjacent-overload-signatures": "error", + "typescript/ban-tslint-comment": "error", "typescript/consistent-return": "error", "typescript/no-empty-object-type": ["error", { "allowInterfaces": "with-single-extends" }], "typescript/no-explicit-any": "error", "typescript/no-extraneous-class": "error", "typescript/no-meaningless-void-operator": "error", "typescript/no-non-null-asserted-nullish-coalescing": "error", + "typescript/no-unnecessary-qualifier": "error", "typescript/no-unnecessary-type-assertion": "error", "typescript/no-unnecessary-type-arguments": "error", "typescript/no-unnecessary-type-constraint": "error", @@ -50,14 +60,22 @@ "typescript/no-unsafe-type-assertion": "off", "typescript/no-useless-default-assignment": "error", "typescript/prefer-return-this-type": "error", + "typescript/prefer-find": "error", + "typescript/prefer-reduce-type-parameter": "error", "typescript/prefer-ts-expect-error": "error", + "unicorn/consistent-date-clone": "error", "unicorn/consistent-function-scoping": "off", + "unicorn/consistent-template-literal-escape": "error", + "unicorn/no-console-spaces": "error", "unicorn/no-unnecessary-array-flat-depth": "error", "unicorn/no-unnecessary-array-splice-count": "error", "unicorn/no-unnecessary-slice-end": "error", "unicorn/no-useless-error-capture-stack-trace": "error", "unicorn/no-useless-promise-resolve-reject": "error", "unicorn/prefer-date-now": "error", + "unicorn/prefer-dom-node-text-content": "error", + "unicorn/prefer-keyboard-event-key": "error", + "unicorn/prefer-negative-index": "error", "unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-set-size": "error", "unicorn/require-array-join-separator": "error", diff --git a/extensions/qa-lab/src/web-runtime.test.ts b/extensions/qa-lab/src/web-runtime.test.ts index c78c4aa7b6b..16403bf7fb6 100644 --- a/extensions/qa-lab/src/web-runtime.test.ts +++ b/extensions/qa-lab/src/web-runtime.test.ts @@ -18,13 +18,12 @@ const { } = vi.hoisted(() => ({ bodyLocator: { waitFor: vi.fn(async () => undefined), - innerText: vi.fn(async () => "hello from body"), + textContent: vi.fn(async () => "hello from body"), }, browserClose: vi.fn(async () => undefined), contextClose: vi.fn(async () => undefined), contextNewPage: vi.fn(), goto: vi.fn(async () => undefined), - innerText: vi.fn(async () => "hello from body"), launch: vi.fn(), locatorFill: vi.fn(async () => undefined), locatorPress: vi.fn(async () => undefined), diff --git a/extensions/qa-lab/src/web-runtime.ts b/extensions/qa-lab/src/web-runtime.ts index fa4d507d0ee..0a29623cc00 100644 --- a/extensions/qa-lab/src/web-runtime.ts +++ b/extensions/qa-lab/src/web-runtime.ts @@ -93,7 +93,7 @@ export async function qaWebWait(params: QaWebWaitParams) { } if (params.text) { await session.page.waitForFunction( - (expected) => document.body?.innerText?.toLowerCase().includes(expected.toLowerCase()), + (expected) => document.body?.textContent?.toLowerCase().includes(expected.toLowerCase()), params.text, { timeout: timeoutMs }, ); @@ -119,7 +119,7 @@ export async function qaWebSnapshot(params: QaWebSnapshotParams) { const timeoutMs = resolveTimeoutMs(params.timeoutMs); const body = session.page.locator("body"); await body.waitFor({ timeout: timeoutMs }); - const text = await body.innerText({ timeout: timeoutMs }); + const text = (await body.textContent({ timeout: timeoutMs })) ?? ""; const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) ? Math.max(1, Math.floor(params.maxChars)) diff --git a/extensions/qqbot/src/engine/messaging/outbound-deliver.ts b/extensions/qqbot/src/engine/messaging/outbound-deliver.ts index db218e0362f..92947165924 100644 --- a/extensions/qqbot/src/engine/messaging/outbound-deliver.ts +++ b/extensions/qqbot/src/engine/messaging/outbound-deliver.ts @@ -350,14 +350,11 @@ export async function parseAndSendMediaTags( return { handled: false, normalizedText: text }; } - const tagCounts = mediaTagMatches.reduce( - (acc, m) => { - const t = normalizeLowercaseStringOrEmpty(m[1]); - acc[t] = (acc[t] ?? 0) + 1; - return acc; - }, - {} as Record, - ); + const tagCounts = mediaTagMatches.reduce>((acc, m) => { + const t = normalizeLowercaseStringOrEmpty(m[1]); + acc[t] = (acc[t] ?? 0) + 1; + return acc; + }, {}); log?.debug?.( `Detected media tags: ${Object.entries(tagCounts) .map(([k, v]) => `${v} <${k}>`) diff --git a/src/agents/apply-patch.ts b/src/agents/apply-patch.ts index c6a8db2ab75..1c03906b483 100644 --- a/src/agents/apply-patch.ts +++ b/src/agents/apply-patch.ts @@ -407,9 +407,13 @@ function checkPatchBoundariesLenient(lines: string[]): string[] { throw new Error(strictError); } const first = lines[0]; - const last = lines[lines.length - 1]; - if ((first === "<>>( (acc, current) => { acc[current.reason] = (acc[current.reason] ?? 0) + 1; return acc; }, - {} as Partial>, + {}, ); log.warn("ignored invalid auth profile entries during store load", { source, diff --git a/src/agents/auth-profiles/state.ts b/src/agents/auth-profiles/state.ts index 90fc8291277..15cee136588 100644 --- a/src/agents/auth-profiles/state.ts +++ b/src/agents/auth-profiles/state.ts @@ -9,19 +9,18 @@ function normalizeAuthProfileOrder(raw: unknown): AuthProfileState["order"] { if (!raw || typeof raw !== "object") { return undefined; } - const normalized = Object.entries(raw as Record).reduce( - (acc, [provider, value]) => { - if (!Array.isArray(value)) { - return acc; - } - const list = value.map((entry) => normalizeOptionalString(entry) ?? "").filter(Boolean); - if (list.length > 0) { - acc[provider] = list; - } + const normalized = Object.entries(raw as Record).reduce< + Record + >((acc, [provider, value]) => { + if (!Array.isArray(value)) { return acc; - }, - {} as Record, - ); + } + const list = value.map((entry) => normalizeOptionalString(entry) ?? "").filter(Boolean); + if (list.length > 0) { + acc[provider] = list; + } + return acc; + }, {}); return Object.keys(normalized).length > 0 ? normalized : undefined; } diff --git a/src/logging/redact.ts b/src/logging/redact.ts index 6e21853e151..2be750805e2 100644 --- a/src/logging/redact.ts +++ b/src/logging/redact.ts @@ -110,7 +110,7 @@ function redactText(text: string, patterns: RegExp[]): string { let next = text; for (const pattern of patterns) { next = replacePatternBounded(next, pattern, (...args: string[]) => - redactMatch(args[0], args.slice(1, args.length - 2)), + redactMatch(args[0], args.slice(1, -2)), ); } return next; diff --git a/test/scripts/oxlint-config.test.ts b/test/scripts/oxlint-config.test.ts index 8e758c17f16..1be8ceef936 100644 --- a/test/scripts/oxlint-config.test.ts +++ b/test/scripts/oxlint-config.test.ts @@ -13,18 +13,36 @@ type OxlintTsconfig = { const ZERO_BASELINE_RULES = [ "eslint/no-div-regex", + "eslint/no-constructor-return", "eslint/no-extra-label", "eslint/no-lone-blocks", "eslint/no-multi-str", "eslint/no-proto", "eslint/no-regex-spaces", "eslint/no-sequences", + "eslint/no-self-compare", "eslint/prefer-exponentiation-operator", "eslint/prefer-numeric-literals", "eslint/unicode-bom", + "import/no-absolute-path", + "import/no-empty-named-blocks", + "import/no-self-import", + "node/no-exports-assign", + "promise/no-new-statics", + "typescript/adjacent-overload-signatures", + "typescript/ban-tslint-comment", "typescript/no-non-null-asserted-nullish-coalescing", + "typescript/no-unnecessary-qualifier", + "typescript/prefer-find", + "typescript/prefer-reduce-type-parameter", "typescript/prefer-return-this-type", + "unicorn/consistent-date-clone", + "unicorn/consistent-template-literal-escape", + "unicorn/no-console-spaces", "unicorn/no-useless-error-capture-stack-trace", + "unicorn/prefer-dom-node-text-content", + "unicorn/prefer-keyboard-event-key", + "unicorn/prefer-negative-index", "unicorn/prefer-optional-catch-binding", "unicorn/require-array-join-separator", "unicorn/throw-new-error",