@@ -79,7 +79,8 @@ Then configure the rules you want to use under the rules section.
7979```
8080
8181
82- You can also enable all the recommended rules at once. Add ` plugin:jsx-a11y/recommended ` in ` extends ` :
82+ You can also enable all the recommended or strict rules at once.
83+ Add ` plugin:jsx-a11y/recommended ` or ` plugin:jsx-a11y/strict ` in ` extends ` :
8384
8485``` json
8586{
@@ -89,7 +90,6 @@ You can also enable all the recommended rules at once. Add `plugin:jsx-a11y/reco
8990}
9091```
9192
92-
9393## Supported Rules
9494
9595- [ accessible-emoji] ( docs/rules/accessible-emoji.md ) : Enforce emojis are wrapped in <span > and provide screenreader access.
@@ -126,6 +126,131 @@ You can also enable all the recommended rules at once. Add `plugin:jsx-a11y/reco
126126- [ scope] ( docs/rules/scope.md ) : Enforce ` scope ` prop is only used on ` <th> ` elements.
127127- [ tabindex-no-positive] ( docs/rules/tabindex-no-positive.md ) : Enforce ` tabIndex ` value is not greater than zero.
128128
129+ ### Difference between 'recommended' and 'strict' mode
130+
131+ Rule | Recommended | Strict
132+ ------------ | ------------- | -------------
133+ [ accessible-emoji] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md ) | error | error
134+ [ alt-text] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md ) | error | error
135+ [ anchor-has-content] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md ) | error | error
136+ [ aria-activedescendant-has-tabindex] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md ) | error | error
137+ [ aria-props] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md ) | error | error
138+ [ aria-proptypes] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md ) | error | error
139+ [ aria-role] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md ) | error | error
140+ [ aria-unsupported-elements] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md ) | error | error
141+ [ click-events-have-key-events] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md ) | error | error
142+ [ heading-has-content] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md ) | error | error
143+ [ href-no-hash] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/href-no-hash.md ) | error | error
144+ [ html-has-lang] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md ) | error | error
145+ [ iframe-has-title] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md ) | error | error
146+ [ img-redundant-alt] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md ) | error | error
147+ [ interactive-supports-focus] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md ) | error | error
148+ [ label-has-for] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md ) | error | error
149+ [ media-has-caption] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md ) | error | error
150+ [ mouse-events-have-key-events] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md ) | error | error
151+ [ no-access-key] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md ) | error | error
152+ [ no-autofocus] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md ) | error | error
153+ [ no-distracting-elements] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md ) | error | error
154+ [ no-interactive-element-to-noninteractive-role] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md ) | error, with options | error
155+ [ no-noninteractive-element-interactions] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md ) | error, with options | error
156+ [ no-noninteractive-element-to-interactive-role] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md ) | error, with options | error
157+ [ no-noninteractive-tabindex] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md ) | error, with options | error
158+ [ no-onchange] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md ) | error | error
159+ [ no-redundant-roles] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md ) | error | error
160+ [ no-static-element-interactions] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md ) | error, with options | error
161+ [ role-has-required-aria-props] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md ) | error | error
162+ [ role-supports-aria-props] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md ) | error | error
163+ [ scope] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md ) | error, with options | error
164+ [ tabindex-no-positive] ( https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md ) | error | error
165+
166+
167+ The following rules have extra options when in * recommended* mode:
168+
169+ #### no-interactive-element-to-noninteractive-role
170+ ```
171+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': [
172+ 'error',
173+ {
174+ tr: ['none', 'presentation'],
175+ },
176+ ]
177+ ```
178+
179+ #### no-noninteractive-element-interactions
180+ ```
181+ 'jsx-a11y/no-noninteractive-element-interactions': [
182+ 'error',
183+ {
184+ handlers: [
185+ 'onClick',
186+ 'onMouseDown',
187+ 'onMouseUp',
188+ 'onKeyPress',
189+ 'onKeyDown',
190+ 'onKeyUp',
191+ ],
192+ },
193+ ]
194+ ```
195+
196+ #### no-noninteractive-element-to-interactive-role
197+ ```
198+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': [
199+ 'error',
200+ {
201+ ul: [
202+ 'listbox',
203+ 'menu',
204+ 'menubar',
205+ 'radiogroup',
206+ 'tablist',
207+ 'tree',
208+ 'treegrid',
209+ ],
210+ ol: [
211+ 'listbox',
212+ 'menu',
213+ 'menubar',
214+ 'radiogroup',
215+ 'tablist',
216+ 'tree',
217+ 'treegrid',
218+ ],
219+ li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
220+ table: ['grid'],
221+ td: ['gridcell'],
222+ },
223+ ]
224+ ```
225+
226+ #### no-noninteractive-tabindex
227+ ```
228+ 'jsx-a11y/no-noninteractive-tabindex': [
229+ 'error',
230+ {
231+ tags: [],
232+ roles: ['tabpanel'],
233+ },
234+ ]
235+ ```
236+
237+ #### no-static-element-interactions
238+ ```
239+ 'jsx-a11y/no-noninteractive-element-interactions': [
240+ 'error',
241+ {
242+ handlers: [
243+ 'onClick',
244+ 'onMouseDown',
245+ 'onMouseUp',
246+ 'onKeyPress',
247+ 'onKeyDown',
248+ 'onKeyUp',
249+ ],
250+ },
251+ ]
252+ ```
253+
129254## Creating a new rule
130255
131256If you are developing new rules for this project, you can use the ` create-rule `
0 commit comments