eslint-config-airbnb-extended 1.0.11 → 2.0.0-beta-2

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