简体   繁体   English

创建 React 应用程序 - (ESLint) 无法加载要扩展的配置“shared-config”。 引用自:<PATH> 在 Visual Studio 中

[英]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 .我使用--template typescript从 Create React App 入门指南创建了一个 React 应用程序。

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

I have extended my config to use ESLint.我已经扩展了我的配置以使用 ESLint。

package.json:包.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/ 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 在运行npm run build时完美运行并显示在 Chrome 开发人员控制台中,但在 Visual Studio 中我收到以下错误:

(ESLint) Failed to load config "shared-config" to extend from. (ESLint) 无法加载要扩展的配置“shared-config”。 Referenced from: <package.json PATH>引用自:<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" . "shared-config"指的是已发布的配置,实际上仅供参考,就像没有"additional-rule""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" ).要解决您的错误消息,您可以简单地删除该条目或将其替换为适当的共享配置(例如"eslint-config-airbnb" )。 Make sure you install any new configs you add, though.不过,请确保安装您添加的任何新配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 eslint 无法加载要扩展的配置“react-app”。 在项目中进行更改时 - eslint Failed to load config "react-app" to extend from. when making changes in project 无法加载要扩展的配置“react-app”。 引用自:C:\\package.json - Failed to load config "react-app" to extend from. Referenced from: C:\\package.json 无法加载要扩展的配置“@ljharb”。 (ESLint 8,网页包 5) - Failed to load config "@ljharb" to extend from. (ESLint 8, Webpack 5) Netlify/Craco 无法加载要扩展的配置“react-app”。 引用自:/opt/build/repo/package.json - Netlify/Craco Failed to load config "react-app" to extend from. Referenced from: /opt/build/repo/package.json heroku 无法加载要扩展的配置“airbnb”。 引用自:/app/.eslintrc.json - heroku Failed to load config "airbnb" to extend from. Referenced from: /app/.eslintrc.json eslint 无法加载配置“react-app”以扩展 - eslint failed to load config "react-app" to extend from 如何解决无法加载配置“更漂亮”以进行扩展。 在反应 Js - How to Resolve Failed to load config “prettier” to extend from. in react Js 语法错误:错误:无法加载要扩展的配置“ckeditor5”。 将 CKEditor 导入 Vuejs 时 - Syntax Error: Error: Failed to load config “ckeditor5” to extend from. While importing CKEditor to Vuejs ESLint:无法加载配置“next/babel”以扩展 - ESLint: Failed to load config "next/babel" to extend from 无法加载配置“react”以从 - Failed to load config "react" to extend from
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM