Skip to content

Commit

Permalink
Enable rules for eslint-plugin-jsx-a11y@4 and require overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze committed Mar 22, 2017
1 parent 6162b2b commit 3d20212
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe('main config', () => {
'airbnb',
'wyze/base',
'wyze/rules/react',
'wyze/rules/react-a11y',
]

expect(main.extends).toEqual(expected)
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ module.exports = {
'airbnb',
'wyze/base',
'wyze/rules/react',
'wyze/rules/react-a11y',
],
}
26 changes: 26 additions & 0 deletions rules/react-a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,31 @@ module.exports = {
// require things with onClick to have an aria role
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/onclick-has-role.md
'jsx-a11y/onclick-has-role': 'error',

// The following will be added in the next release of AirBnb

// Require ARIA roles to be valid and non-abstract
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
'jsx-a11y/aria-role': [ 'error', { ignoreNonDom: false } ],
// prevent distracting elements, like <marquee> and <blink>
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
'jsx-a11y/no-distracting-elements': [ 'error', {
elements: [ 'marquee', 'blink' ],
} ],
// ensure emoji are accessible
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
'jsx-a11y/accessible-emoji': 'error',
// elements with aria-activedescendant must be tabbable
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
// ensure iframe elements have a unique title
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
'jsx-a11y/iframe-has-title': 'error',
// prohibit autoFocus prop
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
'jsx-a11y/no-autofocus': 'error',
// ensure HTML elements do not specify redundant ARIA roles
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
'jsx-a11y/no-redundant-roles': 'error',
},
}

0 comments on commit 3d20212

Please sign in to comment.