[英]Error - ESLint: 7.32.0 ESLint couldn't find the config "standard" to extend from
We have a CircleCI Pipeline.我们有一个 CircleCI 管道。 We have a older version of eslint ie 5.10.0 which was around three years ago installed and now client wants to upgrade node version to 16 and upgrade related packages.我们有大约三年前安装的旧版本 eslint 即 5.10.0,现在客户希望将节点版本升级到 16 并升级相关包。 I have modified package.json file and changes eslint version from "eslint": "^5.10.0"
to " eslint": "^7.10.0"
.我修改了 package.json 文件并将 eslint 版本从"eslint": "^5.10.0"
更改为 " eslint": "^7.10.0"
。 Now, while pushing changes on branch CircleCI test execution fails with the below error.:现在,在分支 CircleCI 上推送更改时,测试执行失败并出现以下错误:
Oops: Something went wrong!哎呀!出事了! :( :(
ESLint: 7.32.0 ESLint:7.32.0
ESLint couldn't find the config "standard" to extend from. ESLint 找不到要扩展的配置“标准”。 Please check that the name of the config is correct.请检查配置名称是否正确。
The config "standard" was referenced from the config file in "/home/xxx/xxx/.eslintrc.yml".配置“标准”是从“/home/xxx/xxx/.eslintrc.yml”中的配置文件引用的。
I have googled for this issue but did not find the proper solution for this.我用谷歌搜索了这个问题,但没有找到合适的解决方案。
I have tried to我试过
eslint --init
inside package.json under script tag "scripts": {
"test": "yarn run eslint --init && yarn lint && yarn flow && yarn jest",
}
But here, CircleCI pipeline is used so eslint --init command will ask question How would you like to use ESLint?尝试在脚本标签"scripts": {
下运行命令 yarn run eslint --init
inside package.json: { "test": "yarn run eslint --init && yarn lint && yarn flow && yarn jest",
}
但在这里,CircleCI 管道是使用 eslint --init 命令会询问 How would you like to use ESLint? We don't have any provision in CircleCI during automated file and test execution to provide any answer.在自动文件和测试执行期间,我们在 CircleCI 中没有任何规定来提供任何答案。 I had a similar case, where this error was due to my eslint
version being too new compared to the one required by standard
.我有一个类似的案例,这个错误是由于我的eslint
版本与standard
要求的版本相比太新了。
Here are some steps you can try to verify whether that's the case for you as well:以下是您可以尝试验证是否也适用于您的情况的一些步骤:
npm init @eslint/config
(will ask you some questions and generate a new .eslint.{js|yml|json}
out of it)在你的项目本地,运行npm init @eslint/config
(会问你一些问题并从中生成一个新的.eslint.{js|yml|json}
)standard
回复standard
at this point, you should see something on the line of在这一点上,你应该看到一些东西
The style guide "standard" requires eslint@^7.12.1. You are currently using eslint@{version}
Do you want to downgrade?
choosing "No" will warn you as follow and cause the error you mentioned when trying to execute linting.选择“否”将警告您如下,并导致您在尝试执行 linting 时提到的错误。
Note: it might not work since ESLint's version is mismatched with the standard config
In my case the eslint version was differing by major ( 8.11.0
) which makes it more obvious, but it looks very similar to what you have too.在我的例子中,eslint 版本因主要 ( 8.11.0
) 而异,这使得它更加明显,但它看起来与你所拥有的非常相似。
If by this point you figured that's indeed the issue, here are some alternatives that might help:如果此时您认为这确实是问题所在,以下是一些可能有帮助的备选方案:
I am no expert in js world, so please feel free to point out anything I missed我不是 js 领域的专家,所以请随时指出我遗漏的任何内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.