Skip to content

ci(lint): enable type-aware linting with no-floating-promises and no-misused-promises (#836) - #863

Merged
jeff-r2026 merged 3 commits into
Tencent:mainfrom
SaulMoro:ci/oxlint-type-aware
Sep 29, 2026
Merged

jeff-r2026 merged 3 commits into
Tencent:mainfrom
SaulMoro:ci/oxlint-type-aware

Conversation

@SaulMoro

@SaulMoro SaulMoro commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Turns on oxlint's type-aware mode with typescript/no-floating-promises and typescript/no-misused-promises, the next rule set in #836. tsc reports neither a promise that nobody awaits nor an async callback passed to an API that ignores its result. In a CLI that is an error nobody sees. main has 28 hits, 5 in prod (including scripts/) and 23 in tests. This PR fixes all of them without suppression comments.

 package.json
-  "lint": "oxlint --deny-warnings --report-unused-disable-directives",
+  "lint": "oxlint --type-aware --deny-warnings --report-unused-disable-directives",
+  "oxlint-tsgolint": "7.0.2003"          (devDependency, exact pin like oxlint)
  • oxlint-tsgolint 7.0.2003 is the latest release. oxlint 1.85.0 declares it as an optional peer dependency, >=7.0.2001. It has no engines field and no install script, and the platform binary comes from an optional dependency. So npm ci --ignore-scripts installs it in both ci.yml (Node 20 and 22, Ubuntu and macOS) and .coding-ci.yaml, and neither file changes. Both already run npm run lint.
  • --type-aware also turns on oxlint's default type-aware rules. Nine of them stay off: the seven with hits on this branch (unbound-method, no-base-to-string, await-thenable, restrict-template-expressions, require-array-sort-compare, no-redundant-type-constituents, no-implied-eval), plus no-duplicate-type-constituents and no-meaningless-void-operator, which have none. Each needs its own evaluation (counts below), so each is a follow-up under oxlint rollout: bugs found in the baseline, and next rules to evaluate #836. .oxlintrc.json lists only rules that would otherwise run. The remaining defaults stay on: no-array-delete, no-for-in-array, no-misused-spread, no-unsafe-unary-minus and no-useless-default-assignment. Only the last one had a hit.
  • Under src/__tests__/**, no-misused-promises skips checksVoidReturn.arguments. vi.spyOn(fse, …) types the spy from fs-extra's last overload, the callback one that returns void, so every correct async mockImplementation is flagged (17 sites). The only per-site fix is a type assertion. The override also covers the async createServer handler in helpers/mock-server.ts, where an unhandled rejection already fails the vitest run. no-floating-promises stays fully on in tests.
Where Rule Hit Fix
dashboard.ts:83, SSE debounce misused setTimeout(async () => …) Named pushSessions, called as setTimeout(() => void pushSessions(), 200). Its body already catches everything.
dashboard.ts:109, PID check misused setInterval(async () => …) The same, as checkPids
dashboard.ts:144, HTTP handler misused http.createServer(async …) Now handleRequest. createServer catches its rejection, logs it at debug and answers 500.
import-repo-list.ts:149 floating The array returned by splice was dropped In-flight imports are tracked in a Set
scripts/mock-teamai-server.mjs:54 misused http.createServer(async …) The same wrapper. A malformed JSON body used to crash the mock; it now gets a 500.
ai-client.test.ts ×2 floating Promise.resolve().then(…) to schedule mock events queueMicrotask(…)
utils/pre-push-sync.ts:59 no-useless-default-assignment placedRules: … | undefined = undefined placedRules?: (type-only)

None of the prod hits was a lost error in practice. The dashboard's timers already catch everything inside, and processEntry in import-repo-list.ts catches every import failure. Runtime behavior changes on one path only, and I found nothing that reaches it. An unexpected rejection in the dashboard's request handler used to reach the dashboard's uncaughtException handler and shut it down. It is now logged at debug and answered with a 500. The calls that run before the first route's try (readEvents, dashboardWorkspaces) already catch their own errors.

Refs #836.

Next candidates for #836

Hits on this branch for each type-aware rule that does not run here, counted with each rule turned on alone. The non-default ones (consistent-return, no-unnecessary-*, no-unsafe-type-assertion) are off because oxlint leaves them off, not because the config lists them.

Rule Prod Tests Note
unbound-method 2 328 About 300 of the test hits are bare log.warn / vi.mocked(log.warn). Declaring log's functions as arrow functions (none reads this) clears them at the source.
no-base-to-string 11 12 Prod: String(x) on parsed YAML/JSON (review-cmd.ts, iwiki-client.ts, local-agent.ts, projects.ts, roles.ts, marketplace.ts, source.ts) prints [object Object] for an object value. A scalarText(value): string | undefined helper, with each site keeping its current fallback, would fix it.
await-thenable 1 7 Promise.all over a mix of values and promises in dashboard-scope.ts, and await on sync values in tests
restrict-template-expressions 4 0 ${err instanceof Error ? err.message : err} in catch blocks
require-array-sort-compare 1 3
no-redundant-type-constituents 2 0
no-implied-eval 0 1 new Function(js) as a syntax check in dashboard-ui.test.ts
consistent-return 10 0
no-unnecessary-type-assertion 37 133
no-unnecessary-type-conversion 9 59
no-unnecessary-boolean-literal-compare 4 9
no-unnecessary-type-arguments, no-unnecessary-type-parameters 2 0
no-unsafe-type-assertion 699 637
no-duplicate-type-constituents, no-meaningless-void-operator 0 0

Evidence

  • Before: on main at a8ab8e00, npx oxlint --type-aware -A all -W typescript/no-floating-promises -W typescript/no-misused-promises gives 28 warnings. npm run lint doesn't run them.
  • After: npm run lint gives 0 warnings and exits 0. With throwaway probe files it exits 1:
    src/zz-probe.ts:2:39: warning typescript(no-floating-promises): Promises must be awaited, add void operator to ignore.
    src/zz-probe.ts:3:61: warning typescript(no-misused-promises): Promise returned in function argument where a void return was expected.
    src/__tests__/zz-probe.test.ts:2:23: warning typescript(no-floating-promises): Promises must be awaited, add void operator to ignore.
    probe lint exit=1
    
  • Lint time: npm run lint takes about 0.55 s warm and 1.4 s cold. Without --type-aware it takes 0.2 s.
  • npx tsc --noEmit is clean and npm run build succeeds. npx vitest run --maxWorkers=2 on Node 22 gives 5166 passed, 1 skipped and 14 failed, all Test timed out in 15000ms in git-kind-reports.test.ts and git-kind-learnings.test.ts, on a loaded machine. Neither file touches code this PR changes. Re-run alone, both pass (31 tests).
  • No real-CLI e2e is required: the change is CI and lint only, with behavior-neutral fixes. The dashboard server and the mock server have no unit tests, so I ran each once. The built teamai dashboard, run under an isolated HOME, serves every route through the new wrapper:
    200 / <!doctype html> <html lang="en">…
    200 /api/workspaces [{"id":"user","label":"User scope","scope":"user",…
    200 /api/sessions []
    400 /api/sessions?workspace=nope {"error":"Unknown workspace"}
    404 /nope Not Found
    
    scripts/mock-teamai-server.mjs answers a malformed body and keeps serving:
    500 {not json {"error":"internal error"}
    200 {"ok":1} {"ok":true,"instance_id":"local-mock-abc123"}
    [error] Expected property name or '}' in JSON at position 1 (line 1 column 2)
    
  • Docs: unchanged. The command is still npm run lint, and the Node requirement in CONTRIBUTING.md, AGENTS.md and CLAUDE.md still holds, since oxlint-tsgolint declares no engines.

Merge Danger

Door: two-way

Blast Radius: contributors

Every PR opened after this one must pass the two type-aware rules. The warning text says what to change: await it, return it, or mark a deliberate fire-and-forget with void after handling its errors. Both packages are pinned exactly, so new type-aware defaults arrive only through a deliberate version bump. Reverting is a single revert.

…misused-promises

tsc does not report a promise nobody awaits or an async callback handed to an
API that ignores its result. In a CLI that is an error nobody sees. oxlint's
--type-aware mode checks both through oxlint-tsgolint.

- package.json: add oxlint-tsgolint 7.0.2003 (oxlint 1.85.0 needs
  >=7.0.2001) and pass --type-aware to `npm run lint`. The package ships
  prebuilt binaries as optional dependencies with no install script, so CI's
  `npm ci --ignore-scripts` needs no change.
- .oxlintrc.json: turn on typescript/no-floating-promises and
  typescript/no-misused-promises. Under src/__tests__/**, no-misused-promises
  skips checksVoidReturn.arguments: vi.spyOn(fse, ...) types the spy from
  fs-extra's last overload, the callback one that returns void, so every
  correct async mockImplementation is flagged.
- --type-aware also turns on oxlint's default type-aware rules. The ones
  with hits on main stay off, since each is its own evaluation under Tencent#836.
  The rest of the defaults have no hits and stay on.

Fixes, all behavior-neutral:
- dashboard.ts: the SSE debounce and the PID check become named async
  functions called with `void`; both already catch everything they throw.
  The HTTP handler becomes handleRequest, and createServer catches its
  rejection, logs it and answers 500.
- import-repo-list.ts: track in-flight imports in a Set, so the unused array
  splice returned is gone.
- scripts/mock-teamai-server.mjs: same handler wrapper as the dashboard, so a
  malformed JSON body answers 500 instead of an unhandled rejection.
- ai-client.test.ts: schedule the mock process events with queueMicrotask.

Refs Tencent#836.
1 prod hit, type-only: syncTeamUpdatesToLocal's last parameter was
`placedRules: Record<string, string> | undefined = undefined`; it is now
`placedRules?: Record<string, string>`.

Refs Tencent#836.
consistent-return, no-unnecessary-boolean-literal-compare,
no-unnecessary-type-arguments, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, no-unnecessary-type-parameters and
no-unsafe-type-assertion are not default rules, so listing them as off
changed nothing. The config keeps off only the nine default type-aware rules that
--type-aware would turn on.
`oxlint --type-aware --print-config` gives the same set of active rules
before and after.

Refs Tencent#836.
@SaulMoro
SaulMoro force-pushed the ci/oxlint-type-aware branch from 0427a68 to af29427 Compare September 27, 2026 23:07
@jeff-r2026 jeff-r2026 self-assigned this Sep 28, 2026
@github-actions

Copy link
Copy Markdown

[P2 non-blocking] Narrow the test exemption — .oxlintrc.json:26. Disabling checksVoidReturn.arguments for all src/__tests__/** also hides genuine unsafe callbacks, including the async http.createServer handler in src/__tests__/helpers/mock-server.ts:68; malformed JSON rejects readBody, leaving the request unanswered and producing an unhandled rejection. Exempt only the affected mock implementations, or wrap this server handler as done in production.

The PR description includes sufficient real-CLI verification for its runtime changes.

@jeff-r2026
jeff-r2026 merged commit f19f9de into Tencent:main Sep 29, 2026
12 checks passed
STiFLeR7 added a commit to STiFLeR7/teamai-cli that referenced this pull request Oct 26, 2026
Enabling the suspicious/perf categories reaches the type-aware
typescript/* rules in those categories too, not just the plain
eslint/unicorn/oxc ones measured for Tencent#836. The real CI command
(oxlint --type-aware --deny-warnings) surfaced ~3287 warnings from
typescript/no-unsafe-type-assertion, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, consistent-return,
no-unnecessary-boolean-literal-compare, no-unnecessary-template-expression,
no-unnecessary-type-arguments, and no-unnecessary-type-parameters that
my local verification missed because it ran oxlint without
--type-aware.

Type-aware linting beyond no-floating-promises/no-misused-promises is
Tencent#863's separate, not-yet-merged scope. Turn those 8 rules off here,
matching the existing pattern already used for the other out-of-scope
typescript/* rules in this file.

Verified with the actual CI command this time: `npm run lint`
(oxlint --type-aware --deny-warnings --report-unused-disable-directives)
is clean, and so is `npx tsc --noEmit` and `npm run build`.
STiFLeR7 added a commit to STiFLeR7/teamai-cli that referenced this pull request Oct 26, 2026
Enabling the suspicious/perf categories reaches the type-aware
typescript/* rules in those categories too, not just the plain
eslint/unicorn/oxc ones measured for Tencent#836. The real CI command
(oxlint --type-aware --deny-warnings) surfaced ~3287 warnings from
typescript/no-unsafe-type-assertion, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, consistent-return,
no-unnecessary-boolean-literal-compare, no-unnecessary-template-expression,
no-unnecessary-type-arguments, and no-unnecessary-type-parameters that
my local verification missed because it ran oxlint without
--type-aware.

Type-aware linting beyond no-floating-promises/no-misused-promises is
Tencent#863's separate, not-yet-merged scope. Turn those 8 rules off here,
matching the existing pattern already used for the other out-of-scope
typescript/* rules in this file.

Verified with the actual CI command this time: `npm run lint`
(oxlint --type-aware --deny-warnings --report-unused-disable-directives)
is clean, and so is `npx tsc --noEmit` and `npm run build`.
STiFLeR7 added a commit to STiFLeR7/teamai-cli that referenced this pull request Oct 26, 2026
Enabling the suspicious/perf categories reaches the type-aware
typescript/* rules in those categories too, not just the plain
eslint/unicorn/oxc ones measured for Tencent#836. The real CI command
(oxlint --type-aware --deny-warnings) surfaced ~3287 warnings from
typescript/no-unsafe-type-assertion, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, consistent-return,
no-unnecessary-boolean-literal-compare, no-unnecessary-template-expression,
no-unnecessary-type-arguments, and no-unnecessary-type-parameters that
my local verification missed because it ran oxlint without
--type-aware.

Type-aware linting beyond no-floating-promises/no-misused-promises is
Tencent#863's separate, not-yet-merged scope. Turn those 8 rules off here,
matching the existing pattern already used for the other out-of-scope
typescript/* rules in this file.

Verified with the actual CI command this time: `npm run lint`
(oxlint --type-aware --deny-warnings --report-unused-disable-directives)
is clean, and so is `npx tsc --noEmit` and `npm run build`.
jeff-r2026 pushed a commit that referenced this pull request Oct 28, 2026
* ci(lint): enable oxlint suspicious and perf categories

Turn on the suspicious and perf rule categories per the plan in #836,
with an off list for the rules that don't find real bugs here:

- no-await-in-loop: sequential awaits are deliberate in a CLI (git,
  prompts, ordered writes); the rule can't tell an intentional
  ordering dependency from a parallelizable loop.
- unicorn/no-array-sort: every prod sort site sorts a local array
  built in the same function, so the in-place mutation warning
  doesn't apply.
- unicorn/consistent-function-scoping: moves closures to outer scope;
  style, not a bug class.
- no-underscore-dangle: conflicts with this repo's own `_` convention
  (`_setLogFilePath`, `_resetState`).
- oxc/no-map-spread: micro-optimization, not worth the churn.

no-shadow stays on: real shadowing bugs were found during triage (see
next commit).

Also bump the TS target to ES2023 so `Array#toReversed()` and
`Array#findLast()` (used by the fixes in the next commit) type-check;
Node 20+ already supports them at runtime, and ES2023 adds no new
syntax, so this only changes what the compiler's lib typings expose.

* fix(lint): clear the suspicious+perf warnings under the new gate

Fixes every warning oxlint's suspicious and perf categories report
with the off list from the previous commit applied, following each
rule's own meaning rather than a blanket find-replace:

- no-shadow: renamed the shadowing binding (never the outer one) at
  every site. Removed 8 redundant `await import('./utils/logger.js')`
  calls in index.ts; it already imports `log` at the top. Investigated
  the two shadows the issue specifically called out as real bugs
  (team-push.ts's destructured `dataHomeKey` hiding the imported
  function, dashboard-collector.ts's inner `events`/`stopAt` hiding
  the outer bindings): both are confined to their own block scope with
  no cross-use today, so the rename is the complete fix, not a logic
  change.
- no-unmodified-loop-condition: checked all 4 current hits (the issue
  named 1; the codebase grew since it was filed). None is a real bug.
  Each loop's exit condition is flipped by something the rule can't
  see from inside the loop body: a setTimeout closure registered
  before the loop (process-stop.ts, recall-attribution.test.ts), a
  compound condition where the other operand changes
  (resources/env.ts), or a property mutation on an object the rule
  only tracks by reassignment (workflow-skill-transitions.test.ts).
  Suppressed each with a narrow inline comment explaining why.
- preserve-caught-error: attached `{ cause }` to every rethrow, using
  the error actually caught by the nearest enclosing catch (two sites
  in local-agent.ts and one in resources/env.ts already attached the
  wrong, outer error to a throw inside a nested catch).
- unicorn/no-array-reverse: switched to `Array#toReversed()` (dropping
  any defensive `[...arr]` copy it made redundant); none of these
  sites relied on the in-place mutation.
- unicorn/prefer-array-find: `.filter(p)[0]` / `.filter(p).pop()`
  patterns became `.find(p)`; `.filter(p).at(-1)` / `.filter(p).pop()`
  where the last match (not the first) was wanted became
  `.findLast(p)` — using `.find()` there would have silently returned
  the wrong element.
- unicorn/prefer-set-has: converted to `Set` + `.has()`, except
  workflow/workspace.ts's `rest.includes(...)`, which is a string
  substring check the rule mistook for array membership (false
  positive, suppressed inline).
- no-useless-concat: merged adjacent string literals, except
  redact.test.ts's DSN fixtures, left alone (see inline comment) to
  not reassemble the exact secret-shaped literal its test author
  deliberately split to dodge a secret scanner.
- no-useless-constructor, unicorn/require-module-specifiers,
  oxc/no-accumulating-spread: removed the dead constructors, the
  empty `export {}` placeholder (the file itself was then empty, so
  deleted it), and the accumulator spread in workflow/drivers/skill/
  tick.ts.

Verified: `npx tsc --noEmit`, `npx oxlint --type-aware --deny-warnings
--report-unused-disable-directives` (the project's `npm run lint`),
and `npx vitest run` (15137 passed / 899 failed / 191 skipped) all
clean relative to main — the failures are pre-existing Windows
environment flakiness (EPERM on temp-dir cleanup, 15s test timeouts
under load), confirmed by running the same files against an unmodified
main checkout and getting the same failures. `npm run build` succeeds
and the built CLI runs end to end (`doctor`, `env --help`, `models
--help`, `push --dry-run`) against a scratch HOME.

* fix(lint): keep type-aware rules out of the suspicious/perf gate

Enabling the suspicious/perf categories reaches the type-aware
typescript/* rules in those categories too, not just the plain
eslint/unicorn/oxc ones measured for #836. The real CI command
(oxlint --type-aware --deny-warnings) surfaced ~3287 warnings from
typescript/no-unsafe-type-assertion, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, consistent-return,
no-unnecessary-boolean-literal-compare, no-unnecessary-template-expression,
no-unnecessary-type-arguments, and no-unnecessary-type-parameters that
my local verification missed because it ran oxlint without
--type-aware.

Type-aware linting beyond no-floating-promises/no-misused-promises is
#863's separate, not-yet-merged scope. Turn those 8 rules off here,
matching the existing pattern already used for the other out-of-scope
typescript/* rules in this file.

Verified with the actual CI command this time: `npm run lint`
(oxlint --type-aware --deny-warnings --report-unused-disable-directives)
is clean, and so is `npx tsc --noEmit` and `npm run build`.

* fix(lint): clear no-array-reverse warnings from a rebase onto main

Rebased onto upstream main (6 commits landed since this branch was
cut, including #1346 which added these .reverse() calls). Same fix
as the rest of this PR: switched to Array#toReversed(), since none of
these sites reuse the original array reference after reversing it.

* chore: retrigger CI (flaky run-lock timing test on Node 20/ubuntu)

* fix(update): rename shadowing entry var missed from previous merge commit
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
* ci(lint): enable oxlint suspicious and perf categories

Turn on the suspicious and perf rule categories per the plan in Tencent#836,
with an off list for the rules that don't find real bugs here:

- no-await-in-loop: sequential awaits are deliberate in a CLI (git,
  prompts, ordered writes); the rule can't tell an intentional
  ordering dependency from a parallelizable loop.
- unicorn/no-array-sort: every prod sort site sorts a local array
  built in the same function, so the in-place mutation warning
  doesn't apply.
- unicorn/consistent-function-scoping: moves closures to outer scope;
  style, not a bug class.
- no-underscore-dangle: conflicts with this repo's own `_` convention
  (`_setLogFilePath`, `_resetState`).
- oxc/no-map-spread: micro-optimization, not worth the churn.

no-shadow stays on: real shadowing bugs were found during triage (see
next commit).

Also bump the TS target to ES2023 so `Array#toReversed()` and
`Array#findLast()` (used by the fixes in the next commit) type-check;
Node 20+ already supports them at runtime, and ES2023 adds no new
syntax, so this only changes what the compiler's lib typings expose.

* fix(lint): clear the suspicious+perf warnings under the new gate

Fixes every warning oxlint's suspicious and perf categories report
with the off list from the previous commit applied, following each
rule's own meaning rather than a blanket find-replace:

- no-shadow: renamed the shadowing binding (never the outer one) at
  every site. Removed 8 redundant `await import('./utils/logger.js')`
  calls in index.ts; it already imports `log` at the top. Investigated
  the two shadows the issue specifically called out as real bugs
  (team-push.ts's destructured `dataHomeKey` hiding the imported
  function, dashboard-collector.ts's inner `events`/`stopAt` hiding
  the outer bindings): both are confined to their own block scope with
  no cross-use today, so the rename is the complete fix, not a logic
  change.
- no-unmodified-loop-condition: checked all 4 current hits (the issue
  named 1; the codebase grew since it was filed). None is a real bug.
  Each loop's exit condition is flipped by something the rule can't
  see from inside the loop body: a setTimeout closure registered
  before the loop (process-stop.ts, recall-attribution.test.ts), a
  compound condition where the other operand changes
  (resources/env.ts), or a property mutation on an object the rule
  only tracks by reassignment (workflow-skill-transitions.test.ts).
  Suppressed each with a narrow inline comment explaining why.
- preserve-caught-error: attached `{ cause }` to every rethrow, using
  the error actually caught by the nearest enclosing catch (two sites
  in local-agent.ts and one in resources/env.ts already attached the
  wrong, outer error to a throw inside a nested catch).
- unicorn/no-array-reverse: switched to `Array#toReversed()` (dropping
  any defensive `[...arr]` copy it made redundant); none of these
  sites relied on the in-place mutation.
- unicorn/prefer-array-find: `.filter(p)[0]` / `.filter(p).pop()`
  patterns became `.find(p)`; `.filter(p).at(-1)` / `.filter(p).pop()`
  where the last match (not the first) was wanted became
  `.findLast(p)` — using `.find()` there would have silently returned
  the wrong element.
- unicorn/prefer-set-has: converted to `Set` + `.has()`, except
  workflow/workspace.ts's `rest.includes(...)`, which is a string
  substring check the rule mistook for array membership (false
  positive, suppressed inline).
- no-useless-concat: merged adjacent string literals, except
  redact.test.ts's DSN fixtures, left alone (see inline comment) to
  not reassemble the exact secret-shaped literal its test author
  deliberately split to dodge a secret scanner.
- no-useless-constructor, unicorn/require-module-specifiers,
  oxc/no-accumulating-spread: removed the dead constructors, the
  empty `export {}` placeholder (the file itself was then empty, so
  deleted it), and the accumulator spread in workflow/drivers/skill/
  tick.ts.

Verified: `npx tsc --noEmit`, `npx oxlint --type-aware --deny-warnings
--report-unused-disable-directives` (the project's `npm run lint`),
and `npx vitest run` (15137 passed / 899 failed / 191 skipped) all
clean relative to main — the failures are pre-existing Windows
environment flakiness (EPERM on temp-dir cleanup, 15s test timeouts
under load), confirmed by running the same files against an unmodified
main checkout and getting the same failures. `npm run build` succeeds
and the built CLI runs end to end (`doctor`, `env --help`, `models
--help`, `push --dry-run`) against a scratch HOME.

* fix(lint): keep type-aware rules out of the suspicious/perf gate

Enabling the suspicious/perf categories reaches the type-aware
typescript/* rules in those categories too, not just the plain
eslint/unicorn/oxc ones measured for Tencent#836. The real CI command
(oxlint --type-aware --deny-warnings) surfaced ~3287 warnings from
typescript/no-unsafe-type-assertion, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, consistent-return,
no-unnecessary-boolean-literal-compare, no-unnecessary-template-expression,
no-unnecessary-type-arguments, and no-unnecessary-type-parameters that
my local verification missed because it ran oxlint without
--type-aware.

Type-aware linting beyond no-floating-promises/no-misused-promises is
Tencent#863's separate, not-yet-merged scope. Turn those 8 rules off here,
matching the existing pattern already used for the other out-of-scope
typescript/* rules in this file.

Verified with the actual CI command this time: `npm run lint`
(oxlint --type-aware --deny-warnings --report-unused-disable-directives)
is clean, and so is `npx tsc --noEmit` and `npm run build`.

* fix(lint): clear no-array-reverse warnings from a rebase onto main

Rebased onto upstream main (6 commits landed since this branch was
cut, including Tencent#1346 which added these .reverse() calls). Same fix
as the rest of this PR: switched to Array#toReversed(), since none of
these sites reuse the original array reference after reversing it.

* chore: retrigger CI (flaky run-lock timing test on Node 20/ubuntu)

* fix(update): rename shadowing entry var missed from previous merge commit
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…misused-promises (Tencent#836) (Tencent#863)

* ci(lint): enable type-aware linting with no-floating-promises and no-misused-promises

tsc does not report a promise nobody awaits or an async callback handed to an
API that ignores its result. In a CLI that is an error nobody sees. oxlint's
--type-aware mode checks both through oxlint-tsgolint.

- package.json: add oxlint-tsgolint 7.0.2003 (oxlint 1.85.0 needs
  >=7.0.2001) and pass --type-aware to `npm run lint`. The package ships
  prebuilt binaries as optional dependencies with no install script, so CI's
  `npm ci --ignore-scripts` needs no change.
- .oxlintrc.json: turn on typescript/no-floating-promises and
  typescript/no-misused-promises. Under src/__tests__/**, no-misused-promises
  skips checksVoidReturn.arguments: vi.spyOn(fse, ...) types the spy from
  fs-extra's last overload, the callback one that returns void, so every
  correct async mockImplementation is flagged.
- --type-aware also turns on oxlint's default type-aware rules. The ones
  with hits on main stay off, since each is its own evaluation under Tencent#836.
  The rest of the defaults have no hits and stay on.

Fixes, all behavior-neutral:
- dashboard.ts: the SSE debounce and the PID check become named async
  functions called with `void`; both already catch everything they throw.
  The HTTP handler becomes handleRequest, and createServer catches its
  rejection, logs it and answers 500.
- import-repo-list.ts: track in-flight imports in a Set, so the unused array
  splice returned is gone.
- scripts/mock-teamai-server.mjs: same handler wrapper as the dashboard, so a
  malformed JSON body answers 500 instead of an unhandled rejection.
- ai-client.test.ts: schedule the mock process events with queueMicrotask.

Refs Tencent#836.

* ci(lint): turn on typescript/no-useless-default-assignment

1 prod hit, type-only: syncTeamUpdatesToLocal's last parameter was
`placedRules: Record<string, string> | undefined = undefined`; it is now
`placedRules?: Record<string, string>`.

Refs Tencent#836.

* ci(lint): list only the type-aware rules that would otherwise run as off

consistent-return, no-unnecessary-boolean-literal-compare,
no-unnecessary-type-arguments, no-unnecessary-type-assertion,
no-unnecessary-type-conversion, no-unnecessary-type-parameters and
no-unsafe-type-assertion are not default rules, so listing them as off
changed nothing. The config keeps off only the nine default type-aware rules that
--type-aware would turn on.
`oxlint --type-aware --print-config` gives the same set of active rules
before and after.

Refs Tencent#836.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants