@luxass/eslint-config 4.0.0-beta.0 → 4.0.0-beta.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,460 @@
1
+ import {
2
+ GLOB_REACT
3
+ } from "./chunk-C6E356K2.mjs";
4
+ import {
5
+ interop
6
+ } from "./chunk-4VUK6ART.mjs";
7
+
8
+ // src/configs/react.ts
9
+ import globals from "globals";
10
+ async function react() {
11
+ const pluginA11y = await interop(import("eslint-plugin-jsx-a11y"));
12
+ const pluginReact = await interop(import("eslint-plugin-react"));
13
+ const pluginReactHooks = await interop(import("eslint-plugin-react-hooks"));
14
+ return [
15
+ {
16
+ name: "luxass:react:setup",
17
+ plugins: {
18
+ "jsx-a11y": pluginA11y,
19
+ "react": pluginReact,
20
+ "react-hooks": pluginReactHooks
21
+ }
22
+ },
23
+ {
24
+ files: [GLOB_REACT],
25
+ languageOptions: {
26
+ ...pluginReact.configs.recommended.languageOptions,
27
+ globals: {
28
+ ...globals.browser
29
+ },
30
+ parserOptions: {
31
+ ecmaFeatures: {
32
+ jsx: true
33
+ }
34
+ }
35
+ },
36
+ name: "luxass:react:rules",
37
+ rules: {
38
+ ...pluginReact.configs.all.rules,
39
+ ...pluginReactHooks.configs.recommended.rules,
40
+ ...pluginA11y.configs.recommended.rules,
41
+ "jsx-a11y/accessible-emoji": ["warn"],
42
+ "jsx-a11y/alt-text": [
43
+ "warn",
44
+ {
45
+ "area": [],
46
+ "elements": ["img", "object", "area", 'input[type="image"]'],
47
+ "img": [],
48
+ 'input[type="image"]': [],
49
+ "object": []
50
+ }
51
+ ],
52
+ "jsx-a11y/anchor-has-content": ["warn", { components: [] }],
53
+ "jsx-a11y/anchor-is-valid": [
54
+ "warn",
55
+ {
56
+ aspects: ["noHref", "invalidHref", "preferButton"],
57
+ components: ["Link"],
58
+ specialLink: ["to"]
59
+ }
60
+ ],
61
+ "jsx-a11y/aria-activedescendant-has-tabindex": ["warn"],
62
+ "jsx-a11y/aria-props": ["warn"],
63
+ "jsx-a11y/aria-proptypes": ["warn"],
64
+ "jsx-a11y/aria-role": ["warn", { ignoreNonDOM: false }],
65
+ "jsx-a11y/aria-unsupported-elements": ["warn"],
66
+ "jsx-a11y/autocomplete-valid": ["off", { inputComponents: [] }],
67
+ "jsx-a11y/click-events-have-key-events": ["warn"],
68
+ "jsx-a11y/control-has-associated-label": [
69
+ "warn",
70
+ {
71
+ controlComponents: [],
72
+ depth: 5,
73
+ ignoreElements: [
74
+ "audio",
75
+ "canvas",
76
+ "embed",
77
+ "input",
78
+ "textarea",
79
+ "tr",
80
+ "video"
81
+ ],
82
+ ignoreRoles: [
83
+ "grid",
84
+ "listbox",
85
+ "menu",
86
+ "menubar",
87
+ "radiogroup",
88
+ "row",
89
+ "tablist",
90
+ "toolbar",
91
+ "tree",
92
+ "treegrid"
93
+ ],
94
+ labelAttributes: ["label"]
95
+ }
96
+ ],
97
+ "jsx-a11y/heading-has-content": ["warn", { components: [""] }],
98
+ "jsx-a11y/html-has-lang": ["warn"],
99
+ "jsx-a11y/iframe-has-title": ["warn"],
100
+ "jsx-a11y/img-redundant-alt": ["warn"],
101
+ "jsx-a11y/interactive-supports-focus": ["warn"],
102
+ "jsx-a11y/label-has-associated-control": [
103
+ "warn",
104
+ {
105
+ assert: "both",
106
+ controlComponents: [],
107
+ depth: 25,
108
+ labelAttributes: [],
109
+ labelComponents: []
110
+ }
111
+ ],
112
+ "jsx-a11y/label-has-for": [
113
+ "off",
114
+ {
115
+ allowChildren: false,
116
+ components: [],
117
+ required: {
118
+ every: ["nesting", "id"]
119
+ }
120
+ }
121
+ ],
122
+ "jsx-a11y/lang": ["warn"],
123
+ "jsx-a11y/media-has-caption": [
124
+ "warn",
125
+ {
126
+ audio: [],
127
+ track: [],
128
+ video: []
129
+ }
130
+ ],
131
+ "jsx-a11y/mouse-events-have-key-events": ["warn"],
132
+ "jsx-a11y/no-access-key": ["warn"],
133
+ "jsx-a11y/no-autofocus": ["warn", { ignoreNonDOM: true }],
134
+ "jsx-a11y/no-distracting-elements": [
135
+ "warn",
136
+ { elements: ["marquee", "blink"] }
137
+ ],
138
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": [
139
+ "warn",
140
+ { tr: ["none", "presentation"] }
141
+ ],
142
+ "jsx-a11y/no-noninteractive-element-interactions": [
143
+ "warn",
144
+ {
145
+ handlers: [
146
+ "onClick",
147
+ "onMouseDown",
148
+ "onMouseUp",
149
+ "onKeyPress",
150
+ "onKeyDown",
151
+ "onKeyUp"
152
+ ]
153
+ }
154
+ ],
155
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": [
156
+ "warn",
157
+ {
158
+ li: ["menuitem", "option", "row", "tab", "treeitem"],
159
+ ol: [
160
+ "listbox",
161
+ "menu",
162
+ "menubar",
163
+ "radiogroup",
164
+ "tablist",
165
+ "tree",
166
+ "treegrid"
167
+ ],
168
+ table: ["grid"],
169
+ td: ["gridcell"],
170
+ ul: [
171
+ "listbox",
172
+ "menu",
173
+ "menubar",
174
+ "radiogroup",
175
+ "tablist",
176
+ "tree",
177
+ "treegrid"
178
+ ]
179
+ }
180
+ ],
181
+ "jsx-a11y/no-noninteractive-tabindex": [
182
+ "warn",
183
+ { roles: ["tabpanel"], tags: [] }
184
+ ],
185
+ "jsx-a11y/no-onchange": ["off"],
186
+ "jsx-a11y/no-redundant-roles": ["warn"],
187
+ "jsx-a11y/no-static-element-interactions": [
188
+ "off",
189
+ {
190
+ handlers: [
191
+ "onClick",
192
+ "onMouseDown",
193
+ "onMouseUp",
194
+ "onKeyPress",
195
+ "onKeyDown",
196
+ "onKeyUp"
197
+ ]
198
+ }
199
+ ],
200
+ "jsx-a11y/role-has-required-aria-props": ["warn"],
201
+ "jsx-a11y/role-supports-aria-props": ["warn"],
202
+ "jsx-a11y/scope": ["warn"],
203
+ "jsx-a11y/tabindex-no-positive": ["warn"],
204
+ "react-hooks/exhaustive-deps": ["warn"],
205
+ "react-hooks/rules-of-hooks": ["error"],
206
+ "react/boolean-prop-naming": [
207
+ "warn",
208
+ { rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+", validateNested: true }
209
+ ],
210
+ "react/button-has-type": [
211
+ "error",
212
+ { button: true, reset: false, submit: true }
213
+ ],
214
+ "react/default-props-match-prop-types": [
215
+ "error",
216
+ { allowRequiredDefaults: false }
217
+ ],
218
+ "react/destructuring-assignment": ["off", "always"],
219
+ "react/display-name": ["error", { ignoreTranspilerName: false }],
220
+ "react/forbid-component-props": ["off", { forbid: [] }],
221
+ "react/forbid-dom-props": ["off", { forbid: [] }],
222
+ "react/forbid-elements": ["off", { forbid: [] }],
223
+ "react/forbid-foreign-prop-types": ["error", { allowInPropTypes: true }],
224
+ "react/forbid-prop-types": ["error", { forbid: ["any", "array"] }],
225
+ "react/function-component-definition": "error",
226
+ "react/hook-use-state": ["error"],
227
+ "react/iframe-missing-sandbox": ["error"],
228
+ "react/jsx-boolean-value": ["error", "never", { always: [] }],
229
+ "react/jsx-child-element-spacing": ["off"],
230
+ "react/jsx-closing-bracket-location": [
231
+ "off",
232
+ { nonEmpty: "tag-aligned", selfClosing: false }
233
+ ],
234
+ "react/jsx-closing-tag-location": ["off"],
235
+ "react/jsx-curly-brace-presence": [
236
+ "error",
237
+ { children: "ignore", propElementValues: "always", props: "never" }
238
+ ],
239
+ "react/jsx-curly-newline": [
240
+ "off",
241
+ { multiline: "consistent", singleline: "forbid" }
242
+ ],
243
+ "react/jsx-curly-spacing": ["error", "never"],
244
+ "react/jsx-equals-spacing": ["error", "never"],
245
+ "react/jsx-filename-extension": ["warn", { extensions: [".tsx"] }],
246
+ "react/jsx-first-prop-new-line": ["off", "multiline"],
247
+ "react/jsx-fragments": ["error", "syntax"],
248
+ "react/jsx-handler-names": [
249
+ "error",
250
+ { eventHandlerPrefix: "handle", eventHandlerPropPrefix: "on" }
251
+ ],
252
+ "react/jsx-indent": ["off", "tab"],
253
+ "react/jsx-indent-props": ["off", "tab"],
254
+ "react/jsx-key": [
255
+ "error",
256
+ {
257
+ checkFragmentShorthand: true,
258
+ checkKeyMustBeforeSpread: true,
259
+ warnOnDuplicates: true
260
+ }
261
+ ],
262
+ "react/jsx-max-depth": ["off"],
263
+ "react/jsx-max-props-per-line": [
264
+ "off",
265
+ { maximum: 3, when: "multiline" }
266
+ ],
267
+ "react/jsx-newline": ["off"],
268
+ "react/jsx-no-bind": [
269
+ "error",
270
+ {
271
+ allowArrowFunctions: true,
272
+ allowBind: false,
273
+ allowFunctions: false,
274
+ ignoreDOMComponents: false,
275
+ ignoreRefs: false
276
+ }
277
+ ],
278
+ "react/jsx-no-comment-textnodes": ["error"],
279
+ "react/jsx-no-constructed-context-values": ["error"],
280
+ "react/jsx-no-duplicate-props": ["error", { ignoreCase: false }],
281
+ "react/jsx-no-leaked-render": "off",
282
+ "react/jsx-no-literals": ["off", { noStrings: true }],
283
+ "react/jsx-no-script-url": ["error", [{ name: "Link", props: ["to"] }]],
284
+ "react/jsx-no-target-blank": [
285
+ "error",
286
+ { forms: true, links: true, warnOnSpreadAttributes: true }
287
+ ],
288
+ "react/jsx-no-undef": ["error"],
289
+ "react/jsx-no-useless-fragment": ["error"],
290
+ "react/jsx-one-expression-per-line": ["off", { allow: "single-child" }],
291
+ "react/jsx-pascal-case": ["error", { allowAllCaps: true, ignore: [] }],
292
+ "react/jsx-props-no-multi-spaces": ["error"],
293
+ "react/jsx-props-no-spreading": [
294
+ "off",
295
+ {
296
+ custom: "enforce",
297
+ exceptions: [],
298
+ explicitSpread: "ignore",
299
+ html: "enforce"
300
+ }
301
+ ],
302
+ "react/jsx-sort-default-props": ["off", { ignoreCase: true }],
303
+ "react/jsx-sort-prop-types": ["off"],
304
+ "react/jsx-sort-props": [
305
+ "error",
306
+ {
307
+ callbacksLast: true,
308
+ locale: "auto",
309
+ multiline: "ignore",
310
+ noSortAlphabetically: true,
311
+ reservedFirst: true,
312
+ shorthandFirst: true
313
+ }
314
+ ],
315
+ "react/jsx-space-before-closing": ["off", "always"],
316
+ "react/jsx-tag-spacing": [
317
+ "error",
318
+ {
319
+ afterOpening: "never",
320
+ beforeClosing: "never",
321
+ beforeSelfClosing: "always",
322
+ closingSlash: "never"
323
+ }
324
+ ],
325
+ "react/jsx-uses-react": ["off"],
326
+ "react/jsx-uses-vars": ["error"],
327
+ "react/jsx-wrap-multilines": [
328
+ "error",
329
+ {
330
+ arrow: "parens-new-line",
331
+ assignment: "parens-new-line",
332
+ condition: "ignore",
333
+ declaration: "parens-new-line",
334
+ logical: "ignore",
335
+ prop: "ignore",
336
+ return: "parens-new-line"
337
+ }
338
+ ],
339
+ "react/no-access-state-in-setstate": ["error"],
340
+ "react/no-adjacent-inline-elements": ["off"],
341
+ "react/no-array-index-key": ["error"],
342
+ "react/no-arrow-function-lifecycle": ["error"],
343
+ "react/no-children-prop": ["error"],
344
+ "react/no-danger": ["error"],
345
+ "react/no-danger-with-children": ["error"],
346
+ "react/no-deprecated": ["error"],
347
+ "react/no-did-mount-set-state": ["off"],
348
+ "react/no-did-update-set-state": ["error"],
349
+ "react/no-direct-mutation-state": ["error"],
350
+ "react/no-find-dom-node": ["error"],
351
+ "react/no-invalid-html-attribute": ["error"],
352
+ "react/no-is-mounted": ["error"],
353
+ "react/no-multi-comp": ["off"],
354
+ "react/no-namespace": ["error"],
355
+ "react/no-redundant-should-component-update": ["error"],
356
+ "react/no-render-return-value": ["error"],
357
+ "react/no-set-state": ["off"],
358
+ "react/no-string-refs": ["error", { noTemplateLiterals: true }],
359
+ "react/no-this-in-sfc": ["error"],
360
+ "react/no-typos": ["error"],
361
+ "react/no-unescaped-entities": ["error"],
362
+ "react/no-unknown-property": ["error"],
363
+ "react/no-unsafe": ["error", { checkAliases: true }],
364
+ "react/no-unstable-nested-components": ["error"],
365
+ "react/no-unused-class-component-methods": ["error"],
366
+ "react/no-unused-prop-types": [
367
+ "off"
368
+ // { customValidators: [], skipShapeProps: true },
369
+ ],
370
+ "react/no-unused-state": ["error"],
371
+ "react/no-will-update-set-state": ["error"],
372
+ "react/prefer-es6-class": ["error", "always"],
373
+ "react/prefer-exact-props": ["error"],
374
+ "react/prefer-read-only-props": ["error"],
375
+ "react/prefer-stateless-function": [
376
+ "error",
377
+ { ignorePureComponents: true }
378
+ ],
379
+ "react/prop-types": [
380
+ "off"
381
+ // { customValidators: [], ignore: [], skipUndeclared: false },
382
+ ],
383
+ "react/react-in-jsx-scope": ["off"],
384
+ "react/require-default-props": [
385
+ "off",
386
+ { forbidDefaultForRequired: true, ignoreFunctionalComponents: true }
387
+ ],
388
+ "react/require-optimization": ["off", { allowDecorators: [] }],
389
+ "react/require-render-return": ["error"],
390
+ "react/self-closing-comp": ["error", { component: true, html: true }],
391
+ "react/sort-comp": [
392
+ "off",
393
+ {
394
+ groups: {
395
+ lifecycle: [
396
+ "displayName",
397
+ "propTypes",
398
+ "contextTypes",
399
+ "childContextTypes",
400
+ "mixins",
401
+ "statics",
402
+ "defaultProps",
403
+ "constructor",
404
+ "getDefaultProps",
405
+ "getInitialState",
406
+ "state",
407
+ "getChildContext",
408
+ "getDerivedStateFromProps",
409
+ "componentWillMount",
410
+ "UNSAFE_componentWillMount",
411
+ "componentDidMount",
412
+ "componentWillReceiveProps",
413
+ "UNSAFE_componentWillReceiveProps",
414
+ "shouldComponentUpdate",
415
+ "componentWillUpdate",
416
+ "UNSAFE_componentWillUpdate",
417
+ "getSnapshotBeforeUpdate",
418
+ "componentDidUpdate",
419
+ "componentDidCatch",
420
+ "componentWillUnmount"
421
+ ],
422
+ rendering: ["/^render.+$/", "render"]
423
+ },
424
+ order: [
425
+ "static-variables",
426
+ "static-methods",
427
+ "instance-variables",
428
+ "lifecycle",
429
+ "/^handle.+$/",
430
+ "/^on.+$/",
431
+ "getters",
432
+ "setters",
433
+ "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
434
+ "instance-methods",
435
+ "everything-else",
436
+ "rendering"
437
+ ]
438
+ }
439
+ ],
440
+ "react/sort-prop-types": [
441
+ "off",
442
+ {
443
+ callbacksLast: false,
444
+ ignoreCase: true,
445
+ requiredFirst: false,
446
+ sortShapeProp: true
447
+ }
448
+ ],
449
+ "react/state-in-constructor": ["error", "never"],
450
+ "react/static-property-placement": ["error", "property assignment"],
451
+ "react/style-prop-object": ["error", { allow: ["FormattedNumber"] }],
452
+ "react/void-dom-elements-no-children": ["error"]
453
+ }
454
+ }
455
+ ];
456
+ }
457
+
458
+ export {
459
+ react
460
+ };