-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ESLint: Remove explicit react-hooks/exhaustive-deps
disabling
#66461
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: 0 B Total Size: 1.81 MB ℹ️ View Unchanged
|
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.
Just chiming in here because I saw this
Don't necessarily agree with this. As a contributor it's already super noisy having dozens or hundreds of warnings across the whole code base. If something needs fixing it should be a proper error, or else disabled. But nobody looks at warnings, especially if there are so many of them already everywhere. You just start ignoring them completely. |
FWIW the main point that guides me is moving forward to allow for React Compiler to land. I'm happy to disagree here. I don't see how specifically ignoring a warning with |
@tyxla, can we exclude the |
Yeah @Mamaduka, we'll likely have to do it anyway. cc @jsnajdr for feedback, but I think there's no easy way around it without a major refactor. |
…ess#66461) Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
I propose we remove most of those ESLint disable directives. In many of them (where available), we'll still keep the comments that explain why we're violating the rule.
Why?
Currently, we're still explicitly disabling the
react-hooks/exhaustive-deps
rule in many places. This is a problem for the React Compiler, which we're aiming to introduce to Gutenberg soon - it is being disabled entirely for the file where we disable the rule in. See #61788 for more details and #66324 as a similar PR that contains some discussion about why we're doing this.Furthermore, by ignoring the rule, we don't really help with awareness. If the warning is there, there's a chance someone who sees the warning in their IDE to refactor it. When ignored, the IDE doesn't highlight it, so it may forever linger there. That's why for warnings, I see more value in having them there, rather than ignoring them.
How?
We're removing the
eslint-disable
directives in most of the occurrences.This means those will be raised as ESLint warnings, but I'm not concerned about this - this rule is already widely disobeyed across the repository (hundreds of instances), so why should we bother with these 15-20 instances?
Testing Instructions
No testing needed, this changes just comments and lint results. Make sure all checks are green.
Testing Instructions for Keyboard
Same
Screenshots or screencast