eslint-config-airbnb-extended 0.1.0 → 0.1.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.
- package/dist/base/index.d.ts +841 -0
- package/dist/base/index.js +23 -0
- package/dist/base/recommended.d.ts +2 -0
- package/dist/base/recommended.js +19 -0
- package/dist/index.d.ts +2654 -0
- package/dist/index.js +29 -0
- package/dist/react/index.d.ts +1798 -0
- package/dist/react/index.js +13 -0
- package/dist/react/recommended.d.ts +2 -0
- package/dist/react/recommended.js +8 -0
- package/dist/rules/best-practices.d.ts +177 -0
- package/dist/rules/best-practices.js +379 -0
- package/dist/rules/errors.d.ts +69 -0
- package/dist/rules/errors.js +151 -0
- package/dist/rules/es6.d.ts +146 -0
- package/dist/rules/es6.js +192 -0
- package/dist/rules/imports.d.ts +157 -0
- package/dist/rules/imports.js +256 -0
- package/dist/rules/node.d.ts +90 -0
- package/dist/rules/node.js +39 -0
- package/dist/rules/react-a11y.d.ts +117 -0
- package/dist/rules/react-a11y.js +255 -0
- package/dist/rules/react-hooks.d.ts +19 -0
- package/dist/rules/react-hooks.js +57 -0
- package/dist/rules/react.d.ts +1664 -0
- package/dist/rules/react.js +583 -0
- package/dist/rules/strict.d.ts +7 -0
- package/dist/rules/strict.js +9 -0
- package/dist/rules/style.d.ts +320 -0
- package/dist/rules/style.js +530 -0
- package/dist/rules/typescript.d.ts +4 -0
- package/dist/rules/typescript.js +264 -0
- package/dist/rules/variables.d.ts +35 -0
- package/dist/rules/variables.js +65 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/index.js +9 -0
- package/dist/typescript/recommended.d.ts +6 -0
- package/dist/typescript/recommended.js +62 -0
- package/package.json +6 -7
- package/CHANGELOG.md +0 -7
- package/base/index.ts +0 -21
- package/base/recommended.ts +0 -17
- package/index.ts +0 -25
- package/react/index.ts +0 -11
- package/react/recommended.ts +0 -6
- package/rules/best-practices.ts +0 -462
- package/rules/errors.ts +0 -199
- package/rules/es6.ts +0 -224
- package/rules/imports.ts +0 -308
- package/rules/node.ts +0 -49
- package/rules/react-a11y.ts +0 -295
- package/rules/react-hooks.ts +0 -26
- package/rules/react.ts +0 -692
- package/rules/strict.ts +0 -9
- package/rules/style.ts +0 -632
- package/rules/typescript.ts +0 -312
- package/rules/variables.ts +0 -76
- package/tsconfig.json +0 -22
- package/typescript/index.ts +0 -7
- package/typescript/recommended.ts +0 -30
package/rules/react-a11y.ts
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import type { Linter } from 'eslint';
|
|
2
|
-
|
|
3
|
-
// @ts-expect-error eslint-plugin-import not working in import
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
|
|
5
|
-
const EsLintPluginJSXA11y = require('eslint-plugin-jsx-a11y');
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
name: 'airbnb/config/react-a11y',
|
|
9
|
-
plugins: {
|
|
10
|
-
'jsx-a11y': EsLintPluginJSXA11y,
|
|
11
|
-
},
|
|
12
|
-
languageOptions: {
|
|
13
|
-
parserOptions: {
|
|
14
|
-
ecmaFeatures: {
|
|
15
|
-
jsx: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
// ensure emoji are accessible
|
|
21
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md
|
|
22
|
-
// disabled; rule is deprecated
|
|
23
|
-
'jsx-a11y/accessible-emoji': 'off',
|
|
24
|
-
|
|
25
|
-
// Enforce that all elements that require alternative text have meaningful information
|
|
26
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
|
|
27
|
-
'jsx-a11y/alt-text': [
|
|
28
|
-
'error',
|
|
29
|
-
{
|
|
30
|
-
elements: ['img', 'object', 'area', 'input[type="image"]'],
|
|
31
|
-
img: [],
|
|
32
|
-
object: [],
|
|
33
|
-
area: [],
|
|
34
|
-
'input[type="image"]': [],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
|
|
38
|
-
// Enforce that anchors have content
|
|
39
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
|
|
40
|
-
'jsx-a11y/anchor-has-content': ['error', { components: [] }],
|
|
41
|
-
|
|
42
|
-
// ensure <a> tags are valid
|
|
43
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
|
|
44
|
-
'jsx-a11y/anchor-is-valid': [
|
|
45
|
-
'error',
|
|
46
|
-
{
|
|
47
|
-
components: ['Link'],
|
|
48
|
-
specialLink: ['to'],
|
|
49
|
-
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
// elements with aria-activedescendant must be tabbable
|
|
54
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
|
|
55
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
56
|
-
|
|
57
|
-
// Enforce all aria-* props are valid.
|
|
58
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
|
|
59
|
-
'jsx-a11y/aria-props': 'error',
|
|
60
|
-
|
|
61
|
-
// Enforce ARIA state and property values are valid.
|
|
62
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
|
|
63
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
64
|
-
|
|
65
|
-
// Require ARIA roles to be valid and non-abstract
|
|
66
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
|
|
67
|
-
'jsx-a11y/aria-role': ['error', { ignoreNonDOM: false }],
|
|
68
|
-
|
|
69
|
-
// Enforce that elements that do not support ARIA roles, states, and
|
|
70
|
-
// properties do not have those attributes.
|
|
71
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
|
|
72
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
73
|
-
|
|
74
|
-
// Ensure the autocomplete attribute is correct and suitable for the form field it is used with
|
|
75
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md
|
|
76
|
-
'jsx-a11y/autocomplete-valid': [
|
|
77
|
-
'off',
|
|
78
|
-
{
|
|
79
|
-
inputComponents: [],
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
|
|
83
|
-
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
84
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
|
|
85
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
86
|
-
|
|
87
|
-
// Enforce that a control (an interactive element) has a text label.
|
|
88
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
|
|
89
|
-
'jsx-a11y/control-has-associated-label': [
|
|
90
|
-
'error',
|
|
91
|
-
{
|
|
92
|
-
labelAttributes: ['label'],
|
|
93
|
-
controlComponents: [],
|
|
94
|
-
ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
|
|
95
|
-
ignoreRoles: [
|
|
96
|
-
'grid',
|
|
97
|
-
'listbox',
|
|
98
|
-
'menu',
|
|
99
|
-
'menubar',
|
|
100
|
-
'radiogroup',
|
|
101
|
-
'row',
|
|
102
|
-
'tablist',
|
|
103
|
-
'toolbar',
|
|
104
|
-
'tree',
|
|
105
|
-
'treegrid',
|
|
106
|
-
],
|
|
107
|
-
depth: 5,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
// ensure <hX> tags have content and are not aria-hidden
|
|
112
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
|
|
113
|
-
'jsx-a11y/heading-has-content': ['error', { components: [''] }],
|
|
114
|
-
|
|
115
|
-
// require HTML elements to have a "lang" prop
|
|
116
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
|
|
117
|
-
'jsx-a11y/html-has-lang': 'error',
|
|
118
|
-
|
|
119
|
-
// ensure iframe elements have a unique title
|
|
120
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
|
|
121
|
-
'jsx-a11y/iframe-has-title': 'error',
|
|
122
|
-
|
|
123
|
-
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
124
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
|
|
125
|
-
'jsx-a11y/img-redundant-alt': 'error',
|
|
126
|
-
|
|
127
|
-
// Elements with an interactive role and interaction handlers must be focusable
|
|
128
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
|
|
129
|
-
'jsx-a11y/interactive-supports-focus': 'error',
|
|
130
|
-
|
|
131
|
-
// Enforce that a label tag has a text label and an associated control.
|
|
132
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
|
|
133
|
-
'jsx-a11y/label-has-associated-control': [
|
|
134
|
-
'error',
|
|
135
|
-
{
|
|
136
|
-
labelComponents: [],
|
|
137
|
-
labelAttributes: [],
|
|
138
|
-
controlComponents: [],
|
|
139
|
-
assert: 'both',
|
|
140
|
-
depth: 25,
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
|
|
144
|
-
// require HTML element's lang prop to be valid
|
|
145
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
|
|
146
|
-
'jsx-a11y/lang': 'error',
|
|
147
|
-
|
|
148
|
-
// media elements must have captions
|
|
149
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
|
|
150
|
-
'jsx-a11y/media-has-caption': [
|
|
151
|
-
'error',
|
|
152
|
-
{
|
|
153
|
-
audio: [],
|
|
154
|
-
video: [],
|
|
155
|
-
track: [],
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
|
|
159
|
-
// require that mouseover/out come with focus/blur, for keyboard-only users
|
|
160
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
|
|
161
|
-
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
162
|
-
|
|
163
|
-
// Prevent use of `accessKey`
|
|
164
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
|
|
165
|
-
'jsx-a11y/no-access-key': 'error',
|
|
166
|
-
|
|
167
|
-
// prohibit autoFocus prop
|
|
168
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
|
|
169
|
-
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
|
|
170
|
-
|
|
171
|
-
// prevent distracting elements, like <marquee> and <blink>
|
|
172
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
|
|
173
|
-
'jsx-a11y/no-distracting-elements': [
|
|
174
|
-
'error',
|
|
175
|
-
{
|
|
176
|
-
elements: ['marquee', 'blink'],
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
|
|
180
|
-
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
181
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
|
|
182
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
183
|
-
'error',
|
|
184
|
-
{
|
|
185
|
-
tr: ['none', 'presentation'],
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
|
|
189
|
-
// A non-interactive element does not support event handlers (mouse and key handlers)
|
|
190
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
|
|
191
|
-
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
192
|
-
'error',
|
|
193
|
-
{
|
|
194
|
-
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
|
|
198
|
-
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
199
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
|
|
200
|
-
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
201
|
-
'error',
|
|
202
|
-
{
|
|
203
|
-
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
204
|
-
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
205
|
-
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
206
|
-
table: ['grid'],
|
|
207
|
-
td: ['gridcell'],
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
|
|
211
|
-
// Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
212
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
|
|
213
|
-
'jsx-a11y/no-noninteractive-tabindex': [
|
|
214
|
-
'error',
|
|
215
|
-
{
|
|
216
|
-
tags: [],
|
|
217
|
-
roles: ['tabpanel'],
|
|
218
|
-
allowExpressionValues: true,
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
|
|
222
|
-
// require onBlur instead of onChange
|
|
223
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
|
|
224
|
-
'jsx-a11y/no-onchange': 'off',
|
|
225
|
-
|
|
226
|
-
// ensure HTML elements do not specify redundant ARIA roles
|
|
227
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
|
|
228
|
-
'jsx-a11y/no-redundant-roles': [
|
|
229
|
-
'error',
|
|
230
|
-
{
|
|
231
|
-
nav: ['navigation'],
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
|
|
235
|
-
// Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
236
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
|
|
237
|
-
'jsx-a11y/no-static-element-interactions': [
|
|
238
|
-
'error',
|
|
239
|
-
{
|
|
240
|
-
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
241
|
-
},
|
|
242
|
-
],
|
|
243
|
-
|
|
244
|
-
// Enforce that elements with ARIA roles must have all required attributes
|
|
245
|
-
// for that role.
|
|
246
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
|
|
247
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
248
|
-
|
|
249
|
-
// Enforce that elements with explicit or implicit roles defined contain
|
|
250
|
-
// only aria-* properties supported by that role.
|
|
251
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
|
|
252
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
253
|
-
|
|
254
|
-
// only allow <th> to have the "scope" attr
|
|
255
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
|
|
256
|
-
'jsx-a11y/scope': 'error',
|
|
257
|
-
|
|
258
|
-
// Enforce tabIndex value is not greater than zero.
|
|
259
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
|
|
260
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
261
|
-
|
|
262
|
-
// ----------------------------------------------------
|
|
263
|
-
// Rules that no longer exist in eslint-plugin-jsx-a11y
|
|
264
|
-
// ----------------------------------------------------
|
|
265
|
-
|
|
266
|
-
// require that JSX labels use "htmlFor"
|
|
267
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md
|
|
268
|
-
// deprecated: replaced by `label-has-associated-control` rule
|
|
269
|
-
'jsx-a11y/label-has-for': [
|
|
270
|
-
'off',
|
|
271
|
-
{
|
|
272
|
-
components: [],
|
|
273
|
-
required: {
|
|
274
|
-
every: ['nesting', 'id'],
|
|
275
|
-
},
|
|
276
|
-
allowChildren: false,
|
|
277
|
-
},
|
|
278
|
-
],
|
|
279
|
-
|
|
280
|
-
// Ensures anchor text is not ambiguous
|
|
281
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/anchor-ambiguous-text.md
|
|
282
|
-
// TODO: semver-major, enable
|
|
283
|
-
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
284
|
-
|
|
285
|
-
// Enforce that aria-hidden="true" is not set on focusable elements.
|
|
286
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/no-aria-hidden-on-focusable.md
|
|
287
|
-
// TODO: semver-major, enable
|
|
288
|
-
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
289
|
-
|
|
290
|
-
// Enforces using semantic DOM elements over the ARIA role property.
|
|
291
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/93f78856655696a55309440593e0948c6fb96134/docs/rules/prefer-tag-over-role.md
|
|
292
|
-
// TODO: semver-major, enable
|
|
293
|
-
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
294
|
-
},
|
|
295
|
-
} satisfies Linter.Config;
|
package/rules/react-hooks.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as EsLintPluginReactHooks from 'eslint-plugin-react-hooks';
|
|
2
|
-
|
|
3
|
-
import type { Linter } from 'eslint';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'airbnb/config/react-hooks',
|
|
7
|
-
plugins: {
|
|
8
|
-
'react-hooks': EsLintPluginReactHooks,
|
|
9
|
-
},
|
|
10
|
-
languageOptions: {
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaFeatures: {
|
|
13
|
-
jsx: true,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
rules: {
|
|
18
|
-
// Enforce Rules of Hooks
|
|
19
|
-
// https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
|
|
20
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
21
|
-
|
|
22
|
-
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
23
|
-
// https://github.com/facebook/react/blob/1204c789776cb01fbaf3e9f032e7e2ba85a44137/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
|
|
24
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
25
|
-
},
|
|
26
|
-
} satisfies Linter.Config;
|