Skip to content

type aware linting blog post #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

type aware linting blog post #424

wants to merge 2 commits into from

Conversation

Boshen
Copy link
Member

@Boshen Boshen commented Jul 22, 2025

No description provided.

Copy link

netlify bot commented Jul 22, 2025

Deploy Preview for oxc-project ready!

Name Link
🔨 Latest commit 5bfca61
🔍 Latest deploy log https://app.netlify.com/projects/oxc-project/deploys/687f7a20e6996800086c94ce
😎 Deploy Preview https://deploy-preview-424--oxc-project.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Boshen Boshen force-pushed the tsgolint branch 2 times, most recently from b30e6c1 to 757bd6e Compare July 22, 2025 10:04
Comment on lines 32 to 33
- no-floating-promises
- no-misused-promises
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- no-floating-promises
- no-misused-promises
- `no-floating-promises`
- `no-misused-promises`

nit

- no-floating-promises
- no-misused-promises

The next version will enable all type-aware rules.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in: The next major or the next minor version?


## Performance

Our testing shows that large repositories, which previously took several minutes to run with `typescript-eslint`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have more precise metrics?


## Type-Aware linting

Please refer to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might still be worth to add a bit of an overview to what other type-aware linters are doing (e.g. biome)?


All type-aware rules are written directly against these shimmed APIs.

While this isn't the recommended approach, it works!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this possibly change in the future?


- [Biome 2.0](https://biomejs.dev/blog/biome-v2/) with its own type inference implementation.

We determined that writing our own type inferencer or type checker was not feasible due to budget and time constraints,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not elaborate earlier (see comment before), might be worth to mention accuracy too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing the reference to "budget". The idea that commercial imperatives and open source ethos inevitably clash and lead to worse outcomes has currency in some quarters. Mentioning financial considerations here might tend to fuel that argument. And I don't think it's fair here - we were struggling with the infeasibility of building a reliable type inference system long before Oxc became part of Void 0.

More generally: Isn't the point here that we decided the surest route to building complete and accurate support for type-aware linting, and keeping up-to-date with TS, is to lean directly on the TS compiler? (following TS-ESLint's example)


Shimming TypeScript's internal APIs carries some risk. However, the TypeScript AST and its visitor are actually quite stable.

We accept this risk and will fix breaking changes when upgrading `typescript-go`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth highlighting the reduced risk for users through this?

The core of this new functionality is [oxc-project/tsgolint](https://github.com/oxc-project/tsgolint).

The tsgolint project was initially prototyped as [typescript-eslint/tsgolint](https://github.com/typescript-eslint/tsgolint).
However, the `typescript-eslint` team decided not to allocate development resources to this prototype, as they plan to continue their work on `typescript-eslint` for typed linting with ESLint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth pointing out (in a different chapter) what is the USP of using tsgolint with oxlint (instead of, e.g., waiting for typescript-eslint to be "go-powered")?

@Boshen
Copy link
Member Author

Boshen commented Jul 23, 2025

More questions:

  • why separate package?
  • why no 2.0 for the breaking change release when type-aware is enabled by default.

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.

3 participants