Eslint-plugin-jsx-a11y: Configuration for rule "jsx-a11y/anchor-has-content" is invalid

Created on 8 Nov 2016  路  8Comments  路  Source: jsx-eslint/eslint-plugin-jsx-a11y

I have a problem with the new version of [email protected]
when I ran 'eslint -c .eslintrc src' with this config
https://github.com/erikras/react-redux-universal-hot-example/blob/master/.eslintrc
I got this:
Configuration for rule "jsx-a11y/anchor-has-content" is invalid: Value "" is the wrong type.
I believe this line is the problem
https://github.com/airbnb/javascript/blob/ae1c0f89cbc02610cf647896d6957bca7e7b3cc5/packages/eslint-config-airbnb/rules/react-a11y.js#L12

Most helpful comment

@JaneCoder I was having exactly the same issue with the same dependencies, using an Atom ESLint plugin. Turns out I had to completely quit and restart Atom.

Not sure if this applies to your situation, but just in case it does :)

All 8 comments

@ehsangazar as discussed in gitter, your problem is that you updated to an incompatible version. Use the shell script in the readme for eslint-config-airbnb to ensure your peer deps are at the correct version. Currently, it only supports v2 of the eslint-plugin-jsx-a11y plugin, not v3.

I still have the issue after running the script. It updated my package.json devDependencies like this:

  "devDependencies": {
    "autoprefixer": "^6.3.6",
    "babel-core": "^6.7.6",
    "babel-eslint": "^7.1.0",
    "babel-jest": "^13.2.2",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "eslint": "^3.9.1",
    "eslint-config-airbnb": "^13.0.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^2.2.3",
    "eslint-plugin-react": "^6.6.0",
    "jest-cli": "^13.2.3",
    "postcss-cssnext": "^2.5.2",
    "postcss-import": "^8.1.0",
    "postcss-loader": "^0.8.2",
    "postcss-reporter": "^1.3.3",
    "precss": "^1.4.0",
    "react-addons-test-utils": "^15.1.0",
    "stylelint": "^5.2.1",
    "stylelint-loader": "^5.0.0",
    "webpack-babel-jest": "*"
  },

Any ideas?

@JaneCoder what issue are you seeing with that configuration? Those peer dep versions look right to me.

@JaneCoder I was having exactly the same issue with the same dependencies, using an Atom ESLint plugin. Turns out I had to completely quit and restart Atom.

Not sure if this applies to your situation, but just in case it does :)

This helped me out 馃槀

FWIW my setup was working, then I removed node_modules and tried yarn instead of npm install. And then started getting this error. I wonder if this is a yarn-induced problem?

@davidgilbertson may be because your lock file has the wrong peer dependency! try yarn upgrade

Ultimately, if you have corrected your package.json, you can always get rid of the node_modules directory and re-run npm i or yarn, to make sure you don't have any lingering older versions of a package installed.

Was this page helpful?
0 / 5 - 0 ratings