'use strict'; module.exports = { plugins: [ 'jsx-a11y', 'react', ], parserOptions: { ecmaFeatures: { jsx: true, }, }, rules: { // Enforce that anchors have content // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md 'jsx-a11y/anchor-has-content': [ 'error', { components: [ '' ] }], // 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', // Enforce all aria-* props are valid. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md 'jsx-a11y/aria-props': 'error', // Enforce ARIA state and property values are valid. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md 'jsx-a11y/aria-proptypes': 'error', // Enforce that elements that do not support ARIA roles, states, and // properties do not have those attributes. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md 'jsx-a11y/aria-unsupported-elements': 'error', // disallow href "#" // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md 'jsx-a11y/anchor-is-valid': [ 'error', { components: [ 'a' ] }], // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md 'jsx-a11y/alt-text': 'error', // Prevent img alt text from containing redundant words like "image", "picture", or "photo" // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md 'jsx-a11y/img-redundant-alt': 'error', // require that JSX labels use "htmlFor" // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md 'jsx-a11y/label-has-for': [ 'error', { components: [ 'label' ] }], // require that mouseover/out come with focus/blur, for keyboard-only users // TODO: evaluate // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md 'jsx-a11y/mouse-events-have-key-events': 'off', // Prevent use of `accessKey` // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md 'jsx-a11y/no-access-key': 'error', // require onBlur instead of onChange // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md 'jsx-a11y/no-onchange': 'off', // Enforce that elements with onClick handlers must be focusable. // TODO: evaluate // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/onclick-has-focus.md 'jsx-a11y/onclick-has-focus': 'off', // Enforce that elements with ARIA roles must have all required attributes // for that role. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md 'jsx-a11y/role-has-required-aria-props': 'error', // Enforce that elements with explicit or implicit roles defined contain // only aria-* properties supported by that role. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md 'jsx-a11y/role-supports-aria-props': 'error', // Enforce tabIndex value is not greater than zero. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md 'jsx-a11y/tabindex-no-positive': 'error', // ensure tags have content and are not aria-hidden // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md 'jsx-a11y/heading-has-content': [ 'error', { components: [ '' ] }], // require HTML elements to have a "lang" prop // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md 'jsx-a11y/html-has-lang': 'error', // require HTML element's lang prop to be valid // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md 'jsx-a11y/lang': 'error', // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md 'jsx-a11y/no-distracting-elements': [ 'error', { elements: [ 'marquee' ] }], // only allow to have the "scope" attr // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md 'jsx-a11y/scope': 'error', // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md // TODO: enable? 'jsx-a11y/click-events-have-key-events': 'off', // Enforce that DOM elements without semantic behavior not have interaction handlers // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md 'jsx-a11y/no-static-element-interactions': 'error', }, };