【问题标题】:ESLint couldn't find the config "prettier" to extend fromESLint 找不到要扩展的配置“更漂亮”
【发布时间】:2020-08-19 05:11:01
【问题描述】:

我正在尝试使用 eslint 格式化我的代码,但是当我运行 npm run lint -f 时,我得到了以下输出:

Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.   
The config "prettier" was referenced from the config file in "/project/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js".

这是我的依赖package.json

{
  "scripts": {
    "lint": "eslint \"**/*.{js,ts}\" --quiet --fix",
  },
  "private": true,
  "dependencies": {
    "tslib": "^1.11.1",
    "zone.js": "^0.10.3"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^2.30.0",
    "@typescript-eslint/parser": "^2.30.0",
    "codelyzer": "^5.2.2",
    "eslint": "^6.8.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-prettier": "^3.1.3",
    "prettier": "2.0.5",

  }
}

【问题讨论】:

    标签: eslint prettier prettier-eslint


    【解决方案1】:

    我觉得你需要安装eslint-config-prettiersee here

    【讨论】:

    • 它应该被添加为开发依赖,即npm install --save-dev eslint-config-prettier
    猜你喜欢
    • 2020-06-07
    • 1970-01-01
    • 2021-04-20
    • 2021-06-21
    • 2021-04-08
    • 2021-12-12
    • 2020-10-19
    • 2019-01-23
    • 2021-12-09
    相关资源
    最近更新 更多