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:
parent
5bbb8bfbaa
commit
7918ba052a
2 changed files with 12 additions and 22 deletions
|
|
@ -15,21 +15,6 @@ async function getDOMParser(): Promise<typeof DOMParser> {
|
|||
return _LinkedDOMParser;
|
||||
}
|
||||
|
||||
export function parseGpx(xml: string): GpxData {
|
||||
// Synchronous path for browser
|
||||
if (typeof DOMParser !== "undefined") {
|
||||
return parseGpxWithParser(new DOMParser(), xml);
|
||||
}
|
||||
// Fallback: try linkedom synchronously (works in Node with top-level await or CJS)
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { DOMParser: LP } = require("linkedom");
|
||||
return parseGpxWithParser(new LP() as unknown as DOMParser, xml);
|
||||
} catch {
|
||||
throw new Error("DOMParser not available — install linkedom");
|
||||
}
|
||||
}
|
||||
|
||||
export async function parseGpxAsync(xml: string): Promise<GpxData> {
|
||||
const Parser = await getDOMParser();
|
||||
return parseGpxWithParser(new Parser(), xml);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue