mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
Enables oxlint's `erasing-op` rule and fixes the one violation it found, an operator precedence bug in `usePaginatedQuery`. When the requested page reports a count of 0, the hook refetches page 1 to compute where to clamp. `Math.ceil(firstPageResult?.count ?? 0 / limit)` parsed as `count ?? (0 / limit)`, so it used the record count as the page count and left the user on the overshot page. The fix adds parentheses, and a regression test covers it (the test fails without the fix). <details> <summary>Context and findings</summary> Part of evaluating oxlint's `correctness` category. Turning on the whole category reported 1152 diagnostics across 24 rules, so rules are being enabled one at a time instead, which keeps the explicit allowlist model in `.oxlintrc.jsonc`. `erasing-op` had a single hit, and it was a real bug. Validation: `pnpm run lint` (Biome, oxlint, types, circular deps, React Compiler, knip) and the full unit suite. </details> _Generated by Coder Agents on behalf of @jeremyruppel._