Ogg*_*las 7 visual-studio reactjs eslint create-react-app visual-studio-2019
我已经从 Create React App 入门指南创建了一个 React 应用程序--template typescript。
https://create-react-app.dev/docs/getting-started/
我已经扩展了我的配置以使用 ESLint。
包.json:
{
"eslintConfig": {
"extends": ["react-app", "shared-config"],
"rules": {
"additional-rule": "warn"
},
"overrides": [
{
"files": ["**/*.ts?(x)"],
"rules": {
"additional-typescript-only-rule": "warn"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
https://create-react-app.dev/docs/setting-up-your-editor/
ESLint 在运行时工作正常npm run build并显示在 Chrome 开发者控制台中,但在 Visual Studio 中我收到以下错误:
(ESLint) 无法加载要扩展的配置“共享配置”。引用自:<package.json PATH>
我怎样才能做到这一点?
shi*_*les 10
指的"shared-config"是已发布的配置,实际上仅供参考,就像没有"additional-rule"或之类的规则一样"additional-typescript-only-rule"。
要解决您的错误消息,您只需删除该条目或将其替换为正确的共享配置(例如"eslint-config-airbnb")。不过,请确保安装您添加的所有新配置。