Urgent.News

What's breaking now, across thousands of outlets.

Tech

tsgolint Reaches Stable v7, Bringing Go-Powered Type-Aware Linting to Oxlint

tsgolint has released a stable v7, enhancing TypeScript linting with native Go speed. It offers type-aware linting, leveraging TypeScript's semantic analysis through the typescript-go compiler. Oxlint manages configurations and file discovery. The release, compatible with TypeScript 7.0.2, handles 59 of 61 type-aware rules and shows significant performance improvements over ESLint. By Daniel…

tsgolint, the type-aware linting engine powering Oxlint, has reached a stable v7 release, introducing native Go speed to TypeScript lint rules typically processed through ESLint. By leveraging TypeScript semantic analysis via the official Go port of the compiler, typescript-go, tsgolint efficiently manages rules requiring type-checking, like verifying if promises are awaited.

Oxlint, written in Rust, deals with file discovery, configuration, and less intensive syntactic rules before offloading type-aware work to the Go binary, which delivers structured diagnostics. The v7 release aligns with TypeScript v7.0.2 and supports 59 of the 61 type-aware rules from typescript-eslint, an increase from 43 in the December alpha.

Adding the --type-check flag reports compiler errors alongside lint diagnostics, while both can be preset in an oxlint.config.ts or .oxlintrc.json file. The new release also provides per-rule timings, displayed with oxlint --type-aware --debug, allowing teams to identify which type-aware rules slow down the process. Benchmarks indicate that the stable build is 12 to 18 times faster than ESLint with typescript-eslint on popular projects such as microsoft/vscode, microsoft/typescript, typeorm, and vuejs/core on Apple M4 Pro.

Jöökull Solberg believes that aligning with tsgo is the right long-term strategy, as it inherits all future optimizations from the TypeScript team while maintaining compatibility with typescript-eslint's rule surface. Biome, another project, can also benefit from tsgo, but currently uses its own type synthesis method, resulting in a gap in catching certain errors compared to typescript-eslint.

The typescript-eslint team considers their tsgolint fork an experimental project that is not actively developed. Oxlint's core team continues refining correctness, addressing issues like autofixes that erroneously remove required type assertions. ESLint users can migrate to the new type-aware linting system using npx @oxlint/migrate --type-aware, although this requires TypeScript 7.0 or later, which may not be compatible with some legacy tsconfig options or removed TypeScript 6 features.

The quick transition from the experimental 0.x line to stable v7 was intentional, as tsgolint now matches the compiler version it embeds, tsgolint v7.0.2000, corresponding to TypeScript 7.0.2. Moving forward, the focus is on finalizing rules, improving editor integration, and enhancing monorepo performance. Linting, the static analysis step that flags potential bugs and enforces conventions, can be resource-intensive when employing type-aware linting, necessitating a real program type model to answer questions that a single file cannot.

Oxlint's integration of tsgolint allows the suite of Rust-based JavaScript tools developed by VoidZero, founded by Evan You, to leverage the real compiler instead of attempting to replicate one. The stable v7 release comes at a time when VoidZero is undertaking a wider rewrite of its toolchain, transitioning to native languages for various components, including bundlers, formatters, and the TypeScript compiler itself.

Written by urgent.news from InfoQ's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at infoq.com →

More in Tech

More from Friday 11 September →