With [email protected] I observe an unexpected warning
on useWithoutEffectSuffix hook call.
src/App.jsnpx eslint src/App.jsCode example:
function App(props) {
useWithoutEffectSuffix(props, {});
return null;
}
function useWithoutEffectSuffix() {}
export default App;
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)
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).
I would expect react-hooks/exhaustive-deps 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).
I was under impression that only -Effect suffix should be reserved because of
the following quotes:
I think ideally we'd reserve Effect suffix for things that mirror the dependency API
@gaearon's reply on another issue
New Violations: Check dependencies for all Hooks ending with
Effect.
In case I got something wrong and the plan is to reserve Effect word
completely (anywhere in custom hook's name), then we at least need to correct
Changelog accordingly.
Would you like to submit a failing test case and/or a fix? You can search for ExhaustiveDeps-test.js in the codebase. That would be very helpful!
Appreciate you did the work! I was feeling a bit tired today and this was really nice.