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
Update: deprecate Node.js & CommonJS rules #12898
Conversation
This is blocked by mysticatea/eslint-plugin-node#206 being released. We'll need to switch over to the plugin internally before tests will pass (since this change makes it so that we're using deprecated rules). |
lib/rules/callback-return.js
Outdated
@@ -10,6 +10,10 @@ | |||
|
|||
module.exports = { | |||
meta: { | |||
deprecated: true, | |||
|
|||
replacedBy: [], |
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.
Would it make sense to include the rule it's replaced by in the plugin?
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 went back and forth on that. Since we won’t be maintaining it, I’m a little worried about it getting out of sync (even though it’s maintained by one of us). Happy to defer to consensus on this, though.
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 think if we are recommending people use the plugin in our docs and release notes then it makes sense to be part of the console deprecation notice.
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.
👍 Definitely not against that. Waiting on eslint-plugin-node
to be released and will update this PR.
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 has been updated! Does having the URL to the docs make sense?
Thoughts on leaving the |
Sounds good. |
After looking closer at the test failures, I do think we should wait for the release of @mysticatea Is there anything I can do to help with that? |
Hi. I apologies that I have not been active while a time. At last, I have released |
No need to apologize! We all totally understand. Just wanted to check in to see if there was anything I could do to help. |
@kaicataldo does the plugin release unblock this now? |
Yes! This is now unblocked. |
be58f86
to
0dc1274
Compare
@mysticatea I've been trying to update this PR to use the updated plugin, and I've been wrestling with the new I've tried the following: // Doesn't work because we're resolving to actual files now instead of just patterns
"**/lib/cli-engine/**/*" [path.join(__dirname, "lib/cli-engine/**/*"), path.join(__dirname, "!lib/cli-engine")] "lib/cli-engine/{index.js,**/*}" // Are `!` allowed inside the path, or only at the beginning? Looking at the code/minimatch docs, it looks like they might only be allowed at the beginning.
"lib/cli-engine/(!index.js|**)/*}" // I thought this one would work!
[path.join(__dirname, "lib/cli-engine/**/*"), path.join(__dirname, "!lib/cli-engine/index.js")] Do you see anything glaringly wrong here? I'll take a look at the rule to figure it out, but I've spent enough time trying to figure the glob out that I figured I should just ask :) Thanks! |
Ah, user error - of course, I figured it out right after typing the above 😆. Here's the correct answer: [
path.join(__dirname, "lib/cli-engine/**/*"),
`!${path.join(__dirname, "lib/cli-engine/index.js")}`
] |
0dc1274
to
4078860
Compare
4078860
to
cc70569
Compare
This should be ready for review (with a few questions).
|
.eslintrc.js
Outdated
* @param {string} pathOrPattern the path or glob pattern. | ||
* @returns {string} The resolved path or glob pattern. | ||
*/ | ||
function resolveAbsPath(pathOrPattern) { |
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.
Maybe resolveAbsolutePath? We’ve generally not abbreviated words in the codebase.
docs/rules/no-sync.md
Outdated
@@ -1,5 +1,7 @@ | |||
# Disallow Synchronous Methods (no-sync) | |||
|
|||
This rule was **deprecated** in ESLint v7.0.0. |
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.
Is it worth adding a note about the node plugin as a replacement?
lib/rules/no-sync.js
Outdated
@@ -13,6 +13,10 @@ | |||
|
|||
module.exports = { | |||
meta: { | |||
deprecated: true, | |||
|
|||
replacedBy: ["https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-sync.md"], |
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.
Should this be the rule name instead of the URL?
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 was wondering that too, and ended up leaning toward this to save folks the step of having to google it. That being said, it does feel weird. Happy to go with consensus on this.
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.
It looks like we don’t have other examples using URLs in this spot, so it seems using the rule name would be consistent.
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 🎉
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, thank you.
But I guess that we need to update website code for https://eslint.org/docs/rules/#deprecated table.
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)
[x] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
refs #12835
What changes did you make? (Give an overview)
As discussed in #12835, this PR deprecates the Node.js and CommonJS rules we have in core. These rules are generously being adopted by @mysticatea's
eslint-plugin-node
project (PR here)!Is there anything you'd like reviewers to focus on?
Is there anything I missed?