Definition for rule 'react-hooks/exhaustive-deps' was not found

UtkarshPramodGupta picture UtkarshPramodGupta · Jan 6, 2020 · Viewed 20.1k times · Source

I am getting the following eslint error after adding // eslint-disable-next-line react-hooks/exhaustive-deps in my code.

8:14 error Definition for rule 'react-hooks/exhaustive-deps' was not found

I referred to this post to fix this but the solution mentioned doesn't work in my case. Any clue how to suppress this eslint error?

PS I'm using standardjs in conjuction.

Answer

Erik Töyrä Silfverswärd picture Erik Töyrä Silfverswärd · Jan 13, 2020

This typically happens because the react-hooks plugin is missing in the .eslintrc plugin configuration. Ensure you have added react-hooks as in the example below:

"plugins": ["react", "react-hooks",],