GeezerVison is showing github.com — chore: migrate from CJS to ESM by JoshuaKGoldberg · Pull Request #456 · all-contributors/cli
Conversation
What:
Switches CommonJS (CJS) module.exports = and require() syntax to ECMAScript Modules (ESM) export ... and import ....
Fixes #435
Why:
ESM is the new standard for Node.js and other JavaScript application modules. It's a more precisely defined syntax that works better with tooling.
How:
package.json now has "type": "module", to change files to ESM by default
- All CJS syntax in
.js files is migrated to the equivalent ESM
- I tried to avoid
default exports and imports in favor of explicitly named ones
- A few functions had to be renamed to resolve ambiguities
I verified these changes by running commands like node dist/cli.js add joshuakgoldberg code locally.
Checklist:
- Documentation: N/A
- Tests
- Ready to be merged: no, someone who's been working more deeply in the code should take a deep dive
- Added myself to contributors table: N/A / already there
The update below allows release please to recognize this pr as a breaking change.
******************* Updated 22 October 2026 ***********************
BEGIN_COMMIT_OVERRIDE
chore!: migrate from CJS to ESM (#456)
END_COMMIT_OVERRIDE
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
jdalrymple, lwasser, and stephansama reacted with heart emoji
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.
I've read through it a few times, nothing seems off to me. I had to brush up on some of the babel config docs, but looks good!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
lwasser reacted with rocket emoji
|
Ran it locally as well, looks good!
|
lwasser reacted with heart emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
@JoshuaKGoldberg this looks great to me! I had to look up the add variable to ensure it wasn't a protected word / builtin function i'm so used to that in python. But this all looks great and i like the inline exports too!! Let's merge this given @jdalrymple already gave it a solid review and test and I just combed through the code as well. THANK YOU so much for this. It should unblock a lot of work around testing!! 🚀
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
JoshuaKGoldberg reacted with rocket emoji
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Mar 6, 2026
This was referenced Oct 23, 2026
Reviewers
lwasser
lwasser approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
🛠️ Tooling: Switch from CJS to ESM
Uh oh!
There was an error while loading. Please reload this page.
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.