2

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:

  • Project
    • ClientApp
      • public
      • src
      • packages.json
    • Controllers
    • Pages

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.

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

-1

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)

1 Comment

I updated the post with additional details. Still no luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.