https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/220 Refactor img-has-alt to alt-text
Confirm, rules has change and it's breaking us too
Same.
It looks like the team is at least aware: https://github.com/airbnb/javascript/commit/121a95d71524032bfa858271b318aa6e19553dfc#diff-e16356eb9f3a7a45b636115432854777
Run npm ls and you'll see that your dependencies are invalid. The airbnb config does not currently support v5 of the jsx plugin, only v4.
Fix your dependencies, and you won't have any errors. The eslint config readme has a command you can run to ensure your peer deps are correct.
The problem is still here. [email protected] has peer dependency eslint-plugin-jsx-a11y@^5.0.1, but I'm getting Definition for rule 'jsx-a11y/img-has-alt' was not found
can this be reopened as this is a bug in the current version of [email protected]
@stepankuzmin @knowbody what does npm ls say?
Hi! I am having this same issue.
I tried
yarn list:
❯ yarn list | grep a11y
├─ [email protected]
npm info "eslint-config-airbnb@latest" peerDependencies
❯ npm info "eslint-config-airbnb@latest" peerDependencies
{ eslint: '^3.19.0',
'eslint-plugin-jsx-a11y': '^5.0.1',
'eslint-plugin-import': '^2.2.0',
'eslint-plugin-react': '^7.0.1' }
I saw that the peerDep version for eslint-plugin-jsx-a11y _is_ ^5.0.1, so I tried upgrading that as well. Still getting errors like:
Definition for rule 'jsx-a11y/alt-text' was not found [Error/jsx- a11y/alt-text]
@VinSpee how about if you rm -rf node_modules && npm install ?
@gkatsanos tried that. I _am_ getting different errors for each version (4.x and 5.x):
@4.0.x:
1 | Definition for rule 'jsx-a11y/alt-text' was not found [Error/jsx-a11y/alt-text]
2 | Definition for rule 'jsx-a11y/interactive-supports-focus' was not found [Error/jsx-a11y/interactive-supports-focus]
3 | Definition for rule 'jsx-a11y/no-noninteractive-element-interactions' was not found [Error/jsx-a11y/no-noninteractive-element-interactions]
4 | Definition for rule 'jsx-a11y/media-has-caption' was not found [Error/jsx-a11y/media-has-caption]
5 | Definition for rule 'jsx-a11y/no-interactive-element-to-noninteractive-role' was not found [Error/jsx-a11y/no-interactive-element-to-noninteractive-role]
6 | Definition for rule 'jsx-a11y/no-noninteractive-element-to-interactive-role' was not found [Error/jsx-a11y/no-noninteractive-element-to-interactive-role]
7 | Definition for rule 'jsx-a11y/no-noninteractive-tabindex' was not found [Error/jsx-a11y/no-noninteractive-tabindex]
@5.0.1:
1 | Definition for rule 'jsx-a11y/img-has-alt' was not found [Error/jsx-a11y/img-has-alt]
2 | Definition for rule 'jsx-a11y/onclick-has-focus' was not found [Error/jsx-a11y/onclick-has-focus]
3 | Definition for rule 'jsx-a11y/onclick-has-role' was not found [Error/jsx-a11y/onclick-has-role]
What does npm ls tell you? If it exits nonzero, nothing will work properly - resolve that first.
I had the same problem, but npm ls exited with 0 status and all eslint-config-airbnb peerDependencies were met.
I spent almost 30 minutes before I realized that this rule was mentioned in project .elintrc. Writing this to others who will be facing the same problem: don't forget to check your eslint config.
Until this is resolved, try these versions:
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-loader": "^1.8.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-react": "^7.1.0",
Or, instead of trying to install specific versions, use the install command in the readme in the first place which always does the right thing.
Most helpful comment
The problem is still here.
[email protected]has peer dependencyeslint-plugin-jsx-a11y@^5.0.1, but I'm gettingDefinition for rule 'jsx-a11y/img-has-alt' was not found