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
refactor: Use node:
protocol for built-in Node.js modules
#18434
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
new webpack.NormalModuleReplacementPlugin( | ||
/^node:/u, | ||
resource => { | ||
resource.request = resource.request.replace(/^node:/u, ""); | ||
} | ||
), |
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 is a solution recommended in webpack/webpack#13290
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.
We can definitely use the n/prefer-node-protocol rule at eslint-config-eslint
to force the use of the node protocol
Yeah, I enabled that rule in |
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.
Sorry for missing it. LGTM
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.
LGTM, thanks! Leaving open until tomorrow in case someone else wants to review.
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
Updates all modules to use
node:
protocol when requiring built-in Node.js modules.What changes did you make? (Give an overview)
n/prefer-node-protocol
rule and let it autofix the whole project.node:
.Is there anything you'd like reviewers to focus on?
When testing whether the new
@eslint/config-array
package will work when used from eslint, I noticed that the webpack build (part of the browser test) fails with:So, the first goal was to make the browser test (and eventually the Playground build on eslint.org) work. Then I switched to
node:
in a few places in eslint to additionally test the build, and in the end I decided to switch tonode:
in the entire project.