@prowise/eslint-config-linting-rules 0.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.
@@ -0,0 +1,294 @@
1
+ module.exports = {
2
+ plugins: ["jsx-a11y", "react"],
3
+
4
+ parserOptions: {
5
+ ecmaFeatures: {
6
+ jsx: true,
7
+ },
8
+ },
9
+
10
+ rules: {
11
+ /**
12
+ * Enforce that all elements that require alternative text have meaningful information
13
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md.
14
+ */
15
+ "jsx-a11y/alt-text": [
16
+ "error",
17
+ {
18
+ elements: ["img", "object", "area", "input[type='image']"],
19
+ img: [],
20
+ object: [],
21
+ area: [],
22
+ "input[type='image']": [],
23
+ },
24
+ ],
25
+
26
+ /**
27
+ * Enforce <a> text to not exactly match "click here", "here", "link", or "a link".
28
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-ambiguous-text.md.
29
+ */
30
+ "jsx-a11y/anchor-ambiguous-text": "warn",
31
+
32
+ /**
33
+ * Enforce that anchors have content
34
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md.
35
+ */
36
+ "jsx-a11y/anchor-has-content": ["error", { components: [] }],
37
+
38
+ /**
39
+ * Ensure <a> tags are valid
40
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md.
41
+ */
42
+ "jsx-a11y/anchor-is-valid": [
43
+ "error",
44
+ {
45
+ components: ["Link"],
46
+ specialLink: ["to"],
47
+ aspects: ["noHref", "invalidHref", "preferButton"],
48
+ },
49
+ ],
50
+
51
+ /**
52
+ * Elements with aria-activedescendant must be tabbable
53
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md.
54
+ */
55
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
56
+
57
+ /**
58
+ * Enforce all aria-* props are valid.
59
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md.
60
+ */
61
+ "jsx-a11y/aria-props": "error",
62
+
63
+ /**
64
+ * Enforce ARIA state and property values are valid.
65
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md.
66
+ */
67
+ "jsx-a11y/aria-proptypes": "error",
68
+
69
+ /**
70
+ * Require ARIA roles to be valid and non-abstract
71
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md.
72
+ */
73
+ "jsx-a11y/aria-role": ["error", { ignoreNonDOM: false }],
74
+
75
+ /**
76
+ * Enforce that elements that do not support ARIA roles, states, and
77
+ * properties do not have those attributes.
78
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md.
79
+ */
80
+ "jsx-a11y/aria-unsupported-elements": "error",
81
+
82
+ /**
83
+ * Ensure the autocomplete attribute is correct and suitable for the form field it is used with
84
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md.
85
+ */
86
+ "jsx-a11y/autocomplete-valid": ["off", { inputComponents: [] }],
87
+
88
+ /**
89
+ * Require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
90
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md.
91
+ */
92
+ "jsx-a11y/click-events-have-key-events": "error",
93
+
94
+ /**
95
+ * Enforce that a control (an interactive element) has a text label.
96
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md.
97
+ */
98
+ "jsx-a11y/control-has-associated-label": [
99
+ "error",
100
+ {
101
+ labelAttributes: ["label"],
102
+ controlComponents: [],
103
+ ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
104
+ ignoreRoles: [
105
+ "grid",
106
+ "listbox",
107
+ "menu",
108
+ "menubar",
109
+ "radiogroup",
110
+ "row",
111
+ "tablist",
112
+ "toolbar",
113
+ "tree",
114
+ "treegrid",
115
+ ],
116
+ depth: 5,
117
+ },
118
+ ],
119
+
120
+ /**
121
+ * Ensure <hX> tags have content and are not aria-hidden
122
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md.
123
+ */
124
+ "jsx-a11y/heading-has-content": ["error", { components: [""] }],
125
+
126
+ /**
127
+ * Require HTML elements to have a "lang" prop
128
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md.
129
+ */
130
+ "jsx-a11y/html-has-lang": "error",
131
+
132
+ /**
133
+ * Ensure iframe elements have a unique title
134
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md.
135
+ */
136
+ "jsx-a11y/iframe-has-title": "error",
137
+
138
+ /**
139
+ * Prevent img alt text from containing redundant words like "image", "picture", or "photo"
140
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md.
141
+ */
142
+ "jsx-a11y/img-redundant-alt": "error",
143
+
144
+ /**
145
+ * Elements with an interactive role and interaction handlers must be focusable
146
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md.
147
+ */
148
+ "jsx-a11y/interactive-supports-focus": "error",
149
+
150
+ /**
151
+ * Enforce that a label tag has a text label and an associated control.
152
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md.
153
+ */
154
+ "jsx-a11y/label-has-associated-control": [
155
+ "error",
156
+ {
157
+ labelComponents: [],
158
+ labelAttributes: [],
159
+ controlComponents: [],
160
+ assert: "both",
161
+ depth: 25,
162
+ },
163
+ ],
164
+
165
+ /**
166
+ * Require HTML element"s lang prop to be valid
167
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md.
168
+ */
169
+ "jsx-a11y/lang": "error",
170
+
171
+ /**
172
+ * Media elements must have captions
173
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md.
174
+ */
175
+ "jsx-a11y/media-has-caption": [
176
+ "error",
177
+ {
178
+ audio: [],
179
+ video: [],
180
+ track: [],
181
+ },
182
+ ],
183
+
184
+ /**
185
+ * Require that mouseover/out come with focus/blur, for keyboard-only users
186
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md.
187
+ */
188
+ "jsx-a11y/mouse-events-have-key-events": "error",
189
+
190
+ /**
191
+ * Prevent use of `accessKey`
192
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md.
193
+ */
194
+ "jsx-a11y/no-access-key": "error",
195
+
196
+ /**
197
+ * Prohibit autoFocus prop
198
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md.
199
+ */
200
+ "jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
201
+
202
+ /**
203
+ * Prevent distracting elements, like <marquee> and <blink>
204
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md.
205
+ */
206
+ "jsx-a11y/no-distracting-elements": ["error", { elements: ["marquee", "blink"] }],
207
+
208
+ /**
209
+ * WAI-ARIA roles should not be used to convert an interactive element to non-interactive
210
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md.
211
+ */
212
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": ["error", { tr: ["none", "presentation"] }],
213
+
214
+ /**
215
+ * A non-interactive element does not support event handlers (mouse and key handlers)
216
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md.
217
+ */
218
+ "jsx-a11y/no-noninteractive-element-interactions": [
219
+ "error",
220
+ {
221
+ handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
222
+ },
223
+ ],
224
+
225
+ /**
226
+ * WAI-ARIA roles should not be used to convert a non-interactive element to interactive
227
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md.
228
+ */
229
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
230
+ "error",
231
+ {
232
+ ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
233
+ ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
234
+ li: ["menuitem", "option", "row", "tab", "treeitem"],
235
+ table: ["grid"],
236
+ td: ["gridcell"],
237
+ },
238
+ ],
239
+
240
+ /**
241
+ * Tab key navigation should be limited to elements on the page that can be interacted with.
242
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md.
243
+ */
244
+ "jsx-a11y/no-noninteractive-tabindex": ["error", { tags: [], roles: ["tabpanel"] }],
245
+
246
+ /**
247
+ * Require onBlur instead of onChange
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
254
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md.
255
+ */
256
+ "jsx-a11y/no-redundant-roles": "error",
257
+
258
+ /**
259
+ * Enforce that DOM elements without semantic behavior not have interaction handlers
260
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md.
261
+ */
262
+ "jsx-a11y/no-static-element-interactions": [
263
+ "error",
264
+ {
265
+ handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
266
+ },
267
+ ],
268
+
269
+ /**
270
+ * Enforce that elements with ARIA roles must have all required attributes for that role.
271
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md.
272
+ */
273
+ "jsx-a11y/role-has-required-aria-props": "error",
274
+
275
+ /**
276
+ * Enforce that elements with explicit or implicit roles defined contain
277
+ * only aria-* properties supported by that role.
278
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md.
279
+ */
280
+ "jsx-a11y/role-supports-aria-props": "error",
281
+
282
+ /**
283
+ * Only allow <th> to have the "scope" attr
284
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md.
285
+ */
286
+ "jsx-a11y/scope": "error",
287
+
288
+ /**
289
+ * Enforce tabIndex value is not greater than zero.
290
+ * Https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md.
291
+ */
292
+ "jsx-a11y/tabindex-no-positive": "error",
293
+ },
294
+ };
@@ -0,0 +1,61 @@
1
+ module.exports = {
2
+ env: {
3
+ node: true,
4
+ },
5
+
6
+ rules: {
7
+ /**
8
+ * Enforce return after a callback
9
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/callback-return.md.
10
+ */
11
+ "node/callback-return": "off",
12
+
13
+ /**
14
+ * Require all requires be top-level
15
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/global-require.md.
16
+ */
17
+ "node/global-require": "error",
18
+
19
+ /**
20
+ * Enforces error handling in callbacks (node environment)
21
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/handle-callback-err.md.
22
+ */
23
+ "node/handle-callback-err": "off",
24
+
25
+ /**
26
+ * Disallow use of the Buffer() constructor
27
+ * https://eslint.org/docs/latest/rules/no-buffer-constructor#rule-details.
28
+ */
29
+ "no-buffer-constructor": "error",
30
+
31
+ /**
32
+ * Disallow mixing regular variable and require declarations
33
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-mixed-requires.md.
34
+ */
35
+ "node/no-mixed-requires": ["off", false],
36
+
37
+ /**
38
+ * Disallow use of new operator with the require function
39
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-new-require.md.
40
+ */
41
+ "node/no-new-require": "error",
42
+
43
+ /**
44
+ * Disallow string concatenation with __dirname and __filename
45
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-path-concat.md.
46
+ */
47
+ "node/no-path-concat": "error",
48
+
49
+ /**
50
+ * Disallow use of process.env
51
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-env.md.
52
+ */
53
+ "/node/no-process-env": "off",
54
+
55
+ /**
56
+ * Disallow process.exit()
57
+ * https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-exit.md.
58
+ */
59
+ "node/no-process-exit": "off",
60
+ },
61
+ };
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ plugins: ["react-hooks"],
3
+
4
+ parserOptions: {
5
+ ecmaFeatures: {
6
+ jsx: true,
7
+ },
8
+ },
9
+
10
+ rules: {
11
+ /**
12
+ * Enforce Rules of Hooks
13
+ * https://reactjs.org/docs/hooks-rules.html.
14
+ */
15
+ "react-hooks/rules-of-hooks": "error",
16
+
17
+ /**
18
+ * Verify the list of the dependencies for Hooks like useEffect and similar
19
+ * https://reactjs.org/docs/hooks-rules.html.
20
+ */
21
+ "react-hooks/exhaustive-deps": "error",
22
+ },
23
+ };