1
0
Fork 1
forked from fedi/mastodon

Enable ESLint jsx-a11y/recommended ruleset (#23309)

This commit is contained in:
Nick Schonning 2023-01-30 00:18:12 -05:00 committed by GitHub
parent 1032d45644
commit 96d26a9417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ module.exports = {
extends: [ extends: [
'eslint:recommended', 'eslint:recommended',
'plugin:react/recommended', 'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
], ],
env: { env: {
@ -124,40 +125,30 @@ module.exports = {
'react/no-unknown-property': 'off', 'react/no-unknown-property': 'off',
'react/self-closing-comp': 'error', 'react/self-closing-comp': 'error',
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js
'jsx-a11y/accessible-emoji': 'warn', 'jsx-a11y/accessible-emoji': 'warn',
'jsx-a11y/alt-text': 'warn', 'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/anchor-has-content': 'warn', 'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/anchor-is-valid': [ 'jsx-a11y/media-has-caption': 'off',
'warn', 'jsx-a11y/no-autofocus': 'off',
{ // recommended rule is:
components: [ // 'jsx-a11y/no-interactive-element-to-noninteractive-role': [
'Link', // 'error',
'NavLink', // {
], // tr: ['none', 'presentation'],
specialLink: [ // canvas: ['img'],
'to', // },
], // ],
aspect: [ 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'off',
'noHref', // recommended rule is:
'invalidHref', // 'jsx-a11y/no-noninteractive-element-interactions': [
'preferButton', // 'error',
], // {
}, // body: ['onError', 'onLoad'],
], // iframe: ['onError', 'onLoad'],
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn', // img: ['onError', 'onLoad'],
'jsx-a11y/aria-props': 'warn', // },
'jsx-a11y/aria-proptypes': 'warn', // ],
'jsx-a11y/aria-role': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/html-has-lang': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/interactive-supports-focus': 'warn',
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/mouse-events-have-key-events': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': [ 'jsx-a11y/no-noninteractive-element-interactions': [
'warn', 'warn',
{ {
@ -166,8 +157,18 @@ module.exports = {
], ],
}, },
], ],
// recommended rule is:
// 'jsx-a11y/no-noninteractive-tabindex': [
// 'error',
// {
// tags: [],
// roles: ['tabpanel'],
// allowExpressionValues: true,
// },
// ],
'jsx-a11y/no-noninteractive-tabindex': 'off',
'jsx-a11y/no-onchange': 'warn', 'jsx-a11y/no-onchange': 'warn',
'jsx-a11y/no-redundant-roles': 'warn', // recommended is full 'error'
'jsx-a11y/no-static-element-interactions': [ 'jsx-a11y/no-static-element-interactions': [
'warn', 'warn',
{ {
@ -176,10 +177,6 @@ module.exports = {
], ],
}, },
], ],
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'off',
'jsx-a11y/scope': 'warn',
'jsx-a11y/tabindex-no-positive': 'warn',
'import/extensions': [ 'import/extensions': [
'error', 'error',