【问题标题】:'babel-eslint' was not found. Error: ESLint configuration of processor in '.eslintrc.json#overrides[0]' is invalid'babel-eslint' 没有找到。错误:“.eslintrc.json#overrides[0]”中处理器的 ESLint 配置无效
【发布时间】:2020-06-21 20:37:30
【问题描述】:

我有一个像这样的 eslint 配置文件 .eslintrc.json(可能是 .eslintrc):

{  
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": [
      "eslint:recommended",
      "plugin:react/recommended",
      "plugin:@typescript-eslint/eslint-recommended",
      "airbnb-typescript-prettier"
  ],
  "plugins": [
    "@typescript-eslint"
  ],
  "globals": {
      "Atomics": "readonly",
      "SharedArrayBuffer": "readonly"
  },
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
      "ecmaFeatures": {
          "jsx": true
      },
      "ecmaVersion": 2018,
      "sourceType": "module"
  },
  "overrides": [
    {
        "files": ["*.js", "*.jsx"],
        "processor": "babel-eslint"
    }
  ],
  "rules": {
    "react/prop-types": 0,
    "semi": ["error", "never"]
  }
}

我得到一个持续错误

Error: ESLint configuration of processor in '.eslintrc.json#overrides[0]' is invalid: 'babel-eslint' was not found

【问题讨论】:

    标签: babeljs lint babel-eslint


    【解决方案1】:

    虽然官方eslint site建议了这个配置,但是你需要在overrides中使用parser属性,而不是processor,如下:

    ...
      "overrides": [
      {
        "files": ["*.js", "*.jsx"],
        "parser": "babel-eslint"
      }
    ],
    ...
    

    有了这个改变,一切都很好。

    【讨论】:

      猜你喜欢
      • 2020-06-07
      • 2017-07-13
      • 2016-11-05
      • 2021-10-29
      • 2022-01-07
      • 1970-01-01
      • 2022-06-23
      • 2016-05-27
      • 1970-01-01
      相关资源
      最近更新 更多