[英]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.