简体   繁体   中英

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>

在此处输入图片说明

How can I make this work?

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 (eg "eslint-config-airbnb" ). Make sure you install any new configs you add, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM