Repository navigation
feat(frontend): add oxlint + tsgolint for type-aware linting - #290
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
oxlintwith its type-aware backendoxlint-tsgolint, wired into CI (test.ymllint-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-checkandsvelte2tsxare blocked on the same missing API and cap at TS6, andtscdoesn't typecheck.sveltetemplates — 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:
svelterule namespace at all. Verified oxlint does lint.svelte<script>blocks — it caughtno-debuggerandno-evalin a probe file — but not markup, sosvelte/button-has-typeandeslint-plugin-svelte's recommended set don't carry over. 95 of 206 source files are.svelte.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/stylisticTypeCheckedsets the config relies on.Config is scoped deliberately
Enabling oxlint's
unicorn/import/promiseplugins and itscorrectness+suspiciouscategories 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-conditionandstrict-boolean-expressionsand 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 cwdfrontend/. 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-committhrowsJSON Parse error: Property name must be a string literalonbun.lock— and exits 0, so the pre-commit version pins have been silently failing to sync. Reproduces identically onmain, so it predates this change.