-
Notifications
You must be signed in to change notification settings - Fork 196
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
Added new eslint rule for hooks: react-hooks/exhaustive-dep #706
Conversation
@sangameshsomawar I had removed this ESLint rule on purpose because it was giving false positives and most importantly too much noisy in our neeto repos. Also, it wasn't auto-fixable by ESLint in most cases. If you can make a strong case for including this rule and possible fixes for the issues that this rule points out in neeto repos, then we can discuss and consider adding it to wheel. PS: Moving forward, it would be great if you can please raise an issue and mention me in it if you want to add something to wheel. It's better to first discuss the feasibility of adding something new before making a PR. Also please read: https://www.bigbinary.com/how-we-work/mention-closes-fixes-resolves Closing this PR for now. You can raise an issue in wheel, if you have a strong case to make and definitely we can re-open this PR. |
I would like to understand the false positives as I have never faced any. Regarding auto fix, Eslint doesn't auto-fix if something changes the behavior of code. I highly agree that this rule looks tough in the beginning but it has its importance. Thanks for pointing out the processes. I will take care of it next time 😄 |
@sangameshsomawar I saw issue #705 now and read through the references. Didn't know you had raised the issue since it wasn't linked in this PR. What I had meant by false positives is that Main.jsx etc are receiving props that are given from the server itself rather than computed on the client-side. Thus if there is a change in those server props, then a re-render from scratch would be either way be required from my understanding. Thus passing it to array deps or not wouldn't matter much from my understanding in this case. But reading more about this rule and seeing that it's a good practice, I think we can enforce it and see what issues devs are facing based on this rule. Reopening 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.
Once you add the rule, make sure to run it on all files within this repo.
For the time being, I have updated the first comment in this PR to mention which issue it fixes. Moving forward please take care of it.
Please go through the comment and make the necessary changes.
.eslintrc.js
Outdated
}, | ||
// babel-eslint is deprecated now. This is the latest package. | ||
parser: "@babel/eslint-parser", | ||
plugins: ["react", "prettier", "import", "react-hooks", "promise", "jam3"], | ||
rules: { | ||
"react-hooks/exhaustive-deps": "error", |
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 already have this rule .esint-rules/react.js
. Make this fix over there.
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.
Updated.
Few things to be followed:
Currently:
Once all things are done, you can assign this PR back to me. |
Sorry if I am troubling you a lot. I am new here in BB 😄 One more issue I am facing when I executed
Root Cause Analysis: Eslint v8 has some breaking changes: The above issues have been already reported & fixed by react team. We need to wait for the new version of |
It's my pleasure to help you out. Feel free to ask any questions you have.
This is the only option that I see. We can revert back to stable version once they publish the latest stable version. |
1d09250
to
25f864e
Compare
25f864e
to
63c5306
Compare
63c5306
to
c4c3164
Compare
[Edited by Yedhin]
Fixes #705