Skip to content
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

Hooks check overly aggressive (zillow/react-hooks/rules-of-hooks) #3

Open
IanMitchell opened this issue Apr 4, 2019 · 2 comments
Open

Comments

@IanMitchell
Copy link

In a function library with no React import, zillow/react-hooks/rules-of-hooks errors out on any function prefaced with use.

function useFeature(data) {
    return (data && data.feature);
}
error  React Hook "useFeature" is called in function "getData" which is neither a React function component or a custom React Hook function  zillow/react-hooks/rules-of-hooks
@evocateur
Copy link

Seems like a bug for https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks ? You can always disable it inline, or maybe rename the confusingly-named function?

@IanMitchell
Copy link
Author

Contextually makes sense - disabled it inline, but figured I'd report the false-positive. Will escalate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants