Skip to content

Refactor: Investigate removing Program from isolated programs #5855

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

Closed
JoshuaKGoldberg opened this issue Oct 20, 2022 · 1 comment · Fixed by #8834
Closed

Refactor: Investigate removing Program from isolated programs #5855

JoshuaKGoldberg opened this issue Oct 20, 2022 · 1 comment · Fixed by #8834
Labels
accepting prs Go ahead, send a pull request that resolves this issue breaking change This change will require a new major version to be released locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. refactor PRs that refactor code only
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 20, 2022

Overview

Right now, createIsolatedProgram creates a ts.Program with minimal type info behind the scenes:

In theory, the services without a specified project path don’t need to make their own Program. That program was used for the experimental unused variables rule, to get program diagnostics such as unused var diagnostics... but this can take dozens of ms a file, and is rarely used by anybody.

Creating a standalone program that way isn't very expensive, but it would be nice to avoid. We should investigate whether we can get rid of it altogether.

The tricky thing here is parser types: some internal code expects ASTAndProgram instances from the parsing results. In this new world, there may not be the program from there.

Marking as accepting PRs with the caveat that everything still has to work as expected. Which may or may not be doable. Good luck! 😄

This issue is from a pairing I had with @bradzacher going over the parser internals.

@JoshuaKGoldberg JoshuaKGoldberg added refactor PRs that refactor code only accepting prs Go ahead, send a pull request that resolves this issue labels Oct 20, 2022
@JoshuaKGoldberg JoshuaKGoldberg added the breaking change This change will require a new major version to be released label Oct 20, 2022
@JoshuaKGoldberg JoshuaKGoldberg added this to the 7.0.0 milestone Jul 27, 2023
@JoshuaKGoldberg
Copy link
Member Author

#8834 was merged into v8. ✅

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2024
@bradzacher bradzacher added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue breaking change This change will require a new major version to be released locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. refactor PRs that refactor code only
Projects
None yet
2 participants