-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore: move CJS scripts to ESM and use strippable types #10887
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
chore: move CJS scripts to ESM and use strippable types #10887
Conversation
Thanks for the PR, @43081j! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
View your CI Pipeline Execution ↗ for commit 08096b0.
☁️ Nx Cloud last updated this comment at |
@43081j I edited a few things with which issues are linked. Feel free to undraft once ready for review! |
This switches various repo scripts to be `*.mts` files (since that is what they actually are, given we don't build them into CJS output, yet our package `type` is `"commonjs"`). This will allow newer Node to execute them correctly, as they will now infer the correct module type. The `generate-lib` script has also been changed to use only strippable types (i.e. no enums). Both of these changes mean we have the option to drop `tsx` in future and use `--experimental-strip-types` (when it is no longer experimental).
9ce4c74
to
ab5ac08
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10887 +/- ##
=======================================
Coverage 87.43% 87.43%
=======================================
Files 468 468
Lines 16040 16040
Branches 4649 4649
=======================================
Hits 14025 14025
Misses 1658 1658
Partials 357 357
Flags with carried forward coverage won't be shown. Click here to find out more. |
this should be good to go now @kirkwaiblinger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks! One question but no action requested
Not too sure why ci is failing. Doesn't seem related to the changes here, but that is more concerning 😅 if main has problems Maybe catching up from main will help. Next time I'm at a laptop I'll do that unless someone beats me to it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these changes! It's always satisfying to me to get TS a step closer to out-of-the-box node.js rather than requiring layers of transpilation and/or CLI tools just to be able to execute 🙂
Re the integration test that was failing, that was fixed in #10906 👍
2810ceb
into
typescript-eslint:main
Depends on #10886
This prepares the various scripts for being consumed by
node
directly (via the strip-types feature).Primarily this means the following:
type: "commonjs"
, so some of our scripts are incorrectly*.ts
(CJS) whichtsx
covers up by the fact it transpiles it to CJS on the fly*.ts
scripts to*.mts
solves thisDRAFT UNTIL #10885 is accepting PRs and #10886 is merged
PR Checklist
tsx
executes scripts in ESM context in Node 23.6 #10711Also related to #10885