Skip to content

Fix lint-fixing with typescript-eslint 8 #126

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

Merged

Conversation

bendemboski
Copy link
Contributor

In the sourceFile objects that typescript manages, gts files end up with an impliedNodeFormat of undefined and mts files end up with an impliedNodeFormat of 99. The buckets that typescript uses to cache the source files are keyed by their format, so when we run this syncing logic on an existing mts file we were overwriting its impliedNodeFormat and setting it to undefined. Perhaps something changed in typescript-eslint@8 to take advantage of more caching or program reuse, not sure, but the result is that overwriting the impliedNodeFormat of the mts files that correspond to un-fixed gts files causes the error in #119. Adding it to the list of fields to preserve fixes it in all the cases I've run.

Fixes #119

In the `sourceFile` objects that `typescript` manages, `gts` files end up with an `impliedNodeFormat` of `undefined` and `mts` files end up with an `impliedNodeFormat` of `99`. The buckets that `typescript` uses to cache the source files are keyed by their format, so when we run this syncing logic on an existing `mts` file we were overwriting its `impliedNodeFormat` and setting it to `undefined`. Perhaps something changed in `typescript-eslint@8` to take advantage of more caching or program reuse, not sure, but the result is that overwriting the `impliedNodeFormat` of the `mts` files that correspond to un-fixed `gts` files causes the error in ember-tooling#119. Adding it to the list of fields to preserve fixes it in all the cases I've run.
@NullVoxPopuli NullVoxPopuli merged commit 5406ead into ember-tooling:main Jan 28, 2025
13 checks passed
@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Jan 28, 2025
@github-actions github-actions bot mentioned this pull request Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error running eslint --fix when multiple .gts files are present
2 participants