mirror of
https://github.com/Tencent/teamai-cli.git
synced 2026-10-02 03:14:40 +08:00
* 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 #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 #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 #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 #836.