-
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
Add the default eslint react hooks config to the wordpress eslint package #14995
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ module.exports = { | |
}, | ||
plugins: [ | ||
'react', | ||
'react-hooks', | ||
], | ||
rules: { | ||
'react/display-name': 'off', | ||
|
@@ -24,5 +25,7 @@ module.exports = { | |
'react/no-children-prop': 'off', | ||
'react/prop-types': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react-hooks/rules-of-hooks': 'error', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, they don't provide the recommended preset. |
||
'react-hooks/exhaustive-deps': 'warn', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm hesitant on the need of this one as we already have a valid use-case for extra deps, but I'm merging and we can try and see if it feels constraining. |
||
}, | ||
}; |
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.
Out of curiosity, what ESLint rule was triggered which enforced this refactor? I'm wondering what is the lesson learned.
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.
The reason is that you can't use hooks after "early returns"