@prowise/eslint-config-linting-rules 1.2.13 → 2.0.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/README.md +13 -3
- package/backend.js +4 -16
- package/base.js +30 -0
- package/eslint.config.js +4 -0
- package/front-react.js +19 -0
- package/front-solid.js +19 -0
- package/package.json +1 -1
- package/rules/{base-rules.js → baseSettings.js} +43 -551
- package/rules/plugin-import-rules.js +16 -4
- package/rules/plugin-jest-rules.js +59 -0
- package/rules/plugin-jsdoc-rules.js +6 -2
- package/rules/plugin-jsx-a11y-rules.js +49 -43
- package/rules/plugin-node-rules.js +41 -24
- package/rules/plugin-prefer-arrow-rules.js +17 -0
- package/rules/plugin-react-hooks-rules.js +5 -10
- package/rules/plugin-react-rules.js +24 -42
- package/rules/plugin-solid-rules.js +8 -2
- package/rules/plugin-stylistic-rules.js +538 -0
- package/rules/plugin-typescript-rules.js +56 -231
- package/rules/plugin-vitest-rules.js +77 -0
- package/rules/test-rules.js +1 -102
- package/typescript.js +6 -22
- package/eslint-plugin-esm-extensions/index.js +0 -155
- package/eslint-plugin-esm-extensions/package.json +0 -21
- package/frontend-vite.js +0 -38
- package/frontend.js +0 -39
- package/index.js +0 -35
- package/solid.js +0 -35
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import importPlugin from "eslint-plugin-import-x";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
/*
|
|
5
|
+
* ✅ recommended
|
|
6
|
+
* 🔒 strict
|
|
7
|
+
* 🔧 fixable
|
|
8
|
+
* 💡 has suggestion
|
|
9
|
+
* 💭 requires type information
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
plugins: { import: importPlugin },
|
|
13
|
+
|
|
2
14
|
rules: {
|
|
3
15
|
/**
|
|
4
16
|
* Ensure default import coupled with default export
|
|
@@ -30,7 +42,7 @@ module.exports = {
|
|
|
30
42
|
*
|
|
31
43
|
* Only warn, do not error on this, certain bundlers might accept it.
|
|
32
44
|
*/
|
|
33
|
-
"import/extensions": ["
|
|
45
|
+
"import/extensions": ["off", "always", { ignorePackages: true }],
|
|
34
46
|
|
|
35
47
|
/**
|
|
36
48
|
* Disallow non-import statements appearing before import statements
|
|
@@ -192,13 +204,13 @@ module.exports = {
|
|
|
192
204
|
* Do not allow a default import name to match a named export
|
|
193
205
|
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default.md.
|
|
194
206
|
*/
|
|
195
|
-
"import/no-named-as-default": "error",
|
|
207
|
+
// "import/no-named-as-default": "error",
|
|
196
208
|
|
|
197
209
|
/**
|
|
198
210
|
* Warn on accessing default export property names that are also named exports
|
|
199
211
|
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md.
|
|
200
212
|
*/
|
|
201
|
-
"import/no-named-as-default-member": "error",
|
|
213
|
+
// "import/no-named-as-default-member": "error",
|
|
202
214
|
|
|
203
215
|
/**
|
|
204
216
|
* Prevent importing the default as if it were named
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import jestPlugin from "eslint-plugin-jest";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import { commonRules } from "./test-rules.js";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
plugins: { jest: jestPlugin },
|
|
7
|
+
|
|
8
|
+
languageOptions: {
|
|
9
|
+
globals: {
|
|
10
|
+
...globals.jest,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
...commonRules("jest"),
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Disallow confusing usages of jest.setTimeout
|
|
19
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-confusing-set-timeout.md
|
|
20
|
+
*/
|
|
21
|
+
"jest/no-confusing-set-timeout": "off",
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Disallow use of deprecated functions ✅ 🔧
|
|
25
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-deprecated-functions.md
|
|
26
|
+
*/
|
|
27
|
+
"jest/no-deprecated-functions": "error",
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Disallow using exports in files containing tests ✅
|
|
31
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-export.md
|
|
32
|
+
*/
|
|
33
|
+
"jest/no-export": "error",
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Disallow Jasmine globals ✅ 🔧
|
|
37
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md
|
|
38
|
+
*/
|
|
39
|
+
"jest/no-jasmine-globals": "error",
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Disallow specific jest. methods
|
|
43
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-jest-methods.md
|
|
44
|
+
*/
|
|
45
|
+
"jest/no-restricted-jest-methods": "off",
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Disallow using jest.mock() factories without an explicit type parameter
|
|
49
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-untyped-mock-factory.md
|
|
50
|
+
*/
|
|
51
|
+
"jest/no-untyped-mock-factory": "off",
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Require promises that have expectations in their chain to be valid ✅
|
|
55
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect-in-promise.md
|
|
56
|
+
*/
|
|
57
|
+
"jest/valid-expect-in-promise": "error",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import jsdocPlugin from "eslint-plugin-jsdoc";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
2
4
|
/*
|
|
3
5
|
* ✅ recommended
|
|
6
|
+
* 🔒 strict
|
|
4
7
|
* 🔧 fixable
|
|
5
8
|
* 💡 has suggestion
|
|
9
|
+
* 💭 requires type information
|
|
6
10
|
*/
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
plugins: { jsdoc: jsdocPlugin },
|
|
9
13
|
|
|
10
14
|
rules: {
|
|
11
15
|
/**
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
/*
|
|
5
|
+
* ✅ recommended
|
|
6
|
+
* 🔒 strict
|
|
7
|
+
* 🔧 fixable
|
|
8
|
+
* 💡 has suggestion
|
|
9
|
+
* 💭 requires type information
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
plugins: {
|
|
13
|
+
"jsx-a11y": jsxA11yPlugin,
|
|
14
|
+
},
|
|
3
15
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
jsx: true,
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parserOptions: {
|
|
18
|
+
ecmaFeatures: { jsx: true },
|
|
7
19
|
},
|
|
8
20
|
},
|
|
9
21
|
|
|
10
22
|
rules: {
|
|
11
23
|
/**
|
|
12
|
-
* Enforce that all elements that require alternative text have meaningful information
|
|
24
|
+
* Enforce that all elements that require alternative text have meaningful information. ✅ 🔒
|
|
13
25
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md.
|
|
14
26
|
*/
|
|
15
27
|
"jsx-a11y/alt-text": [
|
|
@@ -27,16 +39,16 @@ module.exports = {
|
|
|
27
39
|
* Enforce <a> text to not exactly match "click here", "here", "link", or "a link".
|
|
28
40
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-ambiguous-text.md.
|
|
29
41
|
*/
|
|
30
|
-
"jsx-a11y/anchor-ambiguous-text": "
|
|
42
|
+
"jsx-a11y/anchor-ambiguous-text": "off",
|
|
31
43
|
|
|
32
44
|
/**
|
|
33
|
-
* Enforce that anchors have content
|
|
45
|
+
* Enforce that anchors have content. ✅ 🔒
|
|
34
46
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md.
|
|
35
47
|
*/
|
|
36
48
|
"jsx-a11y/anchor-has-content": ["error", { components: [] }],
|
|
37
49
|
|
|
38
50
|
/**
|
|
39
|
-
* Ensure <a> tags are valid
|
|
51
|
+
* Ensure <a> tags are valid. ✅ 🔒
|
|
40
52
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md.
|
|
41
53
|
*/
|
|
42
54
|
"jsx-a11y/anchor-is-valid": [
|
|
@@ -49,44 +61,44 @@ module.exports = {
|
|
|
49
61
|
],
|
|
50
62
|
|
|
51
63
|
/**
|
|
52
|
-
* Elements with aria-activedescendant must be tabbable
|
|
64
|
+
* Elements with aria-activedescendant must be tabbable. ✅ 🔒
|
|
53
65
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md.
|
|
54
66
|
*/
|
|
55
67
|
"jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
|
56
68
|
|
|
57
69
|
/**
|
|
58
|
-
* Enforce all aria-* props are valid.
|
|
70
|
+
* Enforce all aria-* props are valid. ✅ 🔒
|
|
59
71
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md.
|
|
60
72
|
*/
|
|
61
73
|
"jsx-a11y/aria-props": "error",
|
|
62
74
|
|
|
63
75
|
/**
|
|
64
|
-
* Enforce ARIA state and property values are valid.
|
|
76
|
+
* Enforce ARIA state and property values are valid. ✅ 🔒
|
|
65
77
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md.
|
|
66
78
|
*/
|
|
67
79
|
"jsx-a11y/aria-proptypes": "error",
|
|
68
80
|
|
|
69
81
|
/**
|
|
70
|
-
* Require ARIA roles to be valid and non-abstract
|
|
82
|
+
* Require ARIA roles to be valid and non-abstract. ✅ 🔒
|
|
71
83
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md.
|
|
72
84
|
*/
|
|
73
85
|
"jsx-a11y/aria-role": ["error", { ignoreNonDOM: false }],
|
|
74
86
|
|
|
75
87
|
/**
|
|
76
88
|
* Enforce that elements that do not support ARIA roles, states, and
|
|
77
|
-
* properties do not have those attributes.
|
|
89
|
+
* properties do not have those attributes. ✅ 🔒
|
|
78
90
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md.
|
|
79
91
|
*/
|
|
80
92
|
"jsx-a11y/aria-unsupported-elements": "error",
|
|
81
93
|
|
|
82
94
|
/**
|
|
83
|
-
* Ensure the autocomplete attribute is correct and suitable for the form field it is used with
|
|
95
|
+
* Ensure the autocomplete attribute is correct and suitable for the form field it is used with. ✅ 🔒
|
|
84
96
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md.
|
|
85
97
|
*/
|
|
86
98
|
"jsx-a11y/autocomplete-valid": ["off", { inputComponents: [] }],
|
|
87
99
|
|
|
88
100
|
/**
|
|
89
|
-
* Require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
101
|
+
* Require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress. ✅ 🔒
|
|
90
102
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md.
|
|
91
103
|
*/
|
|
92
104
|
"jsx-a11y/click-events-have-key-events": "error",
|
|
@@ -118,37 +130,37 @@ module.exports = {
|
|
|
118
130
|
],
|
|
119
131
|
|
|
120
132
|
/**
|
|
121
|
-
* Ensure <hX> tags have content and are not aria-hidden
|
|
133
|
+
* Ensure <hX> tags have content and are not aria-hidden. ✅ 🔒
|
|
122
134
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md.
|
|
123
135
|
*/
|
|
124
136
|
"jsx-a11y/heading-has-content": ["error", { components: [""] }],
|
|
125
137
|
|
|
126
138
|
/**
|
|
127
|
-
* Require HTML elements to have a "lang" prop
|
|
139
|
+
* Require HTML elements to have a "lang" prop. ✅ 🔒
|
|
128
140
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md.
|
|
129
141
|
*/
|
|
130
142
|
"jsx-a11y/html-has-lang": "error",
|
|
131
143
|
|
|
132
144
|
/**
|
|
133
|
-
* Ensure iframe elements have a unique title
|
|
145
|
+
* Ensure iframe elements have a unique title. ✅ 🔒
|
|
134
146
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md.
|
|
135
147
|
*/
|
|
136
148
|
"jsx-a11y/iframe-has-title": "error",
|
|
137
149
|
|
|
138
150
|
/**
|
|
139
|
-
* Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
151
|
+
* Prevent img alt text from containing redundant words like "image", "picture", or "photo". ✅ 🔒
|
|
140
152
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md.
|
|
141
153
|
*/
|
|
142
154
|
"jsx-a11y/img-redundant-alt": "error",
|
|
143
155
|
|
|
144
156
|
/**
|
|
145
|
-
* Elements with an interactive role and interaction handlers must be focusable
|
|
157
|
+
* Elements with an interactive role and interaction handlers must be focusable. ✅ 🔒
|
|
146
158
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md.
|
|
147
159
|
*/
|
|
148
160
|
"jsx-a11y/interactive-supports-focus": "error",
|
|
149
161
|
|
|
150
162
|
/**
|
|
151
|
-
* Enforce that a label tag has a text label and an associated control.
|
|
163
|
+
* Enforce that a label tag has a text label and an associated control. ✅ 🔒
|
|
152
164
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md.
|
|
153
165
|
*/
|
|
154
166
|
"jsx-a11y/label-has-associated-control": [
|
|
@@ -169,7 +181,7 @@ module.exports = {
|
|
|
169
181
|
"jsx-a11y/lang": "error",
|
|
170
182
|
|
|
171
183
|
/**
|
|
172
|
-
* Media elements must have captions
|
|
184
|
+
* Media elements must have captions. ✅ 🔒
|
|
173
185
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md.
|
|
174
186
|
*/
|
|
175
187
|
"jsx-a11y/media-has-caption": [
|
|
@@ -182,37 +194,37 @@ module.exports = {
|
|
|
182
194
|
],
|
|
183
195
|
|
|
184
196
|
/**
|
|
185
|
-
* Require that mouseover/out come with focus/blur, for keyboard-only users
|
|
197
|
+
* Require that mouseover/out come with focus/blur, for keyboard-only users. ✅ 🔒
|
|
186
198
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md.
|
|
187
199
|
*/
|
|
188
200
|
"jsx-a11y/mouse-events-have-key-events": "error",
|
|
189
201
|
|
|
190
202
|
/**
|
|
191
|
-
* Prevent use of `accessKey
|
|
203
|
+
* Prevent use of `accessKey`. ✅ 🔒
|
|
192
204
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md.
|
|
193
205
|
*/
|
|
194
206
|
"jsx-a11y/no-access-key": "error",
|
|
195
207
|
|
|
196
208
|
/**
|
|
197
|
-
* Prohibit autoFocus prop
|
|
209
|
+
* Prohibit autoFocus prop. ✅ 🔒
|
|
198
210
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md.
|
|
199
211
|
*/
|
|
200
212
|
"jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
|
|
201
213
|
|
|
202
214
|
/**
|
|
203
|
-
* Prevent distracting elements, like <marquee> and <blink
|
|
215
|
+
* Prevent distracting elements, like <marquee> and <blink>. ✅ 🔒
|
|
204
216
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md.
|
|
205
217
|
*/
|
|
206
218
|
"jsx-a11y/no-distracting-elements": ["error", { elements: ["marquee", "blink"] }],
|
|
207
219
|
|
|
208
220
|
/**
|
|
209
|
-
* WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
221
|
+
* WAI-ARIA roles should not be used to convert an interactive element to non-interactive. ✅ 🔒
|
|
210
222
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md.
|
|
211
223
|
*/
|
|
212
224
|
"jsx-a11y/no-interactive-element-to-noninteractive-role": ["error", { tr: ["none", "presentation"] }],
|
|
213
225
|
|
|
214
226
|
/**
|
|
215
|
-
* A non-interactive element does not support event handlers (mouse and key handlers)
|
|
227
|
+
* A non-interactive element does not support event handlers (mouse and key handlers). ✅ 🔒
|
|
216
228
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md.
|
|
217
229
|
*/
|
|
218
230
|
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
@@ -223,7 +235,7 @@ module.exports = {
|
|
|
223
235
|
],
|
|
224
236
|
|
|
225
237
|
/**
|
|
226
|
-
* WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
238
|
+
* WAI-ARIA roles should not be used to convert a non-interactive element to interactive. ✅ 🔒
|
|
227
239
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md.
|
|
228
240
|
*/
|
|
229
241
|
"jsx-a11y/no-noninteractive-element-to-interactive-role": [
|
|
@@ -238,25 +250,19 @@ module.exports = {
|
|
|
238
250
|
],
|
|
239
251
|
|
|
240
252
|
/**
|
|
241
|
-
* Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
253
|
+
* Tab key navigation should be limited to elements on the page that can be interacted with. ✅ 🔒
|
|
242
254
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md.
|
|
243
255
|
*/
|
|
244
256
|
"jsx-a11y/no-noninteractive-tabindex": ["error", { tags: [], roles: ["tabpanel"] }],
|
|
245
257
|
|
|
246
258
|
/**
|
|
247
|
-
*
|
|
248
|
-
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md.
|
|
249
|
-
*/
|
|
250
|
-
"jsx-a11y/no-onchange": "off",
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Ensure HTML elements do not specify redundant ARIA roles
|
|
259
|
+
* Ensure HTML elements do not specify redundant ARIA roles. ✅ 🔒
|
|
254
260
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md.
|
|
255
261
|
*/
|
|
256
262
|
"jsx-a11y/no-redundant-roles": "error",
|
|
257
263
|
|
|
258
264
|
/**
|
|
259
|
-
* Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
265
|
+
* Enforce that DOM elements without semantic behavior not have interaction handlers. ✅ 🔒
|
|
260
266
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md.
|
|
261
267
|
*/
|
|
262
268
|
"jsx-a11y/no-static-element-interactions": [
|
|
@@ -267,26 +273,26 @@ module.exports = {
|
|
|
267
273
|
],
|
|
268
274
|
|
|
269
275
|
/**
|
|
270
|
-
* Enforce that elements with ARIA roles must have all required attributes for that role.
|
|
276
|
+
* Enforce that elements with ARIA roles must have all required attributes for that role. ✅ 🔒
|
|
271
277
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md.
|
|
272
278
|
*/
|
|
273
279
|
"jsx-a11y/role-has-required-aria-props": "error",
|
|
274
280
|
|
|
275
281
|
/**
|
|
276
|
-
* Enforce that elements with explicit or implicit roles defined contain
|
|
282
|
+
* Enforce that elements with explicit or implicit roles defined contain. ✅ 🔒
|
|
277
283
|
* only aria-* properties supported by that role.
|
|
278
284
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md.
|
|
279
285
|
*/
|
|
280
286
|
"jsx-a11y/role-supports-aria-props": "error",
|
|
281
287
|
|
|
282
288
|
/**
|
|
283
|
-
* Only allow <th> to have the "scope" attr
|
|
289
|
+
* Only allow <th> to have the "scope" attr. ✅ 🔒
|
|
284
290
|
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md.
|
|
285
291
|
*/
|
|
286
292
|
"jsx-a11y/scope": "error",
|
|
287
293
|
|
|
288
294
|
/**
|
|
289
|
-
* Enforce tabIndex value is not greater than zero.
|
|
295
|
+
* Enforce tabIndex value is not greater than zero. ✅ 🔒
|
|
290
296
|
* Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md.
|
|
291
297
|
*/
|
|
292
298
|
"jsx-a11y/tabindex-no-positive": "error",
|
|
@@ -1,72 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import nodePlugin from "eslint-plugin-n";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
/*
|
|
5
|
+
* ✅ recommended
|
|
6
|
+
* 🔒 strict
|
|
7
|
+
* 🔧 fixable
|
|
8
|
+
* 💡 has suggestion
|
|
9
|
+
* 💭 requires type information
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
plugins: {
|
|
13
|
+
node: nodePlugin,
|
|
4
14
|
},
|
|
5
15
|
|
|
6
16
|
rules: {
|
|
7
17
|
/**
|
|
8
|
-
* Enforce return after a callback
|
|
9
|
-
* https://github.com/
|
|
18
|
+
* Enforce return after a callback.
|
|
19
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md.
|
|
10
20
|
*/
|
|
11
21
|
"node/callback-return": "off",
|
|
12
22
|
|
|
13
23
|
/**
|
|
14
|
-
*
|
|
15
|
-
* https://github.com/
|
|
24
|
+
* Enforce either module.exports or exports.
|
|
25
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/exports-style.md.
|
|
26
|
+
*/
|
|
27
|
+
"node/exports-style": "off",
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Enforce file extensions in import declarations (ignores packages by default).
|
|
31
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/file-extension-in-import.md.
|
|
32
|
+
*/
|
|
33
|
+
"node/file-extension-in-import": ["error", "always"],
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Require all requires be top-level.
|
|
37
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md.
|
|
16
38
|
*/
|
|
17
39
|
"node/global-require": "error",
|
|
18
40
|
|
|
19
41
|
/**
|
|
20
42
|
* Enforces error handling in callbacks (node environment)
|
|
21
|
-
* https://github.com/
|
|
43
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err.md.
|
|
22
44
|
*/
|
|
23
45
|
"node/handle-callback-err": "off",
|
|
24
46
|
|
|
25
47
|
/**
|
|
26
|
-
*
|
|
27
|
-
* https://
|
|
48
|
+
* Require correct usage of hashbang.
|
|
49
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/hashbang.md.
|
|
28
50
|
*/
|
|
29
|
-
"
|
|
51
|
+
"node/hashbang": "error",
|
|
30
52
|
|
|
31
53
|
/**
|
|
32
54
|
* Disallow mixing regular variable and require declarations
|
|
33
|
-
* https://github.com/
|
|
55
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md.
|
|
34
56
|
*/
|
|
35
57
|
"node/no-mixed-requires": ["off", false],
|
|
36
58
|
|
|
37
59
|
/**
|
|
38
60
|
* Disallow use of new operator with the require function
|
|
39
|
-
* https://github.com/
|
|
61
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md.
|
|
40
62
|
*/
|
|
41
63
|
"node/no-new-require": "error",
|
|
42
64
|
|
|
43
65
|
/**
|
|
44
66
|
* Disallow string concatenation with __dirname and __filename
|
|
45
|
-
* https://github.com/
|
|
67
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md.
|
|
46
68
|
*/
|
|
47
69
|
"node/no-path-concat": "error",
|
|
48
70
|
|
|
49
71
|
/**
|
|
50
72
|
* Disallow use of process.env
|
|
51
|
-
* https://github.com/
|
|
73
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md.
|
|
52
74
|
*/
|
|
53
75
|
"/node/no-process-env": "off",
|
|
54
76
|
|
|
55
77
|
/**
|
|
56
78
|
* Disallow process.exit()
|
|
57
|
-
* https://github.com/
|
|
79
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md.
|
|
58
80
|
*/
|
|
59
81
|
"node/no-process-exit": "off",
|
|
60
82
|
|
|
61
83
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* Therefore all backend Node.js projects should always include .js as an extension.
|
|
65
|
-
*
|
|
66
|
-
* This does not effect projects that use CJS exports, but it doesn't hurt either.
|
|
84
|
+
* Disallow use of the Buffer() constructor
|
|
85
|
+
* https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/buffer.md.
|
|
67
86
|
*/
|
|
68
|
-
|
|
69
|
-
"import/extensions": "off",
|
|
70
|
-
"esm-extensions/force-extensions": "error",
|
|
87
|
+
"node/prefer-global/buffer": "error",
|
|
71
88
|
},
|
|
72
89
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import preferArrowPlugin from "eslint-plugin-prefer-arrow";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
plugins: { "prefer-arrow": preferArrowPlugin },
|
|
5
|
+
|
|
6
|
+
rules: {
|
|
7
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
8
|
+
"warn",
|
|
9
|
+
{
|
|
10
|
+
disallowPrototype: true,
|
|
11
|
+
singleReturnOnly: false,
|
|
12
|
+
classPropertiesAllowed: false,
|
|
13
|
+
allowStandaloneDeclarations: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
plugins:
|
|
3
|
-
|
|
4
|
-
parserOptions: {
|
|
5
|
-
ecmaFeatures: {
|
|
6
|
-
jsx: true,
|
|
7
|
-
},
|
|
8
|
-
},
|
|
1
|
+
export default {
|
|
2
|
+
plugins: {},
|
|
9
3
|
|
|
10
4
|
rules: {
|
|
5
|
+
// TODO: enable when compatible with eslint version 9
|
|
11
6
|
/**
|
|
12
7
|
* Enforce Rules of Hooks
|
|
13
8
|
* https://reactjs.org/docs/hooks-rules.html.
|
|
14
9
|
*/
|
|
15
|
-
"react-hooks/rules-of-hooks": "error",
|
|
10
|
+
// "react-hooks/rules-of-hooks": "error",
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
13
|
* Verify the list of the dependencies for Hooks like useEffect and similar
|
|
19
14
|
* https://reactjs.org/docs/hooks-rules.html.
|
|
20
15
|
*/
|
|
21
|
-
"react-hooks/exhaustive-deps": "error",
|
|
16
|
+
// "react-hooks/exhaustive-deps": "error",
|
|
22
17
|
},
|
|
23
18
|
};
|
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
const { rules: baseRules } = require("./base-rules");
|
|
1
|
+
import reactPlugin from "eslint-plugin-react";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
3
|
+
export default {
|
|
7
4
|
/*
|
|
8
5
|
* ✅ recommended
|
|
9
6
|
* 🔧 fixable
|
|
10
7
|
* 💡 has suggestion
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
|
-
plugins:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// override baseRules
|
|
17
|
-
"no-underscore-dangle": [
|
|
18
|
-
dangleRules[0],
|
|
19
|
-
assign({}, dangleRules[1], {
|
|
20
|
-
allow: dangleRules[1].allow.concat(["__REDUX_DEVTOOLS_EXTENSION_COMPOSE__"]),
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
|
|
24
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
25
|
-
|
|
26
|
-
// turned off just like in the base rules
|
|
27
|
-
"class-methods-use-this": [
|
|
28
|
-
"off",
|
|
29
|
-
{
|
|
30
|
-
exceptMethods: [
|
|
31
|
-
"render",
|
|
32
|
-
"getInitialState",
|
|
33
|
-
"getDefaultProps",
|
|
34
|
-
"getChildContext",
|
|
35
|
-
"componentWillMount",
|
|
36
|
-
"UNSAFE_componentWillMount",
|
|
37
|
-
"componentDidMount",
|
|
38
|
-
"componentWillReceiveProps",
|
|
39
|
-
"UNSAFE_componentWillReceiveProps",
|
|
40
|
-
"shouldComponentUpdate",
|
|
41
|
-
"componentWillUpdate",
|
|
42
|
-
"UNSAFE_componentWillUpdate",
|
|
43
|
-
"componentDidUpdate",
|
|
44
|
-
"componentWillUnmount",
|
|
45
|
-
"componentDidCatch",
|
|
46
|
-
"getSnapshotBeforeUpdate",
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
10
|
+
plugins: {
|
|
11
|
+
react: reactPlugin,
|
|
12
|
+
},
|
|
50
13
|
|
|
14
|
+
rules: {
|
|
51
15
|
/**
|
|
52
16
|
* Enforces consistent naming for boolean props
|
|
53
17
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md.
|
|
@@ -67,6 +31,12 @@ module.exports = {
|
|
|
67
31
|
*/
|
|
68
32
|
"react/button-has-type": ["error", { button: true, submit: true, reset: false }],
|
|
69
33
|
|
|
34
|
+
/**
|
|
35
|
+
* nforce using onChange or readonly attribute when checked is used.
|
|
36
|
+
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md.
|
|
37
|
+
*/
|
|
38
|
+
"react/checked-requires-onchange-or-readonly": "off",
|
|
39
|
+
|
|
70
40
|
/**
|
|
71
41
|
* Enforce all defaultProps have a corresponding non-required PropType
|
|
72
42
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md.
|
|
@@ -124,6 +94,12 @@ module.exports = {
|
|
|
124
94
|
},
|
|
125
95
|
],
|
|
126
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Require all forwardRef components include a ref parameter
|
|
99
|
+
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react/forward-ref-uses-ref.md.
|
|
100
|
+
*/
|
|
101
|
+
"react/forward-ref-uses-ref": "off",
|
|
102
|
+
|
|
127
103
|
/**
|
|
128
104
|
* Enforce a specific function type for function components 🔧
|
|
129
105
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md.
|
|
@@ -244,6 +220,12 @@ module.exports = {
|
|
|
244
220
|
*/
|
|
245
221
|
"react/no-namespace": "error",
|
|
246
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Disallow usage of referential-type variables as default param in functional component
|
|
225
|
+
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md.
|
|
226
|
+
*/
|
|
227
|
+
"react/no-object-type-as-default-prop": "off",
|
|
228
|
+
|
|
247
229
|
/**
|
|
248
230
|
* Disallow usage of shouldComponentUpdate when extending React.PureComponent
|
|
249
231
|
* https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md.
|