-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Maintenance: Prep for ESM #25884
Closed
Closed
Maintenance: Prep for ESM #25884
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
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
JReinhold
requested changes
Feb 8, 2024
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.
This looks like a great improvement, but I think we want ESLint's help to keep this from rotting.
- https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md can enforce the
node:
prefix - https://eslint.org/docs/latest/rules/no-restricted-imports can be used to disallow the use of default imports from those modules
- https://eslint.org/docs/latest/rules/no-restricted-imports can also be used to disallow importing directly from
fs-extra
but always use your wrapper instead.
I still see a couple of instances not using 'node:X'
yet:
Co-authored-by: Jeppe Reinhold <[email protected]>
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.
What I did
node:path
overpath
node:fs
overfs
fs
andpath
, where possible.fs-extra
use into@ndelangen@fs-extra-unified
andnode:fs/promise
@ndelangen@fs-extra-unified
has an export map in it's package.json, and is explicit about which exports it has.fs-extra
does haveESM
support, but to need to explicitly importfs-extra/esm
to get it, which is a problem when generating dist code that needs to run in both CJS & EMS environments.fs-extra/esm
only exports a subset of methods, because most can be imported fromnode:fs/promise
.I'd be great if we cleaned up the mocking situation a bit..
Manual testing
I tested the above on my local machine ☝️
These changes should not have any impact on browser code, AFAICS
🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>