-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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-plugin-react-hooks] Bug: warning on useWithoutEffectSuffix
#18902
Labels
Comments
surgeboris
added
the
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
label
May 13, 2020
surgeboris
changed the title
[eslint-plugin-react-hooks] Bug: warning on
[eslint-plugin-react-hooks] Bug: warning on May 13, 2020
useWithouEffectSuffix
useWithoutEffectSuffix
Would you like to submit a failing test case and/or a fix? You can search for |
gaearon
added
Component: ESLint Rules
Type: Bug
and removed
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
labels
May 13, 2020
surgeboris
pushed a commit
to surgeboris/react
that referenced
this issue
May 13, 2020
…ebook#18902) Since we only reserve `-Effect` suffix, react-hooks/exhaustive-deps is expected to succeed without warning on a custom hook which contains -Effect- in the middle of it's name (but does NOT contain it as a suffix).
gaearon
pushed a commit
that referenced
this issue
May 13, 2020
* [eslint-plugin-react-hooks] reproduce bug with a test and fix it (#18902) Since we only reserve `-Effect` suffix, react-hooks/exhaustive-deps is expected to succeed without warning on a custom hook which contains -Effect- in the middle of it's name (but does NOT contain it as a suffix). * [eslint-plugin-react-hooks] reproduced bug with a test and fix it Since we only reserve `-Effect` suffix, react-hooks/exhaustive-deps is expected to succeed without warning on a render helper which contains -use- in the middle of it's name (but does NOT contain it as a prefix, since that would violate hook naming convetion). Co-authored-by: Boris Sergeyev <boris.sergeyev@quolab.com>
Appreciate you did the work! I was feeling a bit tired today and this was really nice. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With
eslint-plugin-react-hooks@4.0.1
I observe an unexpected warningon
useWithoutEffectSuffix
hook call.Steps To Reproduce
src/App.js
npx eslint src/App.js
Code example:
npx eslint src/App.js
./src/App.js
2:3 warning React Hook useWithoutEffectSuffix has a missing dependency: 'props'. Either include it or remove the dependency array react-hooks/exhaustive-deps
✖ 1 problem (0 errors, 1 warning)
The current behavior
react-hooks/exhaustive-deps
warning triggered on a custom hook which contains-Effect-
in the middle of it's name (but does NOT contain it as a suffix).The expected behavior
I would expect
react-hooks/exhaustive-deps
to succeed without warning ona custom hook which contains
-Effect-
in the middle of it's name (but does NOTcontain it as a suffix).
I was under impression that only
-Effect
suffix should be reserved because ofthe following quotes:
@gaearon's reply on another issue
changelog entry
In case I got something wrong and the plan is to reserve
Effect
wordcompletely (anywhere in custom hook's name), then we at least need to correct
Changelog accordingly.
The text was updated successfully, but these errors were encountered: