diff --git a/.oxlintrc.json b/.oxlintrc.json index 1a8119d65e..5cc6ed8952 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -50,13 +50,13 @@ "rea/no-evidence-json-preadmission": "error", "rea/no-positional-tool-contract": "error", "rea/no-fixture-root-cleanup": "error", - "typescript/no-floating-promises": "warn", + "typescript/no-floating-promises": "error", "typescript/no-misused-promises": "warn", - "typescript/return-await": ["warn", "error-handling-correctness-only"], + "typescript/return-await": ["error", "error-handling-correctness-only"], "typescript/switch-exhaustiveness-check": [ - "warn", + "error", { - "considerDefaultExhaustiveForUnions": false + "considerDefaultExhaustiveForUnions": true } ] }, @@ -148,9 +148,29 @@ } }, { - "files": ["src/**/*.test.ts"], + "files": [ + "scripts/lib/http3-capture-assertions.test.mjs", + "scripts/lib/http3-verifier-lifecycle.test.mjs" + ], "rules": { - "typescript/no-floating-promises": "error" + "typescript/no-floating-promises": [ + "error", + { + "allowForKnownSafeCalls": [ + { + "from": "package", + "package": "@types/node", + "name": "test" + } + ] + } + ] + } + }, + { + "files": ["scripts/fixtures/javascript-recovery/code-split/entry.mjs"], + "rules": { + "typescript/no-floating-promises": "off" } } ], diff --git a/docs/testing.md b/docs/testing.md index f9dc40c84a..553cf71d27 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -169,14 +169,24 @@ deletion; mutable bindings and mixed root arrays remain outside its scope. Focused `.only` declarations, broken assertion promise chains, and unused disable directives are errors. `vitest/valid-expect` warns (`maxArgs: 2`) because valid stored and collected assertions can be awaited later. `import/no-duplicates` warns with -`preferInline: false`, preserving separate type imports. +`preferInline: false`. Fast lint stays syntax-based. `npm run lint:typed` runs serially with pinned `oxlint-tsgolint` 7.0.2005 and records native plus typed diagnostics in `.cache/static-checks/typed-oxlint.json`. Production `src` treats `no-misused-promises` as an error; tests/fixtures warn. `no-floating-promises` is -an error in `src/**/*.test.ts`; other scopes, return-await and exhaustiveness -findings warn pending triage. +an error throughout the lint inventory. `return-await` is an error in +error-handling scopes so asynchronous completion stays inside its catch or +cleanup boundary. Exhaustiveness is an error when a union member has neither a +case nor a default. Intentional defaults count as handling the remaining union; +new members covered by those defaults therefore require behavioral review. + +Two HTTP/3 source-test files allow the runner-owned `node:test` registration API; +ordinary unowned promises in those files still fail. The authored code-split +recovery input is exempt from floating-promise policy because it is analysis +input, rather than application orchestration. Preserve framework-owned callbacks +such as an awaited `Promise.finally`; inspect the actual completion owner before +changing a callback solely to satisfy its declared `void` return type. `npm run knip:production` writes advisory candidates to `.cache/static-checks/production-reachability.json`; execution/report errors fail. diff --git a/scripts/fixtures/browser-network-site.mjs b/scripts/fixtures/browser-network-site.mjs index 6973ce4055..7e8cc64b50 100644 --- a/scripts/fixtures/browser-network-site.mjs +++ b/scripts/fixtures/browser-network-site.mjs @@ -1,5 +1,5 @@ +import { createVerifierHttpServer } from "../lib/verifier-http-server.mjs"; import { once } from "node:events"; -import { createServer } from "node:http"; import { gzipSync } from "node:zlib"; export const networkFixtureSecret = "私密-network-fixture"; @@ -23,7 +23,7 @@ const html = `