index.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. "use strict";
  2. /* eslint-disable global-require */
  3. module.exports = {
  4. rules: {
  5. 'accessible-emoji': require('./rules/accessible-emoji'),
  6. 'alt-text': require('./rules/alt-text'),
  7. 'anchor-has-content': require('./rules/anchor-has-content'),
  8. 'anchor-is-valid': require('./rules/anchor-is-valid'),
  9. 'aria-activedescendant-has-tabindex': require('./rules/aria-activedescendant-has-tabindex'),
  10. 'aria-props': require('./rules/aria-props'),
  11. 'aria-proptypes': require('./rules/aria-proptypes'),
  12. 'aria-role': require('./rules/aria-role'),
  13. 'aria-unsupported-elements': require('./rules/aria-unsupported-elements'),
  14. 'autocomplete-valid': require('./rules/autocomplete-valid'),
  15. 'click-events-have-key-events': require('./rules/click-events-have-key-events'),
  16. 'control-has-associated-label': require('./rules/control-has-associated-label'),
  17. 'heading-has-content': require('./rules/heading-has-content'),
  18. 'html-has-lang': require('./rules/html-has-lang'),
  19. 'iframe-has-title': require('./rules/iframe-has-title'),
  20. 'img-redundant-alt': require('./rules/img-redundant-alt'),
  21. 'interactive-supports-focus': require('./rules/interactive-supports-focus'),
  22. 'label-has-associated-control': require('./rules/label-has-associated-control'),
  23. 'label-has-for': require('./rules/label-has-for'),
  24. lang: require('./rules/lang'),
  25. 'media-has-caption': require('./rules/media-has-caption'),
  26. 'mouse-events-have-key-events': require('./rules/mouse-events-have-key-events'),
  27. 'no-access-key': require('./rules/no-access-key'),
  28. 'no-autofocus': require('./rules/no-autofocus'),
  29. 'no-distracting-elements': require('./rules/no-distracting-elements'),
  30. 'no-interactive-element-to-noninteractive-role': require('./rules/no-interactive-element-to-noninteractive-role'),
  31. 'no-noninteractive-element-interactions': require('./rules/no-noninteractive-element-interactions'),
  32. 'no-noninteractive-element-to-interactive-role': require('./rules/no-noninteractive-element-to-interactive-role'),
  33. 'no-noninteractive-tabindex': require('./rules/no-noninteractive-tabindex'),
  34. 'no-onchange': require('./rules/no-onchange'),
  35. 'no-redundant-roles': require('./rules/no-redundant-roles'),
  36. 'no-static-element-interactions': require('./rules/no-static-element-interactions'),
  37. 'role-has-required-aria-props': require('./rules/role-has-required-aria-props'),
  38. 'role-supports-aria-props': require('./rules/role-supports-aria-props'),
  39. scope: require('./rules/scope'),
  40. 'tabindex-no-positive': require('./rules/tabindex-no-positive')
  41. },
  42. configs: {
  43. recommended: {
  44. plugins: ['jsx-a11y'],
  45. parserOptions: {
  46. ecmaFeatures: {
  47. jsx: true
  48. }
  49. },
  50. rules: {
  51. 'jsx-a11y/accessible-emoji': 'error',
  52. 'jsx-a11y/alt-text': 'error',
  53. 'jsx-a11y/anchor-has-content': 'error',
  54. 'jsx-a11y/anchor-is-valid': 'error',
  55. 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
  56. 'jsx-a11y/aria-props': 'error',
  57. 'jsx-a11y/aria-proptypes': 'error',
  58. 'jsx-a11y/aria-role': 'error',
  59. 'jsx-a11y/aria-unsupported-elements': 'error',
  60. 'jsx-a11y/autocomplete-valid': 'error',
  61. 'jsx-a11y/click-events-have-key-events': 'error',
  62. 'jsx-a11y/control-has-associated-label': ['off', {
  63. ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
  64. ignoreRoles: ['grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'row', 'tablist', 'toolbar', 'tree', 'treegrid'],
  65. includeRoles: ['alert', 'dialog']
  66. }],
  67. 'jsx-a11y/heading-has-content': 'error',
  68. 'jsx-a11y/html-has-lang': 'error',
  69. 'jsx-a11y/iframe-has-title': 'error',
  70. 'jsx-a11y/img-redundant-alt': 'error',
  71. 'jsx-a11y/interactive-supports-focus': ['error', {
  72. tabbable: ['button', 'checkbox', 'link', 'searchbox', 'spinbutton', 'switch', 'textbox']
  73. }],
  74. 'jsx-a11y/label-has-associated-control': 'error',
  75. 'jsx-a11y/label-has-for': 'off',
  76. 'jsx-a11y/media-has-caption': 'error',
  77. 'jsx-a11y/mouse-events-have-key-events': 'error',
  78. 'jsx-a11y/no-access-key': 'error',
  79. 'jsx-a11y/no-autofocus': 'error',
  80. 'jsx-a11y/no-distracting-elements': 'error',
  81. 'jsx-a11y/no-interactive-element-to-noninteractive-role': ['error', {
  82. tr: ['none', 'presentation']
  83. }],
  84. 'jsx-a11y/no-noninteractive-element-interactions': ['error', {
  85. handlers: ['onClick', 'onError', 'onLoad', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
  86. alert: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
  87. body: ['onError', 'onLoad'],
  88. dialog: ['onKeyUp', 'onKeyDown', 'onKeyPress'],
  89. iframe: ['onError', 'onLoad'],
  90. img: ['onError', 'onLoad']
  91. }],
  92. 'jsx-a11y/no-noninteractive-element-to-interactive-role': ['error', {
  93. ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
  94. ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
  95. li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
  96. table: ['grid'],
  97. td: ['gridcell']
  98. }],
  99. 'jsx-a11y/no-noninteractive-tabindex': ['error', {
  100. tags: [],
  101. roles: ['tabpanel'],
  102. allowExpressionValues: true
  103. }],
  104. 'jsx-a11y/no-onchange': 'error',
  105. 'jsx-a11y/no-redundant-roles': 'error',
  106. 'jsx-a11y/no-static-element-interactions': ['error', {
  107. allowExpressionValues: true,
  108. handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp']
  109. }],
  110. 'jsx-a11y/role-has-required-aria-props': 'error',
  111. 'jsx-a11y/role-supports-aria-props': 'error',
  112. 'jsx-a11y/scope': 'error',
  113. 'jsx-a11y/tabindex-no-positive': 'error'
  114. }
  115. },
  116. strict: {
  117. plugins: ['jsx-a11y'],
  118. parserOptions: {
  119. ecmaFeatures: {
  120. jsx: true
  121. }
  122. },
  123. rules: {
  124. 'jsx-a11y/accessible-emoji': 'error',
  125. 'jsx-a11y/alt-text': 'error',
  126. 'jsx-a11y/anchor-has-content': 'error',
  127. 'jsx-a11y/anchor-is-valid': 'error',
  128. 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
  129. 'jsx-a11y/aria-props': 'error',
  130. 'jsx-a11y/aria-proptypes': 'error',
  131. 'jsx-a11y/aria-role': 'error',
  132. 'jsx-a11y/aria-unsupported-elements': 'error',
  133. 'jsx-a11y/autocomplete-valid': 'error',
  134. 'jsx-a11y/click-events-have-key-events': 'error',
  135. 'jsx-a11y/control-has-associated-label': ['off', {
  136. ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
  137. ignoreRoles: ['grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'row', 'tablist', 'toolbar', 'tree', 'treegrid'],
  138. includeRoles: ['alert', 'dialog']
  139. }],
  140. 'jsx-a11y/heading-has-content': 'error',
  141. 'jsx-a11y/html-has-lang': 'error',
  142. 'jsx-a11y/iframe-has-title': 'error',
  143. 'jsx-a11y/img-redundant-alt': 'error',
  144. 'jsx-a11y/interactive-supports-focus': ['error', {
  145. tabbable: ['button', 'checkbox', 'link', 'progressbar', 'searchbox', 'slider', 'spinbutton', 'switch', 'textbox']
  146. }],
  147. 'jsx-a11y/label-has-for': 'error',
  148. 'jsx-a11y/label-has-associated-control': 'error',
  149. 'jsx-a11y/media-has-caption': 'error',
  150. 'jsx-a11y/mouse-events-have-key-events': 'error',
  151. 'jsx-a11y/no-access-key': 'error',
  152. 'jsx-a11y/no-autofocus': 'error',
  153. 'jsx-a11y/no-distracting-elements': 'error',
  154. 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
  155. 'jsx-a11y/no-noninteractive-element-interactions': ['error', {
  156. body: ['onError', 'onLoad'],
  157. iframe: ['onError', 'onLoad'],
  158. img: ['onError', 'onLoad']
  159. }],
  160. 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
  161. 'jsx-a11y/no-noninteractive-tabindex': 'error',
  162. 'jsx-a11y/no-onchange': 'error',
  163. 'jsx-a11y/no-redundant-roles': 'error',
  164. 'jsx-a11y/no-static-element-interactions': 'error',
  165. 'jsx-a11y/role-has-required-aria-props': 'error',
  166. 'jsx-a11y/role-supports-aria-props': 'error',
  167. 'jsx-a11y/scope': 'error',
  168. 'jsx-a11y/tabindex-no-positive': 'error'
  169. }
  170. }
  171. }
  172. };