-
Notifications
You must be signed in to change notification settings - Fork 47.7k
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
[react-hooks/exhaustive-deps] missed warning when passing a function #16573
Comments
It's a bit of a niche usecase where a function is used directly as useEffect's callback (consider in your example, that the callback would have no access to state or any local variables.) That said, I can see how it would be useful when the need does arise. I think we'd accept a PR for this. |
@threepointone : Hey I have made good progress in this. Can I take up this issue?.. I have done the fix , but now I have to give it polishes with test cases. I will keep it posted here !!. I will try to make it according to existing code standard by this weekend. And we will take it from there !!. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
The fact that it doesn't suggest it is a bug. |
Do you want to request a feature or report a bug?
Arguably a bug in eslint-plugin-react-hooks
What is the current behavior?
The exhaustive-deps rule does not catch the following case:
What is the expected behavior?
I think the plugin should suggest adding the dependency on
foo
:It already makes this suggestion for the verbose form of the code:
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
The text was updated successfully, but these errors were encountered: