-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Bug: rules-of-hooks violation not caught by eslint plugin #22520
Comments
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
@pke did you resolve this issue by any chance? |
No |
This may have been an intentional case that's missed so existing code isn't falsely flagged. Assuming that any Consider e.g. Maybe @gaearon can confirm this is intentional. Does the plugin flag usage of built-in hooks inside |
Makes sense regarding existing code getting falsely flagged. I was wondering if the plugin currently has a rule for us to enable in order to capture this case. Thanks! |
I simply import like this: |
How is that helping solving the bug shown in this issue? |
Sorry, I understood the problem to be an eslint warning in the "react-hooks/rules-of-hooks" rule for using a |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
These though fail. Anon default export: facebook#21181 Promise callbacks: facebook#26186 Returning anon functions: facebook#22520
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
this was closed but this is still definitely an issue: for example when using jotai it's really easy for a dev to accidentally think they can use a hook and it's not caught: export const atomBiSavedViewExamples = atom(
async (get) => {
// no error here..
const showWatershedSavedViewTemplates = useFeatureFlag(
'myFlag'
);
//...etc
}); |
Given the following code:
the
rules-of-hooks
linter rule is not triggered for thecreateHandler
as it should.The linter rule should detect its not a react component, since it does not return any
ReactElement
ornull
.The text was updated successfully, but these errors were encountered: