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 eslint-plugin-react-hooks & accompanying rules #63
Conversation
Thanks for taking care of that @cwonrails, didn't get the time for that. So I'm not so sure if this should be an error. |
I'm not going to be able to take a look at this for a little while, but will get to it when I can. Thanks! |
can we add this? |
I'm also glad to update the PR if that's a blocker for merging. |
It would be awesome to get this merged. |
I'm looking for any feedback on this (maybe it got handled elsewhere?). Since hooks are a big part of my workflow I need to use the eslint-plugin-react-hooks and need to know if standard is going to support it. Thanks! |
I ended up removing standard and just using eslint to extend stardard. Here's my eslint config:
Take what you want from that, but other than installing the plugins, it's a simple setup. |
For this PR, |
Just updated this PR. Changes: bumped all dependencies, set |
@feross any reasons not to merge this? |
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "eslint-config-standard-react", | |||
"description": "JavaScript Standard Style React/JSX support - ESLint Shareable Config", | |||
"version": "9.2.0", | |||
"version": "10.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.
Version bump is usually done by the maintainer on the release commit so you may want to revert 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.
Please revert this change.
@@ -9,12 +9,13 @@ | |||
|
|||
"settings": { | |||
"react": { | |||
"version": "detect" | |||
"version": "latest" |
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'd assume detect
is correct as we can't assume the developer is always on the latest React release?
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.
Please revert 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.
Requested changes are inline
@@ -9,12 +9,13 @@ | |||
|
|||
"settings": { | |||
"react": { | |||
"version": "detect" | |||
"version": "latest" |
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.
Please revert this
"react/react-in-jsx-scope": "error" | ||
"react/react-in-jsx-scope": "error", | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn" |
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.
All rules in standard
are errors. We don't do warnings. Please change this to "error"
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "eslint-config-standard-react", | |||
"description": "JavaScript Standard Style React/JSX support - ESLint Shareable Config", | |||
"version": "9.2.0", | |||
"version": "10.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.
Please revert this change.
"peerDependencies": { | ||
"eslint": ">=6.2.2", | ||
"eslint-plugin-react": ">=7.6.1" | ||
}, |
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.
Please revert all version changes and keep this PR focused on adding support for eslint-plugin-react-hooks
only.
Related PR: #67 |
added in #75 |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix
[x] New feature
[ ] Other, please explain:
What changes did you make? (Give an overview)
This is a cleaned-up version of #62 that does not check in
node_modules
as requested by @feross in #62 (comment).Added
eslint-plugin-react-hooks
topackage.json
and added the associated rules toeslintrc.json
.Is there anything you'd like reviewers to focus on?
In the original PR @MatanBobi referenced the discussion in the original issue about the
"react-hooks/exhaustive-deps"
rule being set to"warn"
(Facebook's suggested setting) potentially being incompatible with the Standard approach. While this PR went with"warn"
I can gladly change it to"error"
as suggested by @orpheus.