I have an issue where the missing dependencies warning doesn't show up any longer for useEffect
in React. I am using VS Code if that matters.
Does anyone know what could be the cause for this, as right now I don't even know where to start debugging.
CodePudding user response:
your problem is related with eslint.
check your code to see is there any line of code like this?
// eslint-disable-next-line
or this:
// eslint-disable-next-line react-hooks/exhaustive-deps
if yes, delete it.
another cause can be the .eslintignore file. check if there is this .eslintignore file exists on your project, delete it should solve your problem
CodePudding user response:
In VS Code, press Ctrl Shift P
to bring the command prompt, and run ESLint: Show Output Channel. If ESLint is missing certain React plugins, it will tell you so.
It might also be something wrong with VS Code's TS server. It is the thing that is checking for dependencies, amongst other things. Open the terminal (Ctrl '
), select the Output tab, and on the right hand side select Typescript from the dropdown menu.
If you are using Yarn v3, you need to install eslint and typescript as dev dependencies, then run yarn dlx @yarnpkg/sdks vscode
and switch VS Code to the workspace version of Typescript (the prompt for that will show in a popup).