Skip to content

Commit 2c390ec

Browse files
committed
[eslint config] [breaking] update eslint-plugin-jsx-a11y to v4, enable new rules
1 parent 6435f8f commit 2c390ec

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

packages/eslint-config-airbnb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"peerDependencies": {
6666
"eslint": "^3.15.0",
67-
"eslint-plugin-jsx-a11y": "^3.0.2 || ^4.0.0",
67+
"eslint-plugin-jsx-a11y": "^4.0.0",
6868
"eslint-plugin-import": "^2.2.0",
6969
"eslint-plugin-react": "^6.9.0"
7070
},

packages/eslint-config-airbnb/rules/react-a11y.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313

1414
// Require ARIA roles to be valid and non-abstract
1515
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
16-
'jsx-a11y/aria-role': 'error',
16+
'jsx-a11y/aria-role': ['error', { ignoreNonDom: false }],
1717

1818
// Enforce all aria-* props are valid.
1919
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
@@ -92,6 +92,12 @@ module.exports = {
9292
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
9393
'jsx-a11y/lang': 'error',
9494

95+
// prevent distracting elements, like <marquee> and <blink>
96+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
97+
'jsx-a11y/no-distracting-elements': ['error', {
98+
elements: ['marquee', 'blink'],
99+
}],
100+
95101
// only allow <th> to have the "scope" attr
96102
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
97103
'jsx-a11y/scope': 'error',
@@ -104,5 +110,25 @@ module.exports = {
104110
// Enforce that DOM elements without semantic behavior not have interaction handlers
105111
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
106112
'jsx-a11y/no-static-element-interactions': 'error',
113+
114+
// ensure emoji are accessible
115+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
116+
'jsx-a11y/accessible-emoji': 'error',
117+
118+
// elements with aria-activedescendant must be tabbable
119+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
120+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
121+
122+
// ensure iframe elements have a unique title
123+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
124+
'jsx-a11y/iframe-has-title': 'error',
125+
126+
// prohibit autoFocus prop
127+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
128+
'jsx-a11y/no-autofocus': 'error',
129+
130+
// ensure HTML elements do not specify redundant ARIA roles
131+
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
132+
'jsx-a11y/no-redundant-roles': 'error',
107133
},
108134
};

0 commit comments

Comments
 (0)