eslint-config-airbnb-extended 0.6.0 → 0.8.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.
- package/README.md +1 -0
- package/dist/@types/index.d.ts +7 -4
- package/dist/configs/base/index.js +0 -2
- package/dist/configs/base/recommended.js +2 -2
- package/dist/configs/index.js +14 -10
- package/dist/configs/node/index.js +16 -0
- package/dist/configs/node/recommended.js +22 -0
- package/dist/configs/react/index.js +2 -2
- package/dist/configs/react/recommended.js +43 -3
- package/dist/configs/typescript/recommended.js +2 -2
- package/dist/plugins/importXPlugin.js +44 -0
- package/dist/plugins/index.js +5 -1
- package/dist/plugins/nextPlugin.js +2 -2
- package/dist/plugins/nodePlugin.js +13 -0
- package/dist/plugins/reactA11yPlugin.js +2 -2
- package/dist/plugins/reactHooksPlugin.js +2 -2
- package/dist/rules/imports.js +19 -10
- package/dist/rules/index.js +2 -0
- package/dist/rules/node/nodeBase.js +121 -0
- package/dist/rules/node/nodeGlobals.js +29 -0
- package/dist/rules/node/nodeNoUnsupportedFeatures.js +17 -0
- package/dist/rules/node/nodePromises.js +14 -0
- package/dist/rules/react-a11y.js +15 -12
- package/dist/rules/react-jsx-a11y.js +259 -0
- package/dist/rules/react.js +12 -42
- package/dist/script/checkUpdates.js +114 -0
- package/package.json +11 -1
- package/dist/rules/node.js +0 -40
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nodePromisesRules = {
|
|
4
|
+
name: 'airbnb/config/node/promises',
|
|
5
|
+
rules: {
|
|
6
|
+
// Enforce require("dns").promises
|
|
7
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/dns.md
|
|
8
|
+
'n/prefer-promises/dns': 'error',
|
|
9
|
+
// Enforce require("fs").promises
|
|
10
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/fs.md
|
|
11
|
+
'n/prefer-promises/fs': 'error',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
exports.default = nodePromisesRules;
|
package/dist/rules/react-a11y.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecatedReactA11yRules = void 0;
|
|
3
4
|
const reactA11yRules = {
|
|
4
5
|
name: 'airbnb/config/react-a11y',
|
|
5
6
|
languageOptions: {
|
|
@@ -10,10 +11,6 @@ const reactA11yRules = {
|
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
13
|
rules: {
|
|
13
|
-
// ensure emoji are accessible
|
|
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
14
|
// Enforce that all elements that require alternative text have meaningful information
|
|
18
15
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
|
|
19
16
|
'jsx-a11y/alt-text': [
|
|
@@ -134,10 +131,6 @@ const reactA11yRules = {
|
|
|
134
131
|
depth: 25,
|
|
135
132
|
},
|
|
136
133
|
],
|
|
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',
|
|
141
134
|
// require HTML element's lang prop to be valid
|
|
142
135
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
|
|
143
136
|
'jsx-a11y/lang': 'error',
|
|
@@ -214,10 +207,6 @@ const reactA11yRules = {
|
|
|
214
207
|
allowExpressionValues: true,
|
|
215
208
|
},
|
|
216
209
|
],
|
|
217
|
-
// require onBlur instead of onChange
|
|
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',
|
|
221
210
|
// ensure HTML elements do not specify redundant ARIA roles
|
|
222
211
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
|
|
223
212
|
'jsx-a11y/no-redundant-roles': [
|
|
@@ -253,4 +242,18 @@ const reactA11yRules = {
|
|
|
253
242
|
'jsx-a11y/tabindex-no-positive': 'error',
|
|
254
243
|
},
|
|
255
244
|
};
|
|
245
|
+
exports.deprecatedReactA11yRules = {
|
|
246
|
+
name: 'airbnb/config/react-a11y/deprecated',
|
|
247
|
+
rules: {
|
|
248
|
+
// ensure emoji are accessible
|
|
249
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
|
|
250
|
+
'jsx-a11y/accessible-emoji': 'off',
|
|
251
|
+
// require that JSX labels use "htmlFor"
|
|
252
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
253
|
+
'jsx-a11y/label-has-for': 'off',
|
|
254
|
+
// require onBlur instead of onChange
|
|
255
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
256
|
+
'jsx-a11y/no-onchange': 'off',
|
|
257
|
+
},
|
|
258
|
+
};
|
|
256
259
|
exports.default = reactA11yRules;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecatedReactJsxA11yRules = void 0;
|
|
4
|
+
const reactJsxA11yRules = {
|
|
5
|
+
name: 'airbnb/config/react-jsx-a11y',
|
|
6
|
+
languageOptions: {
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaFeatures: {
|
|
9
|
+
jsx: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
// Enforce that all elements that require alternative text have meaningful information
|
|
15
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
|
|
16
|
+
'jsx-a11y/alt-text': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
elements: ['img', 'object', 'area', 'input[type="image"]'],
|
|
20
|
+
img: [],
|
|
21
|
+
object: [],
|
|
22
|
+
area: [],
|
|
23
|
+
'input[type="image"]': [],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
// Ensures anchor text is not ambiguous
|
|
27
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-ambiguous-text.md
|
|
28
|
+
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
29
|
+
// Enforce that anchors have content
|
|
30
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-has-content.md
|
|
31
|
+
'jsx-a11y/anchor-has-content': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
components: [],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
// ensure <a> tags are valid
|
|
38
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-is-valid.md
|
|
39
|
+
'jsx-a11y/anchor-is-valid': [
|
|
40
|
+
'error',
|
|
41
|
+
{
|
|
42
|
+
components: ['Link'],
|
|
43
|
+
specialLink: ['to'],
|
|
44
|
+
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
// elements with aria-activedescendant must be tabbable
|
|
48
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
|
|
49
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
50
|
+
// Enforce all aria-* props are valid.
|
|
51
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-props.md
|
|
52
|
+
'jsx-a11y/aria-props': 'error',
|
|
53
|
+
// Enforce ARIA state and property values are valid.
|
|
54
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-proptypes.md
|
|
55
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
56
|
+
// Require ARIA roles to be valid and non-abstract
|
|
57
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-role.md
|
|
58
|
+
'jsx-a11y/aria-role': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
ignoreNonDOM: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
// Enforce that elements that do not support ARIA roles, states, and
|
|
65
|
+
// properties do not have those attributes.
|
|
66
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
|
|
67
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
68
|
+
// Ensure the autocomplete attribute is correct and suitable for the form field it is used with
|
|
69
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/autocomplete-valid.md
|
|
70
|
+
'jsx-a11y/autocomplete-valid': [
|
|
71
|
+
'error',
|
|
72
|
+
{
|
|
73
|
+
inputComponents: ['Input'],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
77
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/click-events-have-key-events.md
|
|
78
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
79
|
+
// Enforce that a control (an interactive element) has a text label.
|
|
80
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/control-has-associated-label.md
|
|
81
|
+
'jsx-a11y/control-has-associated-label': [
|
|
82
|
+
'error',
|
|
83
|
+
{
|
|
84
|
+
labelAttributes: ['label'],
|
|
85
|
+
controlComponents: [],
|
|
86
|
+
ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
|
|
87
|
+
ignoreRoles: [
|
|
88
|
+
'grid',
|
|
89
|
+
'listbox',
|
|
90
|
+
'menu',
|
|
91
|
+
'menubar',
|
|
92
|
+
'radiogroup',
|
|
93
|
+
'row',
|
|
94
|
+
'tablist',
|
|
95
|
+
'toolbar',
|
|
96
|
+
'tree',
|
|
97
|
+
'treegrid',
|
|
98
|
+
],
|
|
99
|
+
depth: 5,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
// ensure <hX> tags have content and are not aria-hidden
|
|
103
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/heading-has-content.md
|
|
104
|
+
'jsx-a11y/heading-has-content': [
|
|
105
|
+
'error',
|
|
106
|
+
{
|
|
107
|
+
components: ['Typography', 'Text'],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
// require HTML elements to have a "lang" prop
|
|
111
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/html-has-lang.md
|
|
112
|
+
'jsx-a11y/html-has-lang': 'error',
|
|
113
|
+
// ensure iframe elements have a unique title
|
|
114
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md
|
|
115
|
+
'jsx-a11y/iframe-has-title': 'error',
|
|
116
|
+
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
117
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md
|
|
118
|
+
'jsx-a11y/img-redundant-alt': 'error',
|
|
119
|
+
// Elements with an interactive role and interaction handlers must be focusable
|
|
120
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md
|
|
121
|
+
'jsx-a11y/interactive-supports-focus': 'error',
|
|
122
|
+
// Enforce that a label tag has a text label and an associated control.
|
|
123
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-associated-control.md
|
|
124
|
+
'jsx-a11y/label-has-associated-control': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
labelComponents: [],
|
|
128
|
+
labelAttributes: [],
|
|
129
|
+
controlComponents: [],
|
|
130
|
+
assert: 'both',
|
|
131
|
+
depth: 25,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
// require HTML element's lang prop to be valid
|
|
135
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
|
|
136
|
+
'jsx-a11y/lang': 'error',
|
|
137
|
+
// media elements must have captions
|
|
138
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md
|
|
139
|
+
'jsx-a11y/media-has-caption': [
|
|
140
|
+
'error',
|
|
141
|
+
{
|
|
142
|
+
audio: [],
|
|
143
|
+
video: [],
|
|
144
|
+
track: [],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
// require that mouseover/outcome with focus/blur, for keyboard-only users
|
|
148
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
|
|
149
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
150
|
+
// Prevent use of `accessKey`
|
|
151
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md
|
|
152
|
+
'jsx-a11y/no-access-key': 'error',
|
|
153
|
+
// Enforce that aria-hidden="true" is not set on focusable elements.
|
|
154
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md
|
|
155
|
+
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
156
|
+
// prohibit autoFocus prop
|
|
157
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
|
|
158
|
+
'jsx-a11y/no-autofocus': [
|
|
159
|
+
'error',
|
|
160
|
+
{
|
|
161
|
+
ignoreNonDOM: true,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
// prevent distracting elements, like <marquee> and <blink>
|
|
165
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
|
|
166
|
+
'jsx-a11y/no-distracting-elements': [
|
|
167
|
+
'error',
|
|
168
|
+
{
|
|
169
|
+
elements: ['marquee', 'blink'],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
173
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md
|
|
174
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
175
|
+
'error',
|
|
176
|
+
{
|
|
177
|
+
tr: ['none', 'presentation'],
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
// A non-interactive element does not support event handlers (mouse and key handlers)
|
|
181
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-interactions.md
|
|
182
|
+
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
183
|
+
'error',
|
|
184
|
+
{
|
|
185
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
189
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md
|
|
190
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
191
|
+
'error',
|
|
192
|
+
{
|
|
193
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
194
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
195
|
+
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
196
|
+
table: ['grid'],
|
|
197
|
+
td: ['gridcell'],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
// Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
201
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md
|
|
202
|
+
'jsx-a11y/no-noninteractive-tabindex': [
|
|
203
|
+
'error',
|
|
204
|
+
{
|
|
205
|
+
tags: [],
|
|
206
|
+
roles: ['tabpanel'],
|
|
207
|
+
allowExpressionValues: true,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
// ensure HTML elements do not specify redundant ARIA roles
|
|
211
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
|
|
212
|
+
'jsx-a11y/no-redundant-roles': [
|
|
213
|
+
'error',
|
|
214
|
+
{
|
|
215
|
+
nav: ['navigation'],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
// Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
219
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-static-element-interactions.md
|
|
220
|
+
'jsx-a11y/no-static-element-interactions': [
|
|
221
|
+
'error',
|
|
222
|
+
{
|
|
223
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
// Enforces using semantic DOM elements over the ARIA role property.
|
|
227
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
|
|
228
|
+
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
229
|
+
// Enforce that elements with ARIA roles must have all required attributes
|
|
230
|
+
// for that role.
|
|
231
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
|
|
232
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
233
|
+
// Enforce that elements with explicit or implicit roles defined contain
|
|
234
|
+
// only aria-* properties supported by that role.
|
|
235
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
|
|
236
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
237
|
+
// only allow <th> to have the "scope" attr
|
|
238
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/scope.md
|
|
239
|
+
'jsx-a11y/scope': 'error',
|
|
240
|
+
// Enforce tabIndex value is not greater than zero.
|
|
241
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
|
|
242
|
+
'jsx-a11y/tabindex-no-positive': 'error',
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
exports.deprecatedReactJsxA11yRules = {
|
|
246
|
+
name: 'airbnb/config/react-jsx-a11y/deprecated',
|
|
247
|
+
rules: {
|
|
248
|
+
// ensure emoji are accessible
|
|
249
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
|
|
250
|
+
'jsx-a11y/accessible-emoji': 'off',
|
|
251
|
+
// require that JSX labels use "htmlFor"
|
|
252
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
253
|
+
'jsx-a11y/label-has-for': 'off',
|
|
254
|
+
// require onBlur instead of onChange
|
|
255
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
256
|
+
'jsx-a11y/no-onchange': 'off',
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
exports.default = reactJsxA11yRules;
|
package/dist/rules/react.js
CHANGED
|
@@ -3,9 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deprecatedReactRules = void 0;
|
|
6
7
|
const globals_1 = __importDefault(require("globals"));
|
|
7
|
-
const style_1 = __importDefault(require("../rules/style"));
|
|
8
|
-
const dangleRules = style_1.default.rules['no-underscore-dangle'];
|
|
9
8
|
const reactRules = {
|
|
10
9
|
name: 'airbnb/config/react',
|
|
11
10
|
languageOptions: {
|
|
@@ -24,38 +23,6 @@ const reactRules = {
|
|
|
24
23
|
// View link below for react rules documentation
|
|
25
24
|
// https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
|
|
26
25
|
rules: {
|
|
27
|
-
// Allow Redux devtools variable
|
|
28
|
-
'no-underscore-dangle': [
|
|
29
|
-
dangleRules[0],
|
|
30
|
-
Object.assign(Object.assign({}, dangleRules[1]), { allow: [...dangleRules[1].allow, '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] }),
|
|
31
|
-
],
|
|
32
|
-
// Specify whether double or single quotes should be used in JSX attributes
|
|
33
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
34
|
-
'jsx-quotes': ['error', 'prefer-double'],
|
|
35
|
-
// Class Methods can be used in react
|
|
36
|
-
'class-methods-use-this': [
|
|
37
|
-
'error',
|
|
38
|
-
{
|
|
39
|
-
exceptMethods: [
|
|
40
|
-
'render',
|
|
41
|
-
'getInitialState',
|
|
42
|
-
'getDefaultProps',
|
|
43
|
-
'getChildContext',
|
|
44
|
-
'componentWillMount',
|
|
45
|
-
'UNSAFE_componentWillMount',
|
|
46
|
-
'componentDidMount',
|
|
47
|
-
'componentWillReceiveProps',
|
|
48
|
-
'UNSAFE_componentWillReceiveProps',
|
|
49
|
-
'shouldComponentUpdate',
|
|
50
|
-
'componentWillUpdate',
|
|
51
|
-
'UNSAFE_componentWillUpdate',
|
|
52
|
-
'componentDidUpdate',
|
|
53
|
-
'componentWillUnmount',
|
|
54
|
-
'componentDidCatch',
|
|
55
|
-
'getSnapshotBeforeUpdate',
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
26
|
// Enforces consistent naming for boolean props
|
|
60
27
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
61
28
|
'react/boolean-prop-naming': 'off',
|
|
@@ -314,17 +281,9 @@ const reactRules = {
|
|
|
314
281
|
// Disallow JSX props spreading
|
|
315
282
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
316
283
|
'react/jsx-props-no-spreading': 'off',
|
|
317
|
-
// Enforce defaultProps declarations alphabetical sorting
|
|
318
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
319
|
-
// @deprecated
|
|
320
|
-
'react/jsx-sort-default-props': 'off',
|
|
321
284
|
// Enforce props alphabetical sorting
|
|
322
285
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
323
286
|
'react/jsx-sort-props': 'off',
|
|
324
|
-
// Enforce spaces before the closing bracket of self-closing JSX elements, Deprecated in favor of jsx-tag-spacing
|
|
325
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
|
|
326
|
-
// @deprecated
|
|
327
|
-
'react/jsx-space-before-closing': 'off',
|
|
328
287
|
// Validate whitespace in and around the JSX opening and closing brackets
|
|
329
288
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
|
|
330
289
|
'react/jsx-tag-spacing': [
|
|
@@ -609,4 +568,15 @@ const reactRules = {
|
|
|
609
568
|
'react/void-dom-elements-no-children': 'error',
|
|
610
569
|
},
|
|
611
570
|
};
|
|
571
|
+
exports.deprecatedReactRules = {
|
|
572
|
+
name: 'airbnb/config/react/deprecated',
|
|
573
|
+
rules: {
|
|
574
|
+
// Enforce defaultProps declarations alphabetical sorting
|
|
575
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
576
|
+
'react/jsx-sort-default-props': 'off',
|
|
577
|
+
// Enforce spaces before the closing bracket of self-closing JSX elements, Deprecated in favor of jsx-tag-spacing
|
|
578
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
|
|
579
|
+
'react/jsx-space-before-closing': 'off',
|
|
580
|
+
},
|
|
581
|
+
};
|
|
612
582
|
exports.default = reactRules;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
const eslint_plugin_import_x_1 = __importDefault(require("eslint-plugin-import-x"));
|
|
49
|
+
const eslint_plugin_jsx_a11y_1 = __importDefault(require("eslint-plugin-jsx-a11y"));
|
|
50
|
+
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
51
|
+
const eslint_plugin_react_1 = __importDefault(require("eslint-plugin-react"));
|
|
52
|
+
const eslint_plugin_react_hooks_1 = __importDefault(require("eslint-plugin-react-hooks"));
|
|
53
|
+
const imports_1 = __importStar(require("../rules/imports"));
|
|
54
|
+
const nodeBase_1 = __importStar(require("../rules/node/nodeBase"));
|
|
55
|
+
const nodeGlobals_1 = __importDefault(require("../rules/node/nodeGlobals"));
|
|
56
|
+
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../rules/node/nodeNoUnsupportedFeatures"));
|
|
57
|
+
const nodePromises_1 = __importDefault(require("../rules/node/nodePromises"));
|
|
58
|
+
const react_1 = __importStar(require("../rules/react"));
|
|
59
|
+
const react_hooks_1 = __importDefault(require("../rules/react-hooks"));
|
|
60
|
+
const react_jsx_a11y_1 = __importStar(require("../rules/react-jsx-a11y"));
|
|
61
|
+
const getRulesArray = (prefix, arr) => arr.filter((rule) => rule.startsWith(prefix));
|
|
62
|
+
const checkImportsUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const localRules = getRulesArray('import-x/', Object.keys(imports_1.default.rules));
|
|
64
|
+
const deprecatedLocalRules = getRulesArray('import-x/', Object.keys(imports_1.deprecatedImportsRules.rules));
|
|
65
|
+
const remoteRules = Object.keys(eslint_plugin_import_x_1.default.rules);
|
|
66
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
67
|
+
return true;
|
|
68
|
+
throw new Error('Import X Plugin Updated');
|
|
69
|
+
});
|
|
70
|
+
const checkNodeUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const localRules = getRulesArray('n/', [
|
|
72
|
+
...Object.keys(nodeBase_1.default.rules),
|
|
73
|
+
...Object.keys(nodeGlobals_1.default.rules),
|
|
74
|
+
...Object.keys(nodePromises_1.default.rules),
|
|
75
|
+
...Object.keys(nodeNoUnsupportedFeatures_1.default.rules),
|
|
76
|
+
]);
|
|
77
|
+
const deprecatedLocalRules = getRulesArray('n/', Object.keys(nodeBase_1.deprecatedNodeBaseRules.rules));
|
|
78
|
+
const remoteRules = eslint_plugin_n_1.default.rules ? Object.keys(eslint_plugin_n_1.default.rules) : [];
|
|
79
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
80
|
+
return true;
|
|
81
|
+
throw new Error('Node Plugin Updated');
|
|
82
|
+
});
|
|
83
|
+
const checkReactUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
const localRules = getRulesArray('react/', Object.keys(react_1.default.rules));
|
|
85
|
+
const deprecatedLocalRules = getRulesArray('react/', Object.keys(react_1.deprecatedReactRules.rules));
|
|
86
|
+
const remoteRules = Object.keys(eslint_plugin_react_1.default.rules);
|
|
87
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
88
|
+
return true;
|
|
89
|
+
throw new Error('React Plugin Updated');
|
|
90
|
+
});
|
|
91
|
+
const checkReactJsxA11yUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const localRules = getRulesArray('jsx-a11y/', Object.keys(react_jsx_a11y_1.default.rules));
|
|
93
|
+
const deprecatedLocalRules = getRulesArray('jsx-a11y/', Object.keys(react_jsx_a11y_1.deprecatedReactJsxA11yRules.rules));
|
|
94
|
+
const remoteRules = eslint_plugin_jsx_a11y_1.default.rules ? Object.keys(eslint_plugin_jsx_a11y_1.default.rules) : [];
|
|
95
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
96
|
+
return true;
|
|
97
|
+
throw new Error('React JSX A11y Plugin Updated');
|
|
98
|
+
});
|
|
99
|
+
const checkReactHooksUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
+
const localRules = getRulesArray('react-hooks/', Object.keys(react_hooks_1.default.rules));
|
|
101
|
+
const remoteRules = Object.keys(eslint_plugin_react_hooks_1.default.rules);
|
|
102
|
+
if (localRules.length === remoteRules.length)
|
|
103
|
+
return true;
|
|
104
|
+
throw new Error('React Hooks Plugin Updated');
|
|
105
|
+
});
|
|
106
|
+
const checkUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
yield checkImportsUpdates();
|
|
108
|
+
yield checkNodeUpdates();
|
|
109
|
+
yield checkReactUpdates();
|
|
110
|
+
yield checkReactJsxA11yUpdates();
|
|
111
|
+
yield checkReactHooksUpdates();
|
|
112
|
+
});
|
|
113
|
+
// noinspection JSIgnoredPromiseFromCall
|
|
114
|
+
checkUpdates();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -38,11 +38,15 @@
|
|
|
38
38
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
39
39
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
40
40
|
"eslint": "^9.24.0",
|
|
41
|
+
"eslint-import-resolver-typescript": "^4.3.1",
|
|
41
42
|
"eslint-plugin-import-x": "^4.10.2",
|
|
42
43
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
44
|
+
"eslint-plugin-n": "^17.17.0",
|
|
43
45
|
"eslint-plugin-react": "^7.37.5",
|
|
44
46
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
45
48
|
"tsc-alias": "^1.8.14",
|
|
49
|
+
"tsconfig-paths": "^4.2.0",
|
|
46
50
|
"typescript": "^5.8.3",
|
|
47
51
|
"typescript-eslint": "^8.29.1"
|
|
48
52
|
},
|
|
@@ -52,6 +56,7 @@
|
|
|
52
56
|
"eslint-import-resolver-typescript": "^4.3.1",
|
|
53
57
|
"eslint-plugin-import-x": "4.x",
|
|
54
58
|
"eslint-plugin-jsx-a11y": "6.x",
|
|
59
|
+
"eslint-plugin-n": "^17.17.0",
|
|
55
60
|
"eslint-plugin-react": "7.x",
|
|
56
61
|
"eslint-plugin-react-hooks": "5.x",
|
|
57
62
|
"typescript-eslint": "8.x"
|
|
@@ -66,6 +71,9 @@
|
|
|
66
71
|
"eslint-plugin-jsx-a11y": {
|
|
67
72
|
"optional": true
|
|
68
73
|
},
|
|
74
|
+
"eslint-plugin-n": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
69
77
|
"eslint-plugin-react": {
|
|
70
78
|
"optional": true
|
|
71
79
|
},
|
|
@@ -77,8 +85,10 @@
|
|
|
77
85
|
}
|
|
78
86
|
},
|
|
79
87
|
"scripts": {
|
|
88
|
+
"prebuild": "pnpm check:updates",
|
|
80
89
|
"build": "tsc -b",
|
|
81
90
|
"postbuild": "tsc-alias",
|
|
91
|
+
"check:updates": "ts-node script/checkUpdates.ts",
|
|
82
92
|
"typecheck": "tsc --noEmit"
|
|
83
93
|
}
|
|
84
94
|
}
|
package/dist/rules/node.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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 globals_1 = __importDefault(require("globals"));
|
|
7
|
-
const nodeRules = {
|
|
8
|
-
name: 'airbnb/config/node',
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: Object.assign({}, globals_1.default.nodeBuiltin),
|
|
11
|
-
},
|
|
12
|
-
rules: {
|
|
13
|
-
// enforce return after a callback
|
|
14
|
-
'callback-return': 'off',
|
|
15
|
-
// require all requires be top-level
|
|
16
|
-
// https://eslint.org/docs/rules/global-require
|
|
17
|
-
'global-require': 'error',
|
|
18
|
-
// enforces error handling in callbacks (node environment)
|
|
19
|
-
'handle-callback-err': 'off',
|
|
20
|
-
// disallow use of the Buffer() constructor
|
|
21
|
-
// https://eslint.org/docs/rules/no-buffer-constructor
|
|
22
|
-
'no-buffer-constructor': 'error',
|
|
23
|
-
// disallow mixing regular variable and require declarations
|
|
24
|
-
'no-mixed-requires': ['off', false],
|
|
25
|
-
// disallow use of new operator with the require function
|
|
26
|
-
'no-new-require': 'error',
|
|
27
|
-
// disallow string concatenation with __dirname and __filename
|
|
28
|
-
// https://eslint.org/docs/rules/no-path-concat
|
|
29
|
-
'no-path-concat': 'error',
|
|
30
|
-
// disallow use of process.env
|
|
31
|
-
'no-process-env': 'off',
|
|
32
|
-
// disallow process.exit()
|
|
33
|
-
'no-process-exit': 'off',
|
|
34
|
-
// restrict usage of specified node modules
|
|
35
|
-
'no-restricted-modules': 'off',
|
|
36
|
-
// disallow use of synchronous methods (off by default)
|
|
37
|
-
'no-sync': 'off',
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
exports.default = nodeRules;
|