Ogglas
Ogglas

Reputation: 69958

Create React App - (ESLint) Failed to load config "shared-config" to extend from. Referenced from: <PATH> in Visual Studio

I have created a react app from the Create React App getting started guide with --template typescript.

https://create-react-app.dev/docs/getting-started/

I have extended my config to use ESLint.

package.json:

{
  "eslintConfig": {
    "extends": ["react-app", "shared-config"],
    "rules": {
      "additional-rule": "warn"
    },
    "overrides": [
      {
        "files": ["**/*.ts?(x)"],
        "rules": {
          "additional-typescript-only-rule": "warn"
        }
      }
    ]
  }
}

https://create-react-app.dev/docs/setting-up-your-editor/

ESLint works perfectly when running npm run build and shows up in Chrome Developer Console but within Visual Studio I get the following error:

(ESLint) Failed to load config "shared-config" to extend from. Referenced from: <package.json PATH>

enter image description here

How can I make this work?

Upvotes: 7

Views: 5747

Answers (1)

shinglesmingles
shinglesmingles

Reputation: 540

The "shared-config" is referring to a config that's published and is actually just there for reference, just as there's no such rule as "additional-rule" or "additional-typescript-only-rule".

To solve your error message, you can simply remove the entry or replace it with a proper shared config (e.g. "eslint-config-airbnb"). Make sure you install any new configs you add, though.

Upvotes: 10

Related Questions