简体   繁体   English

'babel-eslint' 没有找到。 错误:“.eslintrc.json#overrides[0]”中处理器的 ESLint 配置无效

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

I have a eslint config file .eslintrc.json (could be.eslintrc) like this:我有一个像这样的 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"]
  }
}

and I got a persistent error我得到了一个持续的错误

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

Although official eslint site suggest this configuration, you need to use parser property in the overrides instead of processor such as the following:尽管官方eslint 网站建议使用此配置,但您需要在overrides中使用parser属性而不是processor ,例如:

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

With this change everything works pretty well.有了这个改变,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM