chore(ts): drop the last 2 \eslint-disable\ comments in prod code

After this, \`grep -rn 'eslint-disable' apps/ packages/\` returns 0
(excluding tests and node_modules).

**\`apps/planner/app/lib/brouter.ts\`** — \`while (true)\` in
\`readBodyWithCap\` tripped \`no-constant-condition\`. Replaced with
\`for (;;)\` which the rule explicitly allows. No behavior change.

**\`packages/gpx/src/parse.ts\`** — the sync \`parseGpx\` exported a
fallback path that did \`require(\"linkedom\")\` for non-browser sync
use, with an \`eslint-disable\` for \`no-require-imports\`. It was dead
code: \`packages/gpx/src/index.ts\` only re-exports \`parseGpxAsync\`,
and grepping the monorepo finds no caller of the sync version. Deleted
the function entirely; \`getDOMParser\` (the async helper) still serves
the async path with a clean ESM \`await import(\"linkedom\")\`.

Full repo: pnpm typecheck / lint / test all green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-05-26 07:31:12 +02:00
parent 5bbb8bfbaa
commit 7918ba052a
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
2 changed files with 12 additions and 22 deletions

View file

@ -79,22 +79,27 @@ export async function readBodyWithCap(response: Response, maxBytes: number): Pro
if (Number.isFinite(declared) && declared > maxBytes) {
throw new BRouterError(`response too large (${declared} bytes)`, 502);
}
// Stream the body, abort once we've seen `maxBytes`.
// Stream the body, abort once we've seen `maxBytes`. The read +
// done-check live in the for header so the loop reads as "iterate
// over reads until done"; TS narrows `chunk.value` to Uint8Array
// inside the body because the false-done branch rules out
// `{ done: true, value: undefined }`.
const reader = response.body?.getReader();
if (!reader) return await response.text();
const decoder = new TextDecoder();
let received = 0;
let out = "";
// eslint-disable-next-line no-constant-condition
while (true) {
const { value, done } = await reader.read();
if (done) break;
received += value.byteLength;
for (
let chunk = await reader.read();
!chunk.done;
chunk = await reader.read()
) {
received += chunk.value.byteLength;
if (received > maxBytes) {
try { await reader.cancel(); } catch { /* ignore */ }
throw new BRouterError(`response exceeded ${maxBytes} bytes`, 502);
}
out += decoder.decode(value, { stream: true });
out += decoder.decode(chunk.value, { stream: true });
}
out += decoder.decode();
return out;