eslint-config-airbnb-extended 0.4.0 → 0.5.1

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.
@@ -11,11 +11,11 @@ const reactA11yRules = {
11
11
  },
12
12
  rules: {
13
13
  // ensure emoji are accessible
14
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
15
- // disabled; rule is deprecated
16
- 'jsx-a11y/accessible-emoji': 'off',
14
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
15
+ // @deprecated
16
+ // 'jsx-a11y/accessible-emoji': 'off',
17
17
  // Enforce that all elements that require alternative text have meaningful information
18
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
18
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
19
19
  'jsx-a11y/alt-text': [
20
20
  'error',
21
21
  {
@@ -26,11 +26,19 @@ const reactA11yRules = {
26
26
  'input[type="image"]': [],
27
27
  },
28
28
  ],
29
+ // Ensures anchor text is not ambiguous
30
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-ambiguous-text.md
31
+ 'jsx-a11y/anchor-ambiguous-text': 'off',
29
32
  // Enforce that anchors have content
30
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
31
- 'jsx-a11y/anchor-has-content': ['error', { components: [] }],
33
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-has-content.md
34
+ 'jsx-a11y/anchor-has-content': [
35
+ 'error',
36
+ {
37
+ components: [],
38
+ },
39
+ ],
32
40
  // ensure <a> tags are valid
33
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
41
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-is-valid.md
34
42
  'jsx-a11y/anchor-is-valid': [
35
43
  'error',
36
44
  {
@@ -40,34 +48,39 @@ const reactA11yRules = {
40
48
  },
41
49
  ],
42
50
  // elements with aria-activedescendant must be tabbable
43
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
51
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
44
52
  'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
45
53
  // Enforce all aria-* props are valid.
46
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
54
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-props.md
47
55
  'jsx-a11y/aria-props': 'error',
48
56
  // Enforce ARIA state and property values are valid.
49
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
57
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-proptypes.md
50
58
  'jsx-a11y/aria-proptypes': 'error',
51
59
  // Require ARIA roles to be valid and non-abstract
52
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
53
- 'jsx-a11y/aria-role': ['error', { ignoreNonDOM: false }],
60
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-role.md
61
+ 'jsx-a11y/aria-role': [
62
+ 'error',
63
+ {
64
+ ignoreNonDOM: false,
65
+ },
66
+ ],
54
67
  // Enforce that elements that do not support ARIA roles, states, and
55
68
  // properties do not have those attributes.
56
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
69
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
57
70
  'jsx-a11y/aria-unsupported-elements': 'error',
58
71
  // Ensure the autocomplete attribute is correct and suitable for the form field it is used with
59
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md
72
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/autocomplete-valid.md
60
73
  'jsx-a11y/autocomplete-valid': [
61
- 'off',
74
+ 'error',
62
75
  {
63
- inputComponents: [],
76
+ inputComponents: ['Input'],
64
77
  },
65
78
  ],
66
79
  // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
67
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
80
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/click-events-have-key-events.md
68
81
  'jsx-a11y/click-events-have-key-events': 'error',
69
82
  // Enforce that a control (an interactive element) has a text label.
70
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
83
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/control-has-associated-label.md
71
84
  'jsx-a11y/control-has-associated-label': [
72
85
  'error',
73
86
  {
@@ -90,22 +103,27 @@ const reactA11yRules = {
90
103
  },
91
104
  ],
92
105
  // ensure <hX> tags have content and are not aria-hidden
93
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
94
- 'jsx-a11y/heading-has-content': ['error', { components: [''] }],
106
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/heading-has-content.md
107
+ 'jsx-a11y/heading-has-content': [
108
+ 'error',
109
+ {
110
+ components: ['Typography', 'Text'],
111
+ },
112
+ ],
95
113
  // require HTML elements to have a "lang" prop
96
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
114
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/html-has-lang.md
97
115
  'jsx-a11y/html-has-lang': 'error',
98
116
  // ensure iframe elements have a unique title
99
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
117
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md
100
118
  'jsx-a11y/iframe-has-title': 'error',
101
119
  // Prevent img alt text from containing redundant words like "image", "picture", or "photo"
102
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
120
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md
103
121
  'jsx-a11y/img-redundant-alt': 'error',
104
122
  // Elements with an interactive role and interaction handlers must be focusable
105
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
123
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md
106
124
  'jsx-a11y/interactive-supports-focus': 'error',
107
125
  // Enforce that a label tag has a text label and an associated control.
108
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
126
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-associated-control.md
109
127
  'jsx-a11y/label-has-associated-control': [
110
128
  'error',
111
129
  {
@@ -116,11 +134,15 @@ const reactA11yRules = {
116
134
  depth: 25,
117
135
  },
118
136
  ],
137
+ // require that JSX labels use "htmlFor"
138
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
139
+ // @deprecated: replaced by `label-has-associated-control` rule
140
+ // 'jsx-a11y/label-has-for': 'off',
119
141
  // require HTML element's lang prop to be valid
120
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
142
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
121
143
  'jsx-a11y/lang': 'error',
122
144
  // media elements must have captions
123
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
145
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md
124
146
  'jsx-a11y/media-has-caption': [
125
147
  'error',
126
148
  {
@@ -129,17 +151,25 @@ const reactA11yRules = {
129
151
  track: [],
130
152
  },
131
153
  ],
132
- // require that mouseover/out come with focus/blur, for keyboard-only users
133
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
154
+ // require that mouseover/outcome with focus/blur, for keyboard-only users
155
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
134
156
  'jsx-a11y/mouse-events-have-key-events': 'error',
135
157
  // Prevent use of `accessKey`
136
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
158
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md
137
159
  'jsx-a11y/no-access-key': 'error',
160
+ // Enforce that aria-hidden="true" is not set on focusable elements.
161
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md
162
+ 'jsx-a11y/no-aria-hidden-on-focusable': 'off',
138
163
  // prohibit autoFocus prop
139
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
140
- 'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
164
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
165
+ 'jsx-a11y/no-autofocus': [
166
+ 'error',
167
+ {
168
+ ignoreNonDOM: true,
169
+ },
170
+ ],
141
171
  // prevent distracting elements, like <marquee> and <blink>
142
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
172
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
143
173
  'jsx-a11y/no-distracting-elements': [
144
174
  'error',
145
175
  {
@@ -147,7 +177,7 @@ const reactA11yRules = {
147
177
  },
148
178
  ],
149
179
  // WAI-ARIA roles should not be used to convert an interactive element to non-interactive
150
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
180
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md
151
181
  'jsx-a11y/no-interactive-element-to-noninteractive-role': [
152
182
  'error',
153
183
  {
@@ -155,7 +185,7 @@ const reactA11yRules = {
155
185
  },
156
186
  ],
157
187
  // A non-interactive element does not support event handlers (mouse and key handlers)
158
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
188
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-interactions.md
159
189
  'jsx-a11y/no-noninteractive-element-interactions': [
160
190
  'error',
161
191
  {
@@ -163,7 +193,7 @@ const reactA11yRules = {
163
193
  },
164
194
  ],
165
195
  // WAI-ARIA roles should not be used to convert a non-interactive element to interactive
166
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
196
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md
167
197
  'jsx-a11y/no-noninteractive-element-to-interactive-role': [
168
198
  'error',
169
199
  {
@@ -175,7 +205,7 @@ const reactA11yRules = {
175
205
  },
176
206
  ],
177
207
  // Tab key navigation should be limited to elements on the page that can be interacted with.
178
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
208
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md
179
209
  'jsx-a11y/no-noninteractive-tabindex': [
180
210
  'error',
181
211
  {
@@ -185,10 +215,11 @@ const reactA11yRules = {
185
215
  },
186
216
  ],
187
217
  // require onBlur instead of onChange
188
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
189
- 'jsx-a11y/no-onchange': 'off',
218
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
219
+ // @deprecated
220
+ // 'jsx-a11y/no-onchange': 'off',
190
221
  // ensure HTML elements do not specify redundant ARIA roles
191
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
222
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
192
223
  'jsx-a11y/no-redundant-roles': [
193
224
  'error',
194
225
  {
@@ -196,55 +227,30 @@ const reactA11yRules = {
196
227
  },
197
228
  ],
198
229
  // Enforce that DOM elements without semantic behavior not have interaction handlers
199
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
230
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-static-element-interactions.md
200
231
  'jsx-a11y/no-static-element-interactions': [
201
232
  'error',
202
233
  {
203
234
  handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
204
235
  },
205
236
  ],
237
+ // Enforces using semantic DOM elements over the ARIA role property.
238
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
239
+ 'jsx-a11y/prefer-tag-over-role': 'off',
206
240
  // Enforce that elements with ARIA roles must have all required attributes
207
241
  // for that role.
208
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
242
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
209
243
  'jsx-a11y/role-has-required-aria-props': 'error',
210
244
  // Enforce that elements with explicit or implicit roles defined contain
211
245
  // only aria-* properties supported by that role.
212
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
246
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
213
247
  'jsx-a11y/role-supports-aria-props': 'error',
214
248
  // only allow <th> to have the "scope" attr
215
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
249
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/scope.md
216
250
  'jsx-a11y/scope': 'error',
217
251
  // Enforce tabIndex value is not greater than zero.
218
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
252
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
219
253
  'jsx-a11y/tabindex-no-positive': 'error',
220
- // ----------------------------------------------------
221
- // Rules that no longer exist in eslint-plugin-jsx-a11y
222
- // ----------------------------------------------------
223
- // require that JSX labels use "htmlFor"
224
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
225
- // deprecated: replaced by `label-has-associated-control` rule
226
- 'jsx-a11y/label-has-for': [
227
- 'off',
228
- {
229
- components: [],
230
- required: {
231
- every: ['nesting', 'id'],
232
- },
233
- allowChildren: false,
234
- },
235
- ],
236
- // Ensures anchor text is not ambiguous
237
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/anchor-ambiguous-text.md
238
- // TODO: semver-major, enable
239
- 'jsx-a11y/anchor-ambiguous-text': 'off',
240
- // Enforce that aria-hidden="true" is not set on focusable elements.
241
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/no-aria-hidden-on-focusable.md
242
- // TODO: semver-major, enable
243
- 'jsx-a11y/no-aria-hidden-on-focusable': 'off',
244
- // Enforces using semantic DOM elements over the ARIA role property.
245
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/prefer-tag-over-role.md
246
- // TODO: semver-major, enable
247
- 'jsx-a11y/prefer-tag-over-role': 'off',
248
254
  },
249
255
  };
250
256
  exports.default = reactA11yRules;
@@ -10,12 +10,12 @@ const reactHooksRules = {
10
10
  },
11
11
  },
12
12
  rules: {
13
- // Enforce Rules of Hooks
14
- // https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
15
- 'react-hooks/rules-of-hooks': 'error',
16
13
  // Verify the list of the dependencies for Hooks like useEffect and similar
17
- // https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
14
+ // https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/rules/ExhaustiveDeps.ts
18
15
  'react-hooks/exhaustive-deps': 'error',
16
+ // Enforce Rules of Hooks
17
+ // https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts
18
+ 'react-hooks/rules-of-hooks': 'error',
19
19
  },
20
20
  };
21
21
  exports.default = reactHooksRules;