Eslint-plugin-jsx-a11y: Configuration for rule "jsx-a11y/anchor-has-content" is invalid: Value "[object Object]" no (or more than one) schemas match.

Created on 28 Jan 2017  ยท  13Comments  ยท  Source: jsx-eslint/eslint-plugin-jsx-a11y

I just updated to latest eslint-config-airbnb just now. That is:

{ eslint: '^3.13.0', 'eslint-plugin-jsx-a11y': '^3.0.2', 'eslint-plugin-import': '^2.2.0', 'eslint-plugin-react': '^6.9.0' }

My eslinting was working fine beforehand. Now I get the error in the title, with or without the following in my eslintrc:

"rules": { "jsx-a11y/anchor-has-content": "off" }

I am not using any JSX anywhere. I'm only linting some simple config files. I am having to turn off linting in my editor just to work. Is this a known issue or am I missing something simple? Thanks.

Most helpful comment

Also, if you're using Atom, it has a bug - you have to restart it after any change to node_modules.

All 13 comments

@albell when you updated eslint-config-airbnb, did you use the npm install command in the readme, to ensure that you have all the proper peer dep versions installed?

Also, if you're using Atom, it has a bug - you have to restart it after any change to node_modules.

Yes, using Atom, and the restart fixed it. Thanks for the help!

I'm seeing this same issue with Atom. I did the install per esling-config-airbnb and restarted but still get the following error:

Error: /Users/jklo/projects/ELMS/source/elms-video-editor/node_modules/eslint-config-airbnb/rules/react-a11y.js: Configuration for rule "jsx-a11y/anchor-has-content" is invalid: Value "[object Object]" no (or more than one) schemas match.

Referenced from: airbnb Referenced from: /Users/jklo/projects/ELMS/source/elms-video-editor/app/.eslintrc

My .eslintrc is as follows:

{
  "rules": {
    "flowtype/boolean-style": [2, "boolean"],
    "flowtype/define-flow-type": 1,
    "flowtype/delimiter-dangle": [2, "never"],
    "flowtype/generic-spacing": [2, "never"],
    "flowtype/no-primitive-constructor-types": 2,
    "flowtype/no-weak-types": 1,
    "flowtype/object-type-delimiter": [2, "comma"],
    "flowtype/require-parameter-type": 0,
    "flowtype/require-return-type": 0,
    "flowtype/require-valid-file-annotation": 0,
    "flowtype/semi": [2, "always"],
    "flowtype/space-after-type-colon": [2, "always"],
    "flowtype/space-before-generic-bracket": [2, "never"],
    "flowtype/space-before-type-colon": [2, "never"],
    "flowtype/union-intersection-spacing": [2, "always"],
    "flowtype/use-flow-type": 2,
    "flowtype/valid-syntax": 2,
    "flowtype-errors/show-errors": 2
  }
}

@jimklo did you install everything locally, using the install command in the readme which ensures the proper peer dep versions are installed? Have you uninstalled your global eslint, and ensured atom is using the local one? Your eslintrc doesn't seem to have an "extends" directive, is that its entire contents?

@ljharb yes as far as having a local install...

I did use the following:

(
  export PKG=eslint-config-airbnb;
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)

Now I do have a global eslint install for some other purpose:

elms-video-editor jklo$ npm -g ll eslint

โ”‚ /usr/local/lib
โ”‚
โ””โ”€โ”€ [email protected]
    An AST-based pattern checker for JavaScript.
    git+https://github.com/eslint/eslint.git
    http://eslint.org

as well as some other "linty" things:

elms-video-editor jklo$ npm -g ls | grep eslint
โ”œโ”€โ”ฌ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”œโ”€โ”ฌ [email protected]

It's likely that atom is using the global one instead of the local one - I don't know enough about atom to help configure that, but if you uninstall the global eslint you'll narrow it down pretty quickly.

I ended up uninstalling all my global node_packages... that seems to have worked... At least no more errors in Atom. Thanks.

@jimklo if you are using linter-eslint with atom then there is a setting for "Use global ESlint installation" which you can disable.

@evcohen thanks... I did that... however I had just enabled that because of this problem I was having with the facebook create-react-app... things seem to be working for the moment...

Thanks! I just disable eslint and it worked.

@lennymendez disabling a critical tool like eslint isn't really a viable option :-/

For me i got this issue when i tried to use babel-preset-airbnb, it was fixed when I updated eslint-plugin-jsx-a11y to 6.1.0, check your peer dependencies warnings.

Was this page helpful?
0 / 5 - 0 ratings