Skip to content

feat(frontend): add oxlint + tsgolint for type-aware linting - #290

Merged
robcohen merged 2 commits into
mainfrom
chore/oxlint-tsgolint
Aug 21, 2026
Merged

robcohen merged 2 commits into
mainfrom
chore/oxlint-tsgolint

Conversation

@robcohen

Copy link
Copy Markdown
Member

Adds oxlint with its type-aware backend oxlint-tsgolint, wired into CI (test.yml lint-js) and pre-commit.

Why tsgolint

It implements type-aware rules in Go against typescript-go directly, rather than reaching into the TypeScript JS API. That API is exactly what breaks every JS-based tool under TypeScript 7 — it doesn't exist yet in the native port. typescript-eslint's tracking issue (#10940) is labelled "blocked by external API", and its maintainer stated in July there's nothing they can do until a stable JS API ships.

This does not unblock TypeScript 7 (#282). svelte-check and svelte2tsx are blocked on the same missing API and cap at TS6, and tsc doesn't typecheck .svelte templates — so there's no route to TS7 today regardless of linter choice. This is a step toward readiness, plus a much faster type-aware pass.

Added, not swapped

oxlint can't replace eslint here, and I'd rather say so than quietly lose coverage:

  • No svelte rule namespace at all. Verified oxlint does lint .svelte <script> blocks — it caught no-debugger and no-eval in a probe file — but not markup, so svelte/button-has-type and eslint-plugin-svelte's recommended set don't carry over. 95 of 206 source files are .svelte.
  • No naming-convention, no-restricted-syntax, or import sorting (simple-import-sort).

Everything else maps: 10 of the 12 explicitly configured rules exist, and tsgolint implements 59 typed rules, covering the strictTypeChecked / stylisticTypeChecked sets the config relies on.

Config is scoped deliberately

Enabling oxlint's unicorn/import/promise plugins and its correctness+suspicious categories wholesale produced 90 findings from rules this project never opted into — new opinions dressed up as a migration. The committed config enables only what eslint already enforces, and the codebase is clean under it.

Verified not vacuous

A rule set that only ever reports clean is not evidence. With a probe containing a floating promise and an always-falsy condition, oxlint reports require-await, no-floating-promises, no-unnecessary-condition and strict-boolean-expressions and exits 1; removing the probe returns it to exit 0.

Also checked the failure mode that would matter most: oxlint resolves the tsgolint binary from the nearest node_modules, so both the CI step and the hook run with cwd frontend/. If tsgolint is absent it exits non-zero with a clear message rather than silently skipping every type-aware rule.

Verification

All seven frontend gates pass: eslint, stylelint, tsc, svelte-check, oxlint, build, test.

Noted, not fixed

bun run sync-pre-commit throws JSON Parse error: Property name must be a string literal on bun.lock — and exits 0, so the pre-commit version pins have been silently failing to sync. Reproduces identically on main, so it predates this change.

robcohen and others added 2 commits August 21, 2026 19:32
Adds oxlint with its type-aware backend (oxlint-tsgolint) alongside the
existing linters, wired into CI and pre-commit.

Why tsgolint specifically: it implements type-aware rules in Go against
typescript-go directly, rather than reaching into the TypeScript JS API.
That API is what breaks every JS-based tool under TypeScript 7 — it does
not exist yet in the native port. typescript-eslint's own tracking issue
(#10940) is labelled "blocked by external API" and its maintainer stated
in July there is nothing they can do until a stable JS API ships.

This does NOT unblock TypeScript 7 (see #282). svelte-check and
svelte2tsx are blocked on the same missing API and cap at TS6, and tsc
does not typecheck .svelte templates, so there is no route to TS7 today.
This is a step toward being ready, plus a much faster type-aware pass.

Added rather than swapped, because oxlint cannot replace eslint here:

  - no svelte rule namespace at all, so eslint-plugin-svelte's template
    rules have no equivalent. Verified: oxlint lints .svelte <script>
    blocks (it caught no-debugger and no-eval in one) but not markup, so
    svelte/button-has-type does not carry over. 95 of 206 source files
    are .svelte.
  - no naming-convention, no-restricted-syntax, or import sorting
    (simple-import-sort).

Everything else maps: 10 of the 12 explicitly configured rules exist,
and tsgolint implements 59 typed rules, covering the strictTypeChecked
and stylisticTypeChecked sets the config relies on.

The config is deliberately scoped to what eslint already enforces.
Enabling oxlint's unicorn/import/promise plugins and its correctness and
suspicious categories wholesale produced 90 findings from rules this
project never opted into, which would have been new opinions dressed up
as a migration.

Verified the config is not vacuous: with a probe file containing a
floating promise and an always-falsy condition, oxlint reports
require-await, no-floating-promises, no-unnecessary-condition and
strict-boolean-expressions and exits 1; removing the probe returns it to
exit 0. A rule set that only ever reports clean is not evidence.

oxlint resolves the tsgolint binary from the nearest node_modules, so
both the CI step and the hook run with cwd frontend/. If tsgolint is
absent it exits non-zero with a clear message rather than silently
skipping every type-aware rule, which is the failure mode that would
matter most here.

All seven frontend gates pass: eslint, stylelint, tsc, svelte-check,
oxlint, build, test.
@robcohen
robcohen merged commit 78da252 into main Aug 21, 2026
33 checks passed
@robcohen
robcohen deleted the chore/oxlint-tsgolint branch August 21, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant