-
Notifications
You must be signed in to change notification settings - Fork 23
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
Converting from commonjs to esm #1210
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Going to pause the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to #1201
Description
This is a massive refactor that converts Checkup from cjs to esm. The intersection of esm and TypeScript is a path that's not well trodden, and as such has taken some time to figure out and get right. While there was a concerted effort to decouple the scope of changes required to move over to esm, some of the changes were unavoidably combined together in order to maintain some semblance of cohesion within the codebase in order to feasibly perform this migration.
Changes include:
"type": "module"
require
andimport * as
statements__dirname
to the esm equivalent (using a public package)vitest
vs.jest
. While this change wasn't 100% necessary, converting to usevitest
for tests has afforded us the ability to greatly simplify the test infrastructure by avoiding the use ofjest
+ts-jest
, both of which aren't esm-first (whichvitest
is)Outstanding changes that will not be included in this refactor are:
eslint-plugin-imports
to correctly work with esm + relative file paths. I could not get the configuration correct in order to ensure this was working correctly, so for now it's disabled. This will be fixed in a follow-up PR.Remaining things TODO in this PR:
jest
from the repo (may require a new version ofjest-sarif
that is compatible withvitest
, currently in progress)npm
overyarn
. Currently the CI jobs are failing due to mismatched engine versions (the repo currently has references to v1.4.2 packages of Checkup, which use an older version of node. While we can temporarily ignore engine mismatches with--ignore-engines
,yarn run
won't allow invocations with packages with invalid version numbers, hence blocking CI from passing). Converting tonpm
may fix this.