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
Include React Hooks rules (eslint-plugin-react-hooks) #57
Comments
This is a great suggestion. Can you send a PR with the rules that you suggest we add? |
Looked into sending a PR but came across an issue. I was considering the following:
(Note: the default is to set The However, the recommended usage of If I omit At this point, I don't think there's much benefit to adding this plugin as it may cause confusion. To me at least, it goes against the simple, success-or-failure result of Standard's existing rules and introduces a potentially problematic "disable" step to the flow. At the least, I'd wait until React adds the rules to the https://reactjs.org/docs/hooks-rules.html
Thoughts? |
I think waiting until the kinks in this get worked out is a good idea. (either through improvements to the rule, or through community familiarity) |
@MatanBobi Feel free to send a PR, but I'd like a few other users like @jahed and others who have contributed to this repo in the past to confirm it doesn't cause too many false positives for them before we merge it. |
@MatanBobi I'm not to sure exhaustive-deps is just a helper. Dan Abramov clearly states in his article about useEffect that But either way, I agree that these would be really beneficial to have as part of standard (or at least to be easily be able to add them) |
@orpheus definitely right, my bad. |
Following on from my previous comment, Create React App has added https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/index.js Considering this seems to be the "standard", maybe adding it as I looked through existing PRs. #62 committed I can make a new PR if we're in agreement and neither of those are resolved. This isn't urgent or anything since it's just a few lines of config. |
@jahed I saw that you opened a new PR so I closed mine.. Sorry about the |
@MatanBobi No worries. I didn't make a PR yet, cwonrails did (#63) though it's been waiting for over a year. I'm assuming feross has a lot on his hands with all the other projects so he hasn't had the time to review it. |
Just reviewed PR #63 |
Merged in #75 |
Released in v13.0.0 |
The React team published a plugin to enforce the Rules of Hooks. I think it's worth including as part of standard-react. Seems pretty standard.
https://www.npmjs.com/package/eslint-plugin-react-hooks
Thoughts?
The text was updated successfully, but these errors were encountered: