chore: oxlint with type-aware rules, in CI (#325)

Merged
AL
5h ago
+359-27

Closes #325: a linter. pnpm lint runs oxlint with its type-aware rules, in CI's checks job after the type check.

Why oxlint
typescript-eslint takes TypeScript below 6.1, and the repository is on TypeScript 7, so its type-aware rules cannot run here. oxlint's run on tsgolint, built on TypeScript 7's own compiler. The whole repository lints in under two seconds.

What it found and what changed

  • Promises nobody awaited (9): VS Code's preview server and browser copies, the MCP server's preview, the frame's font wait, two demo handlers. Each is meant to run on its own, so each is now marked void.
  • cmi5's request helper spread a caller's headers into an object, which drops them for a Headers or a list of pairs. No caller passed any, so it now takes none.
  • Small things: unused imports and variables, an empty export {}, three regexes that are startsWith/endsWith, three spreads of ?? {}, an unsafe optional chain in a test.
  • Wrong for this code: off in .oxlintrc.json, each with its reason. For example, unbound-method reads destructured closures as methods, and the entry-name checks match control characters on purpose. Four single findings are disabled on their line with the reason, such as two await-thenables that a narrowing TypeScript cannot follow made up.
  • Skipped: H5P's vendored core, lz-string as shipped, the pack's generated index.

Rule: design/build.md, Lint, with pnpm lint in AGENTS.md and design/commands.md. No style rules and no formatter.

Tests: player unit 414, author 335, cmi5 50, embed 83, demo 22, VS Code 30, MCP 24; typecheck and comments pass.

Release: none.


Summary by cubic

Adds oxlint with its type-aware rules as pnpm lint, run in CI's checks job after the type check. typescript-eslint cannot run type-aware rules on this repository's TypeScript 7, so the lint uses oxlint's tsgolint, built on TypeScript 7's own compiler, instead.

Fixes

  • Nine unawaited promises meant to run independently are marked void across the preview server, browser copies, MCP preview, frame boot, and demo handlers.
  • cmi5's request helper no longer accepts headers; a spread of a Headers or pair list would have dropped them, and no caller passed any.
  • Removed unused imports and variables, an empty export {}, and replaced regexes and ?? {} spreads with simpler forms.
  • Rules wrong for this code are off in .oxlintrc.json with reasons; a few single findings are disabled on their lines.
  • Skips H5P's vendored core, lz-string as shipped, and the pack's generated index; no style rules or formatter.