Chore: move the a11y rules to the overrides section so they don't apply to t… (#55848)

* move the a11y rules to the overrides section so they don't apply to tests

* turn alt-text back off
This commit is contained in:
Ashley Harrison 2022-09-27 16:59:35 +01:00 committed by GitHub
parent e160f19247
commit 97f1524b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

124
.eslintrc
View File

@ -34,66 +34,7 @@
// Use typescript's no-redeclare for compatibility with overrides
"no-redeclare": "off",
"@typescript-eslint/no-redeclare": ["error"],
// these are all the rules listed in the strict preset
// we should fix them one by one and mark them as errors
// once they're all fixed, we can remove them all and instead extend the strict preset
// with "extends": ["plugin:jsx-a11y/strict"]
"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-has-content": "error",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
"jsx-a11y/aria-props": "error",
"jsx-a11y/aria-proptypes": "error",
"jsx-a11y/aria-role": "error",
"jsx-a11y/aria-unsupported-elements": "error",
"jsx-a11y/autocomplete-valid": "error",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/heading-has-content": "error",
"jsx-a11y/html-has-lang": "error",
"jsx-a11y/iframe-has-title": "off",
"jsx-a11y/img-redundant-alt": "error",
"jsx-a11y/interactive-supports-focus": [
"off",
{
"tabbable": [
"button",
"checkbox",
"link",
"progressbar",
"searchbox",
"slider",
"spinbutton",
"switch",
"textbox"
]
}
],
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/media-has-caption": "error",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/no-access-key": "error",
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/no-distracting-elements": "error",
"jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
"jsx-a11y/no-noninteractive-element-interactions": [
"off",
{
"body": ["onError", "onLoad"],
"iframe": ["onError", "onLoad"],
"img": ["onError", "onLoad"]
}
],
"jsx-a11y/no-noninteractive-element-to-interactive-role": "off",
"jsx-a11y/no-noninteractive-tabindex": "off",
"jsx-a11y/no-redundant-roles": "error",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/role-has-required-aria-props": "error",
"jsx-a11y/role-supports-aria-props": "error",
"jsx-a11y/scope": "error",
"jsx-a11y/tabindex-no-positive": "error"
"@typescript-eslint/no-redeclare": ["error"]
},
"overrides": [
{
@ -117,6 +58,69 @@
"no-redeclare": "error",
"@typescript-eslint/no-redeclare": "off"
}
},
{
"files": ["**/*"],
"excludedFiles": ["**/*.{spec,test}.{ts,tsx}"],
"rules": {
// these are all the rules listed in the strict preset
// we should fix them one by one and mark them as errors
// once they're all fixed, we can remove them all and instead extend the strict preset
// with "extends": ["plugin:jsx-a11y/strict"]
"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-has-content": "error",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
"jsx-a11y/aria-props": "error",
"jsx-a11y/aria-proptypes": "error",
"jsx-a11y/aria-role": "error",
"jsx-a11y/aria-unsupported-elements": "error",
"jsx-a11y/autocomplete-valid": "error",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/heading-has-content": "error",
"jsx-a11y/html-has-lang": "error",
"jsx-a11y/iframe-has-title": "off",
"jsx-a11y/img-redundant-alt": "error",
"jsx-a11y/interactive-supports-focus": [
"off",
{
"tabbable": [
"button",
"checkbox",
"link",
"progressbar",
"searchbox",
"slider",
"spinbutton",
"switch",
"textbox"
]
}
],
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/media-has-caption": "error",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/no-access-key": "error",
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/no-distracting-elements": "error",
"jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
"jsx-a11y/no-noninteractive-element-interactions": [
"off",
{
"body": ["onError", "onLoad"],
"iframe": ["onError", "onLoad"],
"img": ["onError", "onLoad"]
}
],
"jsx-a11y/no-noninteractive-element-to-interactive-role": "off",
"jsx-a11y/no-noninteractive-tabindex": "off",
"jsx-a11y/no-redundant-roles": "error",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/role-has-required-aria-props": "error",
"jsx-a11y/role-supports-aria-props": "error",
"jsx-a11y/scope": "error",
"jsx-a11y/tabindex-no-positive": "error"
}
}
]
}