Javascript: Configuration for rule "react/jsx-no-bind" is invalid:

Created on 23 Aug 2018  路  20Comments  路  Source: airbnb/javascript

./src/index.js
Module build failed: Error: /Users/mac/Desktop/study/eject-study/demo3/node_modules/eslint-config-airbnb/rules/react.js:
Configuration for rule "react/jsx-no-bind" is invalid:
Value "[object Object]" should NOT have additional properties.

Referenced from: /Users/mac/Desktop/study/eject-study/demo3/node_modules/eslint-config-airbnb/index.js
Referenced from: /Users/mac/Desktop/study/eject-study/demo3/.eslintrc.js
at Array.forEach ()
at Array.reduceRight ()
at Array.reduceRight ()

Most helpful comment

@kaflan @krazyjakee I was having the same issue as you guys, and following what @ljharb said, I was able to fix my problem with npx install-peerdeps --dev eslint-config-airbnb, as stated on the readme of eslint-config-airbnb.

I'm guessing some defaults were overwritten during eject, so reapplying the settings did the trick :)

All 20 comments

What does npm ls say? If that exits nonzero then your dependency graph is invalid, and nothing can be expected to work.

that is not say.but i add extends: ['airbnb'] to .eslintrc.js ,it can not build.

@liuzhiyang0113 yes, i understand that. but i'm saying that's only the case if you have incompatible versions of eslint-config-airbnb and eslint-plugin-react installed, which npm ls will show you.

thank you , Sir,it's useful to me.

I too have this error since I updated my dependencies. Here is my package.json file:

    "eslint": "^5.4.0",
    "eslint-config-airbnb": "17.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.11.1"

Reverting to "eslint-config-airbnb": "17.0.0", removes the error.

@dherault if using v17.1 you rm -rf node_modules && npm install, do you still get the error? Where do you get the error? If in your editor or bundler, can you try on the command line?

I am getting this same error after ejecting (npm run eject):

@gurbraj i don't believe CRA is trivially compatible with our config; you probably need to adjust a bunch of version numbers after ejecting to make it work.

Removing node_modules directory and running npm install fixed it for me.

I got the same problem after running eject, adding eslint-config-airbnb module

Same problem here, anyone manage a fix?

it fixed for me when i use old eslint version

"eslint": "4.10.0",
"eslint-config-airbnb": "13.0.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "7.4.0",

@zebrallel
How to fix. Can you tell steps for me?
How fixed please =)

@kaflan try to replace your eslint module version numbers with mine which listed above

@zebrallel your version of eslint works for me. Eslint 5.3.0 did not.

@kaflan @krazyjakee make sure npm ls passes; to do this, use the install peerdeps command on the readme of eslint-config-airbnb. It should work fine with eslint 5.

@kaflan @krazyjakee I was having the same issue as you guys, and following what @ljharb said, I was able to fix my problem with npx install-peerdeps --dev eslint-config-airbnb, as stated on the readme of eslint-config-airbnb.

I'm guessing some defaults were overwritten during eject, so reapplying the settings did the trick :)

Generally speaking, @ljharb is correct:

i don't believe CRA is trivially compatible with our config

That said, if you are determined to make it work, here's how to do it:

  • Examine your yarn.lock file / npm ls output to find what versions of eslint / eslint-plugin-react (and any other plugins that are giving your grievance) are required by your version of react-scripts (the CRA's underlaying engine).
  • Go through eslint-config-airbnb version listed on https://www.npmjs.com/package/eslint-config-airbnb and run npm info "[email protected]" peerDependencies for each version that you think might work to find the best match.

    • Install the correct versions of each package taken from the "best match" output.

For [email protected], the above leads to the following "best match":

  "devDependencies": {
    "eslint": "^4.10.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.4.0",

Same problem here!

    "eslint": "^5.9.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-react": "^7.11.1"

Running npx install-peerdeps --dev eslint-config-airbnb also does not help...

@biosboy what does npm ls print out?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brendanvinson picture brendanvinson  路  4Comments

weihongyu12 picture weihongyu12  路  3Comments

kozhevnikov picture kozhevnikov  路  3Comments

ryankask picture ryankask  路  3Comments

stephenkingsley picture stephenkingsley  路  3Comments