-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add n/prefer-node-protocol rule #183
Add n/prefer-node-protocol rule #183
Conversation
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.
Thank you for the contribution, this is a great rule to add to eslint-plugin-n
!
Thank you for also adding good looking docs :)
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.
Thank you for your review 🙏
I tried to reflect your review, so could you please review it again?
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 good!
Thank you @yinm
lib/rules/prefer-node-protocol.js
Outdated
docs: { | ||
description: | ||
"enforce using the `node:` protocol when importing Node.js builtin modules.", | ||
recommended: true, |
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.
the recommended
config changes would be a breaking change.
recommended: true, | |
recommended: false, |
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.
Thank you for your review 🙏
I fixed it.
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!
* feat: add `n/prefer-node-protocol` rule * feat: support `require` function * docs: add `export` examples * feat: enable or disable this rule by supported Node.js version * refactor: use `visit-require` and `visit-import` * fix: avoid type error by non-string types * refactor: use `moduleStyle` for simplicity * chore: update to false for avoiding a breaking change
closes: #77
I tried porting the rules and tests of https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md.