Rocketseat / eslint-config-rocketseat

ESLint configuration used by Rocketseat
https://www.npmjs.com/@rocketseat/eslint-config
674 stars 100 forks source link

react hooks rules #6

Open diegohmac opened 1 year ago

diegohmac commented 1 year ago

I created a project from scratch with Vite + Typescript and I've added the eslint-config-rocketseat to it.

It's working fine for everything but the react hooks rules.

For example, I have a useEffect without declaring its dependencies and it's not throwing any red lines there.

Is there an additional config that I need to make in order to have it working?

This is my .eslintrc.json

{
  "extends": ["@rocketseat/eslint-config/react"]
}
brunoocastro commented 1 year ago

I found this trouble too, have you an solution ?

teosoares10 commented 10 months ago

You need to install eslint-plugin-react-hooks npm i eslint-plugin-react-hooks -D

yarn add eslint-plugin-react-hooks -D

pnpm i eslint-plugin-react-hooks -D

Inside .eslintrc.json


{
   "settings": {
        "react": {
            "version": "detect"
         }
   }
},
{
  "extends": "plugin:react-hooks/recommended"
}

I hope this is helpful