简体   繁体   中英

Eslint reporting eslintrc configuration problems for dependency configs

I am getting a deprecation warning when running the following lint command

eslint src/js/**/*.js src/js/**/*.jsx webpack.config.js --quiet

Warning:

DeprecationWarning: [eslint] The 'ecmaFeatures' config file property is deprecated, and has no effect. (found in /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/rules/react.js

This seems like it is complaining about a file listed within the eslint-config-airbnb under react-a11y.js and react.js . Those files do indeed include the top level configuration

ecmaFeatures: {
  jsx: true
}

which appears to be incorrect: github issue , docs . However, it seems ( docs ) that node_modules should be ignored by eslint, and anyway just to be explicit, I've added the following to my .eslintignore

node_modules/**/*.*
node_modules 

Why am I getting a warning for an issue located within node_modules? The only thing I can think is that the ignore list doesn't include configurations for eslint itself, but that seems pretty far fetched that it would potentially warning me about every out-of-date or misconfiguration of each eslintrc file in node_modules?

In case it is relevant, my .eslintrc.json

{
  "env": {
    "es6": true,
    "browser": true,
    "node": true,
    "jest": true
  },
  "extends": ["airbnb", "prettier", "prettier/react"],
  "parserOptions": {
    "ecmaVersion": 2016,
    "sourceType": "module",
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true,
      "jsx": true
    }
  },
  "plugins": ["prettier", "react"],
  "parser": "babel-eslint",
  "rules": {
    "no-param-reassign": 0
  }
}

How can I resolve this?

Edit:

Upgrading to eslint-config-airbnb@latest (where it looks the top-level ecmaFeatures problem has been resolved ) causes what look like more severe errors:

 /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/rules/react.js: Configuration for rule "react/jsx-boolean-value" is invalid: Value "never,[object Object]" should NOT have more than 1 items. Referenced from: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/index.js Referenced from: /Users/me/Documents/my-project/.eslintrc.json Error: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/rules/react.js: Configuration for rule "react/jsx-boolean-value" is invalid: Value "never,[object Object]" should NOT have more than 1 items. Referenced from: /Users/me/Documents/my-project/node_modules/eslint-config-airbnb/index.js Referenced from: /Users/me/Documents/my-project/.eslintrc.json at validateRuleOptions (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:113:15) at Object.keys.forEach.id (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:153:9) at Array.forEach (native) at validateRules (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:152:30) at Object.validate (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-validator.js:230:5) at loadFromDisk (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:549:19) at load (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:592:20) at configExtends.reduceRight (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:421:36) at Array.reduceRight (native) at applyExtends (/Users/me/Documents/my-project/node_modules/eslint/lib/config/config-file.js:403:28)

Update babel-preset-react and eslint-plugin-react, that solved the problem for me. If that raise new errors, you will be forced to update almost everything related to eslint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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