// only add styled-components rules
// see: https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y

export default {
  // plugin does not provide definitions
  'styled-components-a11y/alt-text': 'error',
  'styled-components-a11y/anchor-has-content': 'error',
  'styled-components-a11y/anchor-is-valid': 'error',
  'styled-components-a11y/aria-activedescendant-has-tabindex': 'error',
  'styled-components-a11y/aria-props': 'error',
  'styled-components-a11y/aria-proptypes': 'error',
  'styled-components-a11y/aria-role': 'error',
  'styled-components-a11y/aria-unsupported-elements': 'error',
  'styled-components-a11y/autocomplete-valid': 'error',
  'styled-components-a11y/click-events-have-key-events': 'error',
  'styled-components-a11y/control-has-associated-label': [
    'error',
    {
      ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
      ignoreRoles: [
        'grid',
        'listbox',
        'menu',
        'menubar',
        'radiogroup',
        'row',
        'tablist',
        'toolbar',
        'tree',
        'treegrid',
      ],
      includeRoles: ['alert', 'dialog'],
    },
  ],
  'styled-components-a11y/heading-has-content': 'error',
  'styled-components-a11y/html-has-lang': 'error',
  'styled-components-a11y/iframe-has-title': 'error',
  'styled-components-a11y/img-redundant-alt': 'error',
  'styled-components-a11y/interactive-supports-focus': [
    'error',
    {
      tabbable: [
        'button',
        'checkbox',
        'link',
        'progressbar',
        'searchbox',
        'slider',
        'spinbutton',
        'switch',
        'textbox',
      ],
    },
  ],
  'styled-components-a11y/label-has-associated-control': 'error',
  'styled-components-a11y/media-has-caption': 'error',
  'styled-components-a11y/mouse-events-have-key-events': 'error',
  'styled-components-a11y/no-access-key': 'error',
  'styled-components-a11y/no-autofocus': 'error',
  'styled-components-a11y/no-distracting-elements': 'error',
  'styled-components-a11y/no-interactive-element-to-noninteractive-role': 'error',
  'styled-components-a11y/no-noninteractive-element-interactions': [
    'error',
    {
      body: ['onError', 'onLoad'],
      iframe: ['onError', 'onLoad'],
      img: ['onError', 'onLoad'],
    },
  ],
  'styled-components-a11y/no-noninteractive-element-to-interactive-role': 'error',
  'styled-components-a11y/no-noninteractive-tabindex': 'error',
  'styled-components-a11y/no-redundant-roles': 'error',
  'styled-components-a11y/no-static-element-interactions': 'error',
  'styled-components-a11y/role-has-required-aria-props': 'error',
  'styled-components-a11y/role-supports-aria-props': 'error',
  'styled-components-a11y/scope': 'error',
  'styled-components-a11y/tabindex-no-positive': 'error',
  // disabled because there appears to be an eslint bug with this rule
  'styled-components-a11y/lang': 'off',
};
