eslint-config-seekingalpha-react 7.0.0 → 7.1.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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/index.js +0 -4
- package/package.json +3 -3
- package/prettier.js +1 -4
- package/rules/eslint/best-practices.js +0 -3
- package/rules/eslint/index.js +0 -2
- package/rules/eslint-plugin-jsx-a11y/index.js +11 -72
- package/rules/eslint-plugin-react/index.js +1 -6
- package/rules/eslint-plugin-react/jsx.js +7 -24
- package/rules/eslint-plugin-react/react.js +10 -43
- package/rules/eslint-plugin-react-hooks/index.js +0 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package includes the shareable ESLint config used by [SeekingAlpha](https:/
|
|
|
6
6
|
|
|
7
7
|
Install ESLint and all [Peer Dependencies](https://nodejs.org/en/blog/npm/peer-dependencies/):
|
|
8
8
|
|
|
9
|
-
npm install eslint@8.
|
|
9
|
+
npm install eslint@8.38.0 eslint-plugin-jsx-a11y@6.7.1 eslint-plugin-react@7.32.2 eslint-plugin-react-hooks@4.6.0 --save-dev
|
|
10
10
|
|
|
11
11
|
Install SeekingAlpha shareable ESLint:
|
|
12
12
|
|
package/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
2
|
extends: [
|
|
4
|
-
|
|
5
3
|
// https://github.com/yannickcr/eslint-plugin-react
|
|
6
4
|
'./rules/eslint/index.js',
|
|
7
5
|
|
|
@@ -13,7 +11,6 @@ module.exports = {
|
|
|
13
11
|
|
|
14
12
|
// https://reactjs.org/docs/hooks-rules.html
|
|
15
13
|
'./rules/eslint-plugin-react-hooks/index.js',
|
|
16
|
-
|
|
17
14
|
],
|
|
18
15
|
|
|
19
16
|
parserOptions: {
|
|
@@ -25,5 +22,4 @@ module.exports = {
|
|
|
25
22
|
jsx: true,
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
|
-
|
|
29
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-seekingalpha-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "SeekingAlpha's sharable React.js ESLint config",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"node": ">= 18"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"eslint": "8.
|
|
52
|
+
"eslint": "8.38.0",
|
|
53
53
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
54
54
|
"eslint-plugin-react": "7.32.2",
|
|
55
55
|
"eslint-plugin-react-hooks": "4.6.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"eslint": "8.
|
|
58
|
+
"eslint": "8.38.0",
|
|
59
59
|
"eslint-find-rules": "4.1.0",
|
|
60
60
|
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
61
61
|
"eslint-plugin-react": "7.32.2",
|
package/prettier.js
CHANGED
package/rules/eslint/index.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
4
|
plugins: ['jsx-a11y'],
|
|
6
5
|
|
|
7
6
|
rules: {
|
|
8
|
-
|
|
9
7
|
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
|
|
10
8
|
'jsx-a11y/alt-text': [
|
|
11
9
|
'error',
|
|
12
10
|
{
|
|
13
|
-
elements: [
|
|
14
|
-
'img',
|
|
15
|
-
'object',
|
|
16
|
-
'area',
|
|
17
|
-
"input[type='image']",
|
|
18
|
-
],
|
|
11
|
+
elements: ['img', 'object', 'area', "input[type='image']"],
|
|
19
12
|
img: [],
|
|
20
13
|
object: [],
|
|
21
14
|
area: [],
|
|
@@ -27,10 +20,7 @@ module.exports = {
|
|
|
27
20
|
'jsx-a11y/anchor-has-content': [
|
|
28
21
|
'error',
|
|
29
22
|
{
|
|
30
|
-
components: [
|
|
31
|
-
'Anchor',
|
|
32
|
-
'Link',
|
|
33
|
-
],
|
|
23
|
+
components: ['Anchor', 'Link'],
|
|
34
24
|
},
|
|
35
25
|
],
|
|
36
26
|
|
|
@@ -38,16 +28,9 @@ module.exports = {
|
|
|
38
28
|
'jsx-a11y/anchor-is-valid': [
|
|
39
29
|
'error',
|
|
40
30
|
{
|
|
41
|
-
components: [
|
|
42
|
-
'Anchor',
|
|
43
|
-
'Link',
|
|
44
|
-
],
|
|
31
|
+
components: ['Anchor', 'Link'],
|
|
45
32
|
specialLink: ['to'],
|
|
46
|
-
aspects: [
|
|
47
|
-
'noHref',
|
|
48
|
-
'invalidHref',
|
|
49
|
-
'preferButton',
|
|
50
|
-
],
|
|
33
|
+
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
51
34
|
},
|
|
52
35
|
],
|
|
53
36
|
|
|
@@ -167,10 +150,7 @@ module.exports = {
|
|
|
167
150
|
'jsx-a11y/no-distracting-elements': [
|
|
168
151
|
'error',
|
|
169
152
|
{
|
|
170
|
-
elements: [
|
|
171
|
-
'marquee',
|
|
172
|
-
'blink',
|
|
173
|
-
],
|
|
153
|
+
elements: ['marquee', 'blink'],
|
|
174
154
|
},
|
|
175
155
|
],
|
|
176
156
|
|
|
@@ -178,10 +158,7 @@ module.exports = {
|
|
|
178
158
|
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
179
159
|
'error',
|
|
180
160
|
{
|
|
181
|
-
tr: [
|
|
182
|
-
'none',
|
|
183
|
-
'presentation',
|
|
184
|
-
],
|
|
161
|
+
tr: ['none', 'presentation'],
|
|
185
162
|
},
|
|
186
163
|
],
|
|
187
164
|
|
|
@@ -189,14 +166,7 @@ module.exports = {
|
|
|
189
166
|
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
190
167
|
'error',
|
|
191
168
|
{
|
|
192
|
-
handlers: [
|
|
193
|
-
'onClick',
|
|
194
|
-
'onMouseDown',
|
|
195
|
-
'onMouseUp',
|
|
196
|
-
'onKeyPress',
|
|
197
|
-
'onKeyDown',
|
|
198
|
-
'onKeyUp',
|
|
199
|
-
],
|
|
169
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
200
170
|
},
|
|
201
171
|
],
|
|
202
172
|
|
|
@@ -204,31 +174,9 @@ module.exports = {
|
|
|
204
174
|
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
205
175
|
'error',
|
|
206
176
|
{
|
|
207
|
-
ul: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
'menubar',
|
|
211
|
-
'radiogroup',
|
|
212
|
-
'tablist',
|
|
213
|
-
'tree',
|
|
214
|
-
'treegrid',
|
|
215
|
-
],
|
|
216
|
-
ol: [
|
|
217
|
-
'listbox',
|
|
218
|
-
'menu',
|
|
219
|
-
'menubar',
|
|
220
|
-
'radiogroup',
|
|
221
|
-
'tablist',
|
|
222
|
-
'tree',
|
|
223
|
-
'treegrid',
|
|
224
|
-
],
|
|
225
|
-
li: [
|
|
226
|
-
'menuitem',
|
|
227
|
-
'option',
|
|
228
|
-
'row',
|
|
229
|
-
'tab',
|
|
230
|
-
'treeitem',
|
|
231
|
-
],
|
|
177
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
178
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
179
|
+
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
232
180
|
table: ['grid'],
|
|
233
181
|
td: ['gridcell'],
|
|
234
182
|
},
|
|
@@ -258,14 +206,7 @@ module.exports = {
|
|
|
258
206
|
'jsx-a11y/no-static-element-interactions': [
|
|
259
207
|
'error',
|
|
260
208
|
{
|
|
261
|
-
handlers: [
|
|
262
|
-
'onClick',
|
|
263
|
-
'onMouseDown',
|
|
264
|
-
'onMouseUp',
|
|
265
|
-
'onKeyPress',
|
|
266
|
-
'onKeyDown',
|
|
267
|
-
'onKeyUp',
|
|
268
|
-
],
|
|
209
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
269
210
|
},
|
|
270
211
|
],
|
|
271
212
|
|
|
@@ -296,7 +237,5 @@ module.exports = {
|
|
|
296
237
|
'jsx-a11y/control-has-associated-label': 'error',
|
|
297
238
|
|
|
298
239
|
'jsx-a11y/prefer-tag-over-role': 'error',
|
|
299
|
-
|
|
300
240
|
},
|
|
301
|
-
|
|
302
241
|
};
|
|
@@ -3,9 +3,7 @@ const config = require('../config');
|
|
|
3
3
|
// https://github.com/yannickcr/eslint-plugin-react#jsx-specific-rules
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
|
|
7
6
|
rules: {
|
|
8
|
-
|
|
9
7
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
10
8
|
'react/jsx-boolean-value': [
|
|
11
9
|
'error',
|
|
@@ -43,10 +41,7 @@ module.exports = {
|
|
|
43
41
|
],
|
|
44
42
|
|
|
45
43
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
46
|
-
'react/jsx-equals-spacing': [
|
|
47
|
-
'error',
|
|
48
|
-
'never',
|
|
49
|
-
],
|
|
44
|
+
'react/jsx-equals-spacing': ['error', 'never'],
|
|
50
45
|
|
|
51
46
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
52
47
|
'react/jsx-filename-extension': [
|
|
@@ -57,30 +52,19 @@ module.exports = {
|
|
|
57
52
|
],
|
|
58
53
|
|
|
59
54
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
60
|
-
'react/jsx-first-prop-new-line': [
|
|
61
|
-
'error',
|
|
62
|
-
'multiline-multiprop',
|
|
63
|
-
],
|
|
55
|
+
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
|
64
56
|
|
|
65
57
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
66
|
-
'react/jsx-fragments': [
|
|
67
|
-
'error', 'syntax',
|
|
68
|
-
],
|
|
58
|
+
'react/jsx-fragments': ['error', 'syntax'],
|
|
69
59
|
|
|
70
60
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
71
61
|
'react/jsx-handler-names': ['off'],
|
|
72
62
|
|
|
73
63
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
74
|
-
'react/jsx-indent': [
|
|
75
|
-
'error',
|
|
76
|
-
config.jsxIndent,
|
|
77
|
-
],
|
|
64
|
+
'react/jsx-indent': ['error', config.jsxIndent],
|
|
78
65
|
|
|
79
66
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
80
|
-
'react/jsx-indent-props': [
|
|
81
|
-
'error',
|
|
82
|
-
config.jsxIndentProps,
|
|
83
|
-
],
|
|
67
|
+
'react/jsx-indent-props': ['error', config.jsxIndentProps],
|
|
84
68
|
|
|
85
69
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
86
70
|
'react/jsx-key': [
|
|
@@ -114,7 +98,8 @@ module.exports = {
|
|
|
114
98
|
|
|
115
99
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
116
100
|
'react/jsx-no-bind': [
|
|
117
|
-
'error',
|
|
101
|
+
'error',
|
|
102
|
+
{
|
|
118
103
|
ignoreDOMComponents: true,
|
|
119
104
|
ignoreRefs: false,
|
|
120
105
|
allowArrowFunctions: false,
|
|
@@ -268,7 +253,5 @@ module.exports = {
|
|
|
268
253
|
'react/jsx-no-script-url': 'error',
|
|
269
254
|
|
|
270
255
|
'react/no-object-type-as-default-prop': 'error',
|
|
271
|
-
|
|
272
256
|
},
|
|
273
|
-
|
|
274
257
|
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
4
|
rules: {
|
|
6
|
-
|
|
7
5
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
8
6
|
'react/boolean-prop-naming': [
|
|
9
7
|
'error',
|
|
10
8
|
{
|
|
11
|
-
propTypeNames: [
|
|
12
|
-
'bool',
|
|
13
|
-
'mutuallyExclusiveTrueProps',
|
|
14
|
-
],
|
|
9
|
+
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
|
|
15
10
|
rule: '^(is|has|should)[A-Z]([A-Za-z0-9]?)+',
|
|
16
11
|
message: 'It is better if your prop ({{ propName }}) matches this pattern: ({{ pattern }})',
|
|
17
12
|
},
|
|
@@ -34,10 +29,7 @@ module.exports = {
|
|
|
34
29
|
'react/default-props-match-prop-types': 'off',
|
|
35
30
|
|
|
36
31
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
37
|
-
'react/destructuring-assignment': [
|
|
38
|
-
'error',
|
|
39
|
-
'always',
|
|
40
|
-
],
|
|
32
|
+
'react/destructuring-assignment': ['error', 'always'],
|
|
41
33
|
|
|
42
34
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
43
35
|
'react/display-name': [
|
|
@@ -58,11 +50,7 @@ module.exports = {
|
|
|
58
50
|
'style',
|
|
59
51
|
{
|
|
60
52
|
propName: 'className',
|
|
61
|
-
allowedFor: [
|
|
62
|
-
'Button',
|
|
63
|
-
'Icon',
|
|
64
|
-
'Link',
|
|
65
|
-
],
|
|
53
|
+
allowedFor: ['Button', 'Icon', 'Link'],
|
|
66
54
|
},
|
|
67
55
|
],
|
|
68
56
|
},
|
|
@@ -270,10 +258,7 @@ module.exports = {
|
|
|
270
258
|
'react/no-will-update-set-state': 'error',
|
|
271
259
|
|
|
272
260
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
273
|
-
'react/prefer-es6-class': [
|
|
274
|
-
'error',
|
|
275
|
-
'always',
|
|
276
|
-
],
|
|
261
|
+
'react/prefer-es6-class': ['error', 'always'],
|
|
277
262
|
|
|
278
263
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
|
|
279
264
|
'react/prefer-exact-props': 'off',
|
|
@@ -317,17 +302,9 @@ module.exports = {
|
|
|
317
302
|
|
|
318
303
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
|
|
319
304
|
'react/sort-comp': [
|
|
320
|
-
'error',
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
'lifecycle',
|
|
324
|
-
'/^on.+$/',
|
|
325
|
-
'getters',
|
|
326
|
-
'setters',
|
|
327
|
-
'instance-methods',
|
|
328
|
-
'everything-else',
|
|
329
|
-
'rendering',
|
|
330
|
-
],
|
|
305
|
+
'error',
|
|
306
|
+
{
|
|
307
|
+
order: ['static-methods', 'lifecycle', '/^on.+$/', 'getters', 'setters', 'instance-methods', 'everything-else', 'rendering'],
|
|
331
308
|
groups: {
|
|
332
309
|
lifecycle: [
|
|
333
310
|
'displayName',
|
|
@@ -357,10 +334,7 @@ module.exports = {
|
|
|
357
334
|
'componentDidCatch',
|
|
358
335
|
'componentWillUnmount',
|
|
359
336
|
],
|
|
360
|
-
rendering: [
|
|
361
|
-
'/^render.+$/',
|
|
362
|
-
'render',
|
|
363
|
-
],
|
|
337
|
+
rendering: ['/^render.+$/', 'render'],
|
|
364
338
|
},
|
|
365
339
|
},
|
|
366
340
|
],
|
|
@@ -378,16 +352,9 @@ module.exports = {
|
|
|
378
352
|
'react/void-dom-elements-no-children': 'error',
|
|
379
353
|
|
|
380
354
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
381
|
-
'react/state-in-constructor': [
|
|
382
|
-
'error',
|
|
383
|
-
'always',
|
|
384
|
-
],
|
|
355
|
+
'react/state-in-constructor': ['error', 'always'],
|
|
385
356
|
|
|
386
357
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
387
|
-
'react/static-property-placement': [
|
|
388
|
-
'error',
|
|
389
|
-
'static public field',
|
|
390
|
-
],
|
|
358
|
+
'react/static-property-placement': ['error', 'static public field'],
|
|
391
359
|
},
|
|
392
|
-
|
|
393
360
|
};
|