chore: convert lib/utils.js to ESM#6071
Open
arun-357 wants to merge 3 commits into
Open
Conversation
|
|
mark-wiemer
previously requested changes
Jun 16, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6071 +/- ##
==========================================
- Coverage 82.25% 76.43% -5.83%
==========================================
Files 61 61
Lines 4564 4561 -3
Branches 989 985 -4
==========================================
- Hits 3754 3486 -268
- Misses 810 1075 +265 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
For code coverage, its not able to pick the natively loaded .mjs but tests still asserts the full utils as before. |
arun-357
force-pushed
the
chore/convert-utils-to-esm
branch
from
June 22, 2026 20:34
cce77da to
0206ea7
Compare
Author
|
Under the new type: module, plain .js is ESM — so do we want to keep it as .mjs or .js ? @mark-wiemer |
Member
|
@arun-357 |
Author
|
@JoshuaKGoldberg No issue then, it is already a .js file in this PR. |
Author
|
@mark-wiemer I fixed the conflicts. |
This file contains hidden or 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
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.
PR Checklist
lib/utils.jsto ESM #5964status: accepting prsOverview
Part of #5400. Renames
lib/utils.js→lib/utils.mjsand converts it to ESM named exports, updating every runtime call site and test in the same change. No behavior change.exports.X = …becomes an inlineexport function/export const; internalexports.Xself-references are now direct calls. No default/aggregate export (perAGENTS.md).require("./utils.mjs"), ESM named-import consumersfrom "./utils.mjs", and namespace consumers switched fromimport utils fromtoimport * as utils from(a default import of a named-export module isundefined).sinoncannot stub ES modules, so thesinon.stub(utils, …)calls were reworked — the unassertedisString/noopstubs were removed, and theisBrowserstubs were replaced withprocess.browsertoggling (isBrowser()isBoolean(process.browser), so the same code path and assertions run).rewiremockkeys/import paths were repointed to.mjs.Verified:
test-nodesuites,test-smoke,eslint,tsc, and aclean+buildbrowser bundle all pass;lib/utils.jswas not listed inpackage.json'sbrowsermap, so no config change was needed.