@pplancq/eslint-config 6.1.5 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,220 +1,218 @@
1
- import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
2
-
3
- export const reactJsxA11yRules = {
1
+ /* eslint-disable import/extensions */
2
+ import jsxA11yPlugin from "eslint-plugin-jsx-a11y-x";
3
+ import { prefix } from "./utils.js";
4
+ /* eslint-enable import/extensions */
5
+
6
+ /**
7
+ * Rules are written with the `jsx-a11y-x` namespace and renamed with `jsxA11y` when needed
8
+ * (`jsx-a11y` keeps the rule names of the former eslint-plugin-jsx-a11y).
9
+ *
10
+ * @param {Object} [namespaces]
11
+ * @param {string} [namespaces.jsxA11y='jsx-a11y-x']
12
+ */
13
+ export const reactJsxA11yRules = ({ jsxA11y = "jsx-a11y-x" } = {}) => ({
4
14
  plugins: {
5
- "jsx-a11y": jsxA11yPlugin,
6
- },
7
- rules: {
8
- // eslint-plugin-jsx-a11y https://github.com/jsx-eslint/eslint-plugin-jsx-a11y?tab=readme-ov-file
9
-
10
- // Enforce emojis are wrapped in <span> and provide screenreader access.
11
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
12
- // This rule is deprecated.
13
- "jsx-a11y/accessible-emoji": "off",
14
-
15
- // Enforce all elements that require alternative text have meaningful information to relay back to end user.
16
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
17
- "jsx-a11y/alt-text": [
18
- "error",
19
- {
20
- elements: ["img", "object", "area", 'input[type="image"]'],
21
- img: [],
22
- object: [],
23
- area: [],
24
- 'input[type="image"]': [],
25
- },
26
- ],
27
-
28
- // Enforce `<a>` text to not exactly match "click here", "here", "link", or "a link".
29
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-ambiguous-text.md
30
- "jsx-a11y/anchor-ambiguous-text": "off",
31
-
32
- // Enforce all anchors to contain accessible content.
33
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-has-content.md
34
- "jsx-a11y/anchor-has-content": ["error", { components: [] }],
35
-
36
- // Enforce all anchors are valid, navigable elements.
37
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-is-valid.md
38
- "jsx-a11y/anchor-is-valid": [
39
- "error",
40
- { components: ["Link"], specialLink: ["to"], aspects: ["noHref", "invalidHref", "preferButton"] },
41
- ],
42
-
43
- // Enforce elements with `aria-activedescendant` are tabbable.
44
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
45
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
46
-
47
- // Enforce all `aria-*` props are valid.
48
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-props.md
49
- "jsx-a11y/aria-props": "error",
50
-
51
- // Enforce ARIA state and property values are valid.
52
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-proptypes.md
53
- "jsx-a11y/aria-proptypes": "error",
54
-
55
- // Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.
56
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-role.md
57
- "jsx-a11y/aria-role": ["error", { ignoreNonDOM: false }],
58
-
59
- // Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
60
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
61
- "jsx-a11y/aria-unsupported-elements": "error",
62
-
63
- // Enforce that `autocomplete` attributes are used correctly.
64
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/autocomplete-valid.md
65
- "jsx-a11y/autocomplete-valid": ["off", { inputComponents: [] }],
66
-
67
- // Enforce a clickable non-interactive element has at least one keyboard event listener.
68
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/click-events-have-key-events.md
69
- "jsx-a11y/click-events-have-key-events": "error",
70
-
71
- // Enforce that a control (an interactive element) has a text label.
72
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/control-has-associated-label.md
73
- "jsx-a11y/control-has-associated-label": [
74
- "error",
75
- {
76
- labelAttributes: ["label"],
77
- controlComponents: [],
78
- ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
79
- ignoreRoles: [
80
- "grid",
81
- "listbox",
82
- "menu",
83
- "menubar",
84
- "radiogroup",
85
- "row",
86
- "tablist",
87
- "toolbar",
88
- "tree",
89
- "treegrid",
90
- ],
91
- depth: 5,
92
- },
93
- ],
94
-
95
- // Enforce heading (`h1`, `h2`, etc) elements contain accessible content.
96
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/heading-has-content.md
97
- "jsx-a11y/heading-has-content": ["error", { components: [""] }],
98
-
99
- // Enforce `<html>` element has `lang` prop.
100
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/html-has-lang.md
101
- "jsx-a11y/html-has-lang": "error",
102
-
103
- // Enforce `iframe` elements have a `title` attribute.
104
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md
105
- "jsx-a11y/iframe-has-title": "error",
106
-
107
- // Enforce `<img>` `alt` prop does not contain the word "image", "picture", or "photo".
108
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md
109
- "jsx-a11y/img-redundant-alt": "error",
110
-
111
- // Enforce that elements with interactive handlers like `onClick` must be focusable.
112
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md
113
- "jsx-a11y/interactive-supports-focus": "error",
114
-
115
- // Enforce that a `label` tag has a text label and an associated control.
116
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-associated-control.md
117
- "jsx-a11y/label-has-associated-control": [
118
- "error",
119
- { labelComponents: [], labelAttributes: [], controlComponents: [], assert: "both", depth: 25 },
120
- ],
121
-
122
- // Enforce that `<label>` elements have the `htmlFor` prop.
123
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
124
- // This rule is deprecated. It was replaced by jsx-a11y/label-has-associated-control.
125
- "jsx-a11y/label-has-for": ["off", { components: [], required: { every: ["nesting", "id"] }, allowChildren: false }],
126
-
127
- // Enforce `lang` attribute has a valid value.
128
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
129
- "jsx-a11y/lang": "error",
130
-
131
- // Enforces that `<audio>` and `<video>` elements must have a `<track>` for captions.
132
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md
133
- "jsx-a11y/media-has-caption": ["error", { audio: [], video: [], track: [] }],
134
-
135
- // Enforce that `onMouseOver`/`onMouseOut` are accompanied by `onFocus`/`onBlur` for keyboard-only users.
136
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
137
- "jsx-a11y/mouse-events-have-key-events": "error",
138
-
139
- // Enforce that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screenreader.
140
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md
141
- "jsx-a11y/no-access-key": "error",
142
-
143
- // Disallow `aria-hidden="true"` from being set on focusable elements.
144
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md
145
- "jsx-a11y/no-aria-hidden-on-focusable": "off",
146
-
147
- // Enforce `autoFocus` prop is not used.
148
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
149
- "jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
150
-
151
- // Enforce distracting elements are not used.
152
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
153
- "jsx-a11y/no-distracting-elements": ["error", { elements: ["marquee", "blink"] }],
154
-
155
- // Interactive elements should not be assigned non-interactive roles.
156
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md
157
- "jsx-a11y/no-interactive-element-to-noninteractive-role": ["error", { tr: ["none", "presentation"] }],
158
-
159
- // Non-interactive elements should not be assigned mouse or keyboard event listeners.
160
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-interactions.md
161
- "jsx-a11y/no-noninteractive-element-interactions": [
162
- "error",
163
- { handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"] },
164
- ],
165
-
166
- // Non-interactive elements should not be assigned interactive roles.
167
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md
168
- "jsx-a11y/no-noninteractive-element-to-interactive-role": [
169
- "error",
170
- {
171
- ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
172
- ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
173
- li: ["menuitem", "option", "row", "tab", "treeitem"],
174
- table: ["grid"],
175
- td: ["gridcell"],
176
- },
177
- ],
178
-
179
- // `tabIndex` should only be declared on interactive elements.
180
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md
181
- "jsx-a11y/no-noninteractive-tabindex": ["error", { tags: [], roles: ["tabpanel"] }],
182
-
183
- // Enforce usage of `onBlur` over `onChange` on select menus for accessibility.
184
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
185
- // This rule is deprecated.
186
- // Deprecated: This rule is based on reports of behavior of old browsers (eg. IE 10 and below). In the meantime, this behavior has been corrected, both in newer versions of browsers as well as in the DOM spec.
187
- "jsx-a11y/no-onchange": "off",
188
-
189
- // Enforce explicit `role` property is not the same as implicit/default `role` property on element.
190
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
191
- "jsx-a11y/no-redundant-roles": "error",
192
-
193
- // Enforce that non-interactive, visible elements (such as `<div>`) that have click handlers use the `role` attribute.
194
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-static-element-interactions.md
195
- "jsx-a11y/no-static-element-interactions": [
196
- "error",
197
- { handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"] },
198
- ],
199
-
200
- // Enforces using semantic DOM elements over the ARIA role property.
201
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
202
- "jsx-a11y/prefer-tag-over-role": "off",
203
-
204
- // Enforce that elements with ARIA roles must have all required attributes for that `role`.
205
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
206
- "jsx-a11y/role-has-required-aria-props": "error",
207
-
208
- // Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.
209
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
210
- "jsx-a11y/role-supports-aria-props": "error",
211
-
212
- // Enforce `scope` prop is only used on `<th>` elements.
213
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/scope.md
214
- "jsx-a11y/scope": "error",
215
-
216
- // Enforce `tabIndex` value is not greater than zero.
217
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
218
- "jsx-a11y/tabindex-no-positive": "error",
15
+ [jsxA11y]: jsxA11yPlugin,
219
16
  },
220
- };
17
+ rules: prefix(
18
+ {
19
+ // eslint-plugin-jsx-a11y-x https://github.com/eslint-community/eslint-plugin-jsx-a11y-x
20
+
21
+ // Enforce all elements that require alternative text have meaningful information to relay back to end user.
22
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/alt-text.md
23
+ "jsx-a11y-x/alt-text": [
24
+ "error",
25
+ {
26
+ elements: ["img", "object", "area", 'input[type="image"]'],
27
+ img: [],
28
+ object: [],
29
+ area: [],
30
+ 'input[type="image"]': [],
31
+ },
32
+ ],
33
+
34
+ // Enforce `<a>` text to not exactly match "click here", "here", "link", or "a link".
35
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/anchor-ambiguous-text.md
36
+ "jsx-a11y-x/anchor-ambiguous-text": "off",
37
+
38
+ // Enforce all anchors to contain accessible content.
39
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/anchor-has-content.md
40
+ "jsx-a11y-x/anchor-has-content": ["error", { components: [] }],
41
+
42
+ // Enforce all anchors are valid, navigable elements.
43
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/anchor-is-valid.md
44
+ "jsx-a11y-x/anchor-is-valid": [
45
+ "error",
46
+ { components: ["Link"], specialLink: ["to"], aspects: ["noHref", "invalidHref", "preferButton"] },
47
+ ],
48
+
49
+ // Enforce elements with `aria-activedescendant` are tabbable.
50
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
51
+ "jsx-a11y-x/aria-activedescendant-has-tabindex": "error",
52
+
53
+ // Enforce all `aria-*` props are valid.
54
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/aria-props.md
55
+ "jsx-a11y-x/aria-props": "error",
56
+
57
+ // Enforce ARIA state and property values are valid.
58
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/aria-proptypes.md
59
+ "jsx-a11y-x/aria-proptypes": "error",
60
+
61
+ // Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.
62
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/aria-role.md
63
+ "jsx-a11y-x/aria-role": ["error", { ignoreNonDOM: false }],
64
+
65
+ // Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.
66
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/aria-unsupported-elements.md
67
+ "jsx-a11y-x/aria-unsupported-elements": "error",
68
+
69
+ // Enforce that `autocomplete` attributes are used correctly.
70
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/autocomplete-valid.md
71
+ "jsx-a11y-x/autocomplete-valid": ["off", { inputComponents: [] }],
72
+
73
+ // Enforce a clickable non-interactive element has at least one keyboard event listener.
74
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/click-events-have-key-events.md
75
+ "jsx-a11y-x/click-events-have-key-events": "error",
76
+
77
+ // Enforce that a control (an interactive element) has a text label.
78
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/control-has-associated-label.md
79
+ "jsx-a11y-x/control-has-associated-label": [
80
+ "error",
81
+ {
82
+ labelAttributes: ["label"],
83
+ controlComponents: [],
84
+ ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
85
+ ignoreRoles: [
86
+ "grid",
87
+ "listbox",
88
+ "menu",
89
+ "menubar",
90
+ "radiogroup",
91
+ "row",
92
+ "tablist",
93
+ "toolbar",
94
+ "tree",
95
+ "treegrid",
96
+ ],
97
+ depth: 5,
98
+ },
99
+ ],
100
+
101
+ // Enforce heading (`h1`, `h2`, etc) elements contain accessible content.
102
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/heading-has-content.md
103
+ "jsx-a11y-x/heading-has-content": ["error", { components: [""] }],
104
+
105
+ // Enforce `<html>` element has `lang` prop.
106
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/html-has-lang.md
107
+ "jsx-a11y-x/html-has-lang": "error",
108
+
109
+ // Enforce `iframe` elements have a `title` attribute.
110
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/iframe-has-title.md
111
+ "jsx-a11y-x/iframe-has-title": "error",
112
+
113
+ // Enforce `<img>` `alt` prop does not contain the word "image", "picture", or "photo".
114
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/img-redundant-alt.md
115
+ "jsx-a11y-x/img-redundant-alt": "error",
116
+
117
+ // Enforce that elements with interactive handlers like `onClick` must be focusable.
118
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/interactive-supports-focus.md
119
+ "jsx-a11y-x/interactive-supports-focus": "error",
120
+
121
+ // Enforce that a `label` tag has a text label and an associated control.
122
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/label-has-associated-control.md
123
+ "jsx-a11y-x/label-has-associated-control": [
124
+ "error",
125
+ { labelComponents: [], labelAttributes: [], controlComponents: [], assert: "both", depth: 25 },
126
+ ],
127
+
128
+ // Enforce `lang` attribute has a valid value.
129
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/lang.md
130
+ "jsx-a11y-x/lang": "error",
131
+
132
+ // Enforces that `<audio>` and `<video>` elements must have a `<track>` for captions.
133
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/media-has-caption.md
134
+ "jsx-a11y-x/media-has-caption": ["error", { audio: [], video: [], track: [] }],
135
+
136
+ // Enforce that `onMouseOver`/`onMouseOut` are accompanied by `onFocus`/`onBlur` for keyboard-only users.
137
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/mouse-events-have-key-events.md
138
+ "jsx-a11y-x/mouse-events-have-key-events": "error",
139
+
140
+ // Enforce that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screenreader.
141
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-access-key.md
142
+ "jsx-a11y-x/no-access-key": "error",
143
+
144
+ // Disallow `aria-hidden="true"` from being set on focusable elements.
145
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-aria-hidden-on-focusable.md
146
+ "jsx-a11y-x/no-aria-hidden-on-focusable": "off",
147
+
148
+ // Enforce `autoFocus` prop is not used.
149
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-autofocus.md
150
+ "jsx-a11y-x/no-autofocus": ["error", { ignoreNonDOM: true }],
151
+
152
+ // Enforce distracting elements are not used.
153
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-distracting-elements.md
154
+ "jsx-a11y-x/no-distracting-elements": ["error", { elements: ["marquee", "blink"] }],
155
+
156
+ // Interactive elements should not be assigned non-interactive roles.
157
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md
158
+ "jsx-a11y-x/no-interactive-element-to-noninteractive-role": ["error", { tr: ["none", "presentation"] }],
159
+
160
+ // Non-interactive elements should not be assigned mouse or keyboard event listeners.
161
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-noninteractive-element-interactions.md
162
+ "jsx-a11y-x/no-noninteractive-element-interactions": [
163
+ "error",
164
+ { handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"] },
165
+ ],
166
+
167
+ // Non-interactive elements should not be assigned interactive roles.
168
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md
169
+ "jsx-a11y-x/no-noninteractive-element-to-interactive-role": [
170
+ "error",
171
+ {
172
+ ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
173
+ ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
174
+ li: ["menuitem", "option", "row", "tab", "treeitem"],
175
+ table: ["grid"],
176
+ td: ["gridcell"],
177
+ },
178
+ ],
179
+
180
+ // `tabIndex` should only be declared on interactive elements.
181
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-noninteractive-tabindex.md
182
+ "jsx-a11y-x/no-noninteractive-tabindex": ["error", { tags: [], roles: ["tabpanel"] }],
183
+
184
+ // Enforce explicit `role` property is not the same as implicit/default `role` property on element.
185
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-redundant-roles.md
186
+ "jsx-a11y-x/no-redundant-roles": "error",
187
+
188
+ // Enforce that non-interactive, visible elements (such as `<div>`) that have click handlers use the `role` attribute.
189
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/no-static-element-interactions.md
190
+ "jsx-a11y-x/no-static-element-interactions": [
191
+ "error",
192
+ { handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"] },
193
+ ],
194
+
195
+ // Enforces using semantic DOM elements over the ARIA role property.
196
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/prefer-tag-over-role.md
197
+ "jsx-a11y-x/prefer-tag-over-role": "off",
198
+
199
+ // Enforce that elements with ARIA roles must have all required attributes for that `role`.
200
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/role-has-required-aria-props.md
201
+ "jsx-a11y-x/role-has-required-aria-props": "error",
202
+
203
+ // Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.
204
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/role-supports-aria-props.md
205
+ "jsx-a11y-x/role-supports-aria-props": "error",
206
+
207
+ // Enforce `scope` prop is only used on `<th>` elements.
208
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/scope.md
209
+ "jsx-a11y-x/scope": "error",
210
+
211
+ // Enforce `tabIndex` value is not greater than zero.
212
+ // https://github.com/eslint-community/eslint-plugin-jsx-a11y-x/blob/main/docs/rules/tabindex-no-positive.md
213
+ "jsx-a11y-x/tabindex-no-positive": "error",
214
+ },
215
+ "jsx-a11y-x",
216
+ jsxA11y,
217
+ ),
218
+ });