简体   繁体   English

错误 - ESLint:7.32.0 ESLint 找不到要扩展的配置“标准”

[英]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我试过

  1. Removed.eslintrc.yml file by guessing that it can be created automatically.删除了.eslintrc.yml 文件,猜测是可以自动创建的。
  2. Try to run the command yarn run 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:以下是您可以尝试验证是否也适用于您的情况的一些步骤:

  • Locally in your project, run 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}
  • When asked "Which style guide do you want to follow?"当被问到“你想遵循哪个风格指南?” reply 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:如果此时您认为这确实是问题所在,以下是一些可能有帮助的备选方案:

  • Downgrade eslint (easy one but won't work in the long run if you like your dependencies to be up-to-date)降级 eslint(很简单,但如果你希望你的依赖项是最新的,那么从长远来看是行不通的)
  • Switch to another style guide which doesn't have this limitation with eslint version (eg. airbnb or google's are suggested by the config setup)切换到另一个对 eslint 版本没有此限制的样式指南(例如,配置设置建议使用 airbnb 或 google 的)
  • Switch to using standard directly instead of going through eslint切换到直接使用标准而不是通过 eslint

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.

相关问题 eslint 命令在 CI 服务器上失败,并出现错误“ESLint 找不到要扩展的配置”标准“” - eslint command fails on CI Server with error “ESLint couldn't find the config ”standard“ to extend from” ESLint 找不到要扩展的配置“airbnb-base” - ESLint couldn't find the config "airbnb-base" to extend from 使用 ESLint 构建 react-webapp 时遇到问题; ESLint 找不到要扩展的配置“developit” - Trouble building react-webapp with ESLint; ESLint couldn't find the config "developit" to extend from WebStorm eslint-config-standard错误 - WebStorm eslint-config-standard error 纱线 - 错误找不到与“5.31.0”匹配的“@typescript-eslint/type-utils”的任何版本 - Yarn - error Couldn't find any versions for "@typescript-eslint/type-utils" that matches "5.31.0" 找不到模块'eslint-config-defaults / configurations / eslint' - Cannot find module 'eslint-config-defaults/configurations/eslint' Mac WebStorm错误:无法找到模块'eslint-config-airbnb' - Mac WebStorm Error: Cannot find module 'eslint-config-airbnb' vuejs/eslint-plugin-vue 模块构建失败(来自./node_modules/eslint-loader/dist/cjs.js):错误:找不到模块'eslint' - vuejs/eslint-plugin-vue Module build failed (from ./node_modules/eslint-loader/dist/cjs.js): Error: Cannot find module 'eslint' 出现解析错误,找不到 eslint 文件 - getting a parse error and cannot find eslint file 从命令行安装ESlint错误 - ESlint Error Install from Command Line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM