zillow / javascript

JavaScript Code Conventions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

IanMitchell opened this issue · comments

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

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?

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