Reputation: 667
We have a react app in Visual Studio 2017 that shows the following warning messages for every .js file in the project "(ESLint) Cannot find module 'eslint-config-react-app'...". We have the react-scripts package installed that pulled in the eslint-config-react-app package as well. We have tried to install it ourselves in the local projects package.json as well as a global package.
No matter what we do these errors will not go away.
UPDATED: The project folder structure is:
I have tried putting the following in the packages.json file:
"eslintConfig": {
"extends": "react-app"
}
I have tried creating a .eslintrc file in the ClientApp folder as well as moving to the project root folder so it sits at the same level as the ClientApp folder. In the file I had the following:
{
"extends": "react-app"
}
I also tried the following in the .eslintrc file:
{
"extends": [
"eslint:recommended",
"plugin:react/recommended"
]
}
When I did this my error changes to "
(ESLint) ESLint encountered a parsing error.
Upvotes: 2
Views: 6416
Reputation: 667
I found the solution. I removed all .eslintrc files and also removed the ESLint config section of the packages.json file. Then I went into Tools...Options in Visual Studio and searched for ESLint. I then clicked on the button "Reset global .eslintrc". Finally I closed and re-opened the solution and everything is now working as expected.
Upvotes: 4
Reputation: 1774
This happened to me, but it was:
Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
I didn't have a .eslintrc in the website root!!! So I added one (there are lots of examples of what it must contain)
Upvotes: -1