@adbayb/stack 0.0.0-next-1ee86fc → 0.0.0-next-730a06d

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.
@@ -1,877 +0,0 @@
1
- /* eslint-disable sort-keys-custom-order/object-keys */
2
- import { cwd } from "node:process";
3
- import { join, resolve } from "node:path";
4
- import { createRequire } from "node:module";
5
-
6
- import tseslint from "typescript-eslint";
7
- import globals from "globals";
8
- import sortKeysCustomOrderPlugin from "eslint-plugin-sort-keys-custom-order";
9
- import sonarjsPlugin from "eslint-plugin-sonarjs";
10
- import reactHooksPlugin from "eslint-plugin-react-hooks";
11
- import reactPlugin from "eslint-plugin-react";
12
- import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
13
- import nodePlugin from "eslint-plugin-n";
14
- import jsdocPlugin from "eslint-plugin-jsdoc";
15
- import jestFormattingPlugin from "eslint-plugin-jest-formatting";
16
- import importPlugin from "eslint-plugin-import-x";
17
- import vitestPlugin from "@vitest/eslint-plugin";
18
- import { FlatCompat } from "@eslint/eslintrc";
19
- import { includeIgnoreFile } from "@eslint/compat";
20
-
21
- /**
22
- * TODO:
23
- * - Review TS rules: attempt to include all rules from https://typescript-eslint.io/users/configs/#strict-type-checked and https://typescript-eslint.io/users/configs/#stylistic-type-checked ?
24
- * - Review JSDoc rules.
25
- */
26
-
27
- const require = createRequire(import.meta.url);
28
- const CWD = cwd();
29
-
30
- export default tseslint.config(
31
- {
32
- languageOptions: {
33
- ecmaVersion: "latest",
34
- globals: {
35
- ...globals.browser,
36
- ...globals.node,
37
- ...globals.worker,
38
- },
39
- parserOptions: {
40
- ecmaFeatures: {
41
- jsx: true,
42
- },
43
- },
44
- sourceType: "module",
45
- },
46
- },
47
- includeIgnoreFile(resolve(CWD, ".gitignore")),
48
- importPlugin.flatConfigs.typescript,
49
- {
50
- files: ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"],
51
- languageOptions: {
52
- parser: tseslint.parser,
53
- parserOptions: {
54
- project: "./tsconfig.json",
55
- tsconfigRootDir: CWD,
56
- },
57
- },
58
- plugins: {
59
- "import-x": importPlugin,
60
- "jsdoc": jsdocPlugin,
61
- "n": nodePlugin,
62
- "sonarjs": sonarjsPlugin,
63
- "sort-keys-custom-order": sortKeysCustomOrderPlugin,
64
- "@typescript-eslint": tseslint.plugin,
65
- },
66
- settings: {
67
- "import-x/resolver": {
68
- node: true,
69
- typescript: true,
70
- },
71
- "node": {
72
- version: require(join(CWD, "package.json")).engines.node,
73
- },
74
- },
75
- rules: {
76
- //#region eslint
77
- "constructor-super": "error",
78
- "eqeqeq": "error",
79
- "for-direction": "error",
80
- "getter-return": "error",
81
- "no-alert": "error",
82
- "no-async-promise-executor": "error",
83
- "no-case-declarations": "error",
84
- "no-class-assign": "error",
85
- "no-compare-neg-zero": "error",
86
- "no-cond-assign": "error",
87
- "no-const-assign": "error",
88
- "no-constant-binary-expression": "error",
89
- "no-constant-condition": "error",
90
- "no-control-regex": "error",
91
- "no-debugger": "error",
92
- "no-delete-var": "error",
93
- "no-dupe-args": "error",
94
- "no-dupe-else-if": "error",
95
- "no-dupe-keys": "error",
96
- "no-duplicate-case": "error",
97
- "no-empty": "error",
98
- "no-empty-character-class": "error",
99
- "no-empty-pattern": "error",
100
- "no-empty-static-block": "error",
101
- "no-ex-assign": "error",
102
- "no-extra-boolean-cast": "error",
103
- "no-fallthrough": "error",
104
- "no-func-assign": "error",
105
- "no-global-assign": "error",
106
- "no-import-assign": "error",
107
- "no-invalid-regexp": "error",
108
- "no-irregular-whitespace": "error",
109
- "no-misleading-character-class": "error",
110
- "no-new-native-nonconstructor": "error",
111
- "no-nonoctal-decimal-escape": "error",
112
- "no-obj-calls": "error",
113
- "no-octal": "error",
114
- "no-prototype-builtins": "error",
115
- "no-redeclare": "error",
116
- "no-regex-spaces": "error",
117
- "no-restricted-syntax": [
118
- "error",
119
- {
120
- // https://medium.com/@hbarcelos/why-i-banned-null-from-my-js-code-and-why-you-should-too-13df90323cfa
121
- selector: "Literal[raw='null']",
122
- message: "Use undefined instead of null",
123
- },
124
- ],
125
- "no-self-assign": "error",
126
- "no-setter-return": "error",
127
- "no-shadow-restricted-names": "error",
128
- "no-sparse-arrays": "error",
129
- "no-this-before-super": "error",
130
- "no-undef": "error",
131
- "no-unexpected-multiline": "error",
132
- "no-unreachable": "error",
133
- "no-unsafe-finally": "error",
134
- "no-unsafe-negation": "error",
135
- "no-unsafe-optional-chaining": "error",
136
- "no-unused-labels": "error",
137
- "no-unused-private-class-members": "error",
138
- "no-useless-backreference": "error",
139
- "no-useless-catch": "error",
140
- "no-useless-escape": "error",
141
- "no-var": "error",
142
- "no-with": "error",
143
- "object-shorthand": ["error", "always"],
144
- "padding-line-between-statements": [
145
- "error",
146
- {
147
- blankLine: "always",
148
- next: "*",
149
- prev: "*",
150
- },
151
- {
152
- blankLine: "never",
153
- next: ["const", "let", "var"],
154
- prev: ["const", "let", "var"],
155
- },
156
- {
157
- blankLine: "never",
158
- next: ["case", "default"],
159
- prev: ["case", "default"],
160
- },
161
- {
162
- blankLine: "always",
163
- next: ["const", "let", "var"],
164
- prev: ["multiline-const", "multiline-let", "multiline-var"],
165
- },
166
- {
167
- blankLine: "always",
168
- next: ["multiline-const", "multiline-let", "multiline-var"],
169
- prev: ["const", "let", "var"],
170
- },
171
- {
172
- blankLine: "any",
173
- next: ["expression"],
174
- prev: ["expression"],
175
- },
176
- {
177
- blankLine: "any",
178
- next: ["const", "let", "var"],
179
- prev: ["cjs-import"],
180
- },
181
- {
182
- blankLine: "any",
183
- next: ["cjs-import", "import"],
184
- prev: ["cjs-import", "import"],
185
- },
186
- {
187
- blankLine: "any",
188
- next: ["cjs-export", "export"],
189
- prev: ["cjs-export", "export"],
190
- },
191
- ],
192
- "prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
193
- "prefer-const": "error",
194
- "prefer-template": "error",
195
- "require-yield": "error",
196
- "sort-imports": ["error", { ignoreDeclarationSort: true }],
197
- "sort-vars": "error",
198
- "use-isnan": "error",
199
- "valid-typeof": "error",
200
- //#endregion
201
- //#region import
202
- "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
203
- "import-x/export": "error",
204
- "import-x/first": "error",
205
- "import-x/newline-after-import": "error",
206
- "import-x/no-absolute-path": "error",
207
- "import-x/no-amd": "error",
208
- "import-x/no-anonymous-default-export": "error",
209
- "import-x/no-commonjs": "error",
210
- "import-x/no-cycle": "error",
211
- "import-x/no-default-export": "error",
212
- "import-x/no-deprecated": "error",
213
- "import-x/no-duplicates": "error",
214
- "import-x/no-empty-named-blocks": "error",
215
- "import-x/no-extraneous-dependencies": "error",
216
- "import-x/no-import-module-exports": "error",
217
- "import-x/no-mutable-exports": "error",
218
- "import-x/no-named-default": "error",
219
- "import-x/no-namespace": "error",
220
- "import-x/no-relative-packages": "error",
221
- "import-x/no-self-import": "error",
222
- "import-x/no-unassigned-import": "error",
223
- "import-x/no-unused-modules": "error",
224
- "import-x/no-useless-path-segments": [
225
- "error",
226
- {
227
- commonjs: true,
228
- noUselessIndex: true,
229
- },
230
- ],
231
- "import-x/no-webpack-loader-syntax": "error",
232
- "import-x/order": [
233
- "error",
234
- {
235
- "alphabetize": {
236
- caseInsensitive: false,
237
- order: "desc",
238
- orderImportKind: "desc",
239
- },
240
- "groups": [
241
- "builtin",
242
- "external",
243
- "internal",
244
- ["parent", "sibling", "index"],
245
- "object",
246
- "unknown",
247
- ],
248
- "newlines-between": "always",
249
- },
250
- ],
251
- "import-x/unambiguous": "error",
252
- //#endregion
253
- //#region jsdoc
254
- "jsdoc/check-access": "error",
255
- "jsdoc/check-alignment": "error",
256
- "jsdoc/check-examples": "off", // To enable once ESLint >= 8.x is supported
257
- "jsdoc/check-indentation": "error",
258
- "jsdoc/check-line-alignment": "error",
259
- "jsdoc/check-param-names": "error",
260
- "jsdoc/check-property-names": "error",
261
- "jsdoc/check-syntax": "error",
262
- "jsdoc/check-tag-names": "error",
263
- "jsdoc/check-types": "error",
264
- "jsdoc/check-values": "error",
265
- "jsdoc/empty-tags": "error",
266
- "jsdoc/implements-on-classes": "error",
267
- "jsdoc/multiline-blocks": "error",
268
- "jsdoc/no-bad-blocks": "error",
269
- "jsdoc/no-blank-block-descriptions": "error",
270
- "jsdoc/no-defaults": "error",
271
- "jsdoc/no-multi-asterisks": "error",
272
- "jsdoc/no-types": "error",
273
- "jsdoc/require-asterisk-prefix": "error",
274
- "jsdoc/require-description": "error",
275
- "jsdoc/require-description-complete-sentence": "error",
276
- "jsdoc/require-example": "error",
277
- "jsdoc/require-hyphen-before-param-description": "error",
278
- "jsdoc/require-jsdoc": [
279
- // To enable once the rule can be configured to require JSDoc for exported functions at package level (only at module level right now)
280
- "off",
281
- {
282
- contexts: [
283
- "TSTypeAliasDeclaration",
284
- "TSInterfaceDeclaration",
285
- "TSMethodSignature",
286
- "TSPropertySignature",
287
- ],
288
- publicOnly: {
289
- ancestorsOnly: true,
290
- esm: true,
291
- cjs: true,
292
- },
293
- require: {
294
- ArrowFunctionExpression: true,
295
- ClassDeclaration: true,
296
- ClassExpression: true,
297
- FunctionDeclaration: true,
298
- FunctionExpression: true,
299
- MethodDefinition: true,
300
- },
301
- },
302
- ],
303
- "jsdoc/require-param": "error",
304
- "jsdoc/require-param-description": "error",
305
- "jsdoc/require-param-name": "error",
306
- "jsdoc/require-property": "error",
307
- "jsdoc/require-property-description": "error",
308
- "jsdoc/require-property-name": "error",
309
- "jsdoc/require-returns": "error",
310
- "jsdoc/require-returns-check": "error",
311
- "jsdoc/require-returns-description": "error",
312
- "jsdoc/require-throws": "error",
313
- "jsdoc/require-yields": "error",
314
- "jsdoc/require-yields-check": "error",
315
- "jsdoc/sort-tags": "error",
316
- "jsdoc/tag-lines": "error",
317
- "jsdoc/valid-types": "error",
318
- //#endregion
319
- //#region n
320
- "n/callback-return": "error",
321
- "n/exports-style": ["error", "module.exports"],
322
- "n/hashbang": "error",
323
- "n/no-exports-assign": "error",
324
- "n/no-path-concat": "error",
325
- "n/no-process-env": [
326
- "error",
327
- {
328
- allowedVariables: ["NODE_ENV"],
329
- },
330
- ],
331
- "n/no-unpublished-bin": "error",
332
- "n/no-unsupported-features/es-builtins": "error",
333
- "n/no-unsupported-features/es-syntax": "error",
334
- "n/no-unsupported-features/node-builtins": [
335
- "error",
336
- { allowExperimental: true },
337
- ],
338
- "n/prefer-global/buffer": ["error", "never"],
339
- "n/prefer-global/console": ["error", "always"],
340
- "n/prefer-global/process": ["error", "never"],
341
- "n/prefer-global/text-decoder": ["error", "always"],
342
- "n/prefer-global/text-encoder": ["error", "always"],
343
- "n/prefer-global/url": ["error", "always"],
344
- "n/prefer-global/url-search-params": ["error", "always"],
345
- "n/prefer-node-protocol": "error",
346
- "n/prefer-promises/dns": "error",
347
- "n/prefer-promises/fs": "error",
348
- "n/process-exit-as-throw": "error",
349
- //#endregion
350
- //#region sonarjs
351
- "sonarjs/alt-text": "error",
352
- "sonarjs/anchor-has-content": "error",
353
- "sonarjs/anchor-is-valid": "error",
354
- "sonarjs/anchor-precedence": "error",
355
- "sonarjs/arguments-order": "error",
356
- "sonarjs/arguments-usage": "error",
357
- "sonarjs/array-constructor": "error",
358
- "sonarjs/assertions-in-tests": "error",
359
- "sonarjs/bitwise-operators": "error",
360
- "sonarjs/bool-param-default": "error",
361
- "sonarjs/call-argument-line": "error",
362
- "sonarjs/certificate-transparency": "error",
363
- "sonarjs/class-name": "error",
364
- "sonarjs/class-prototype": "error",
365
- "sonarjs/code-eval": "error",
366
- "sonarjs/cognitive-complexity": ["error", 15], // Measure code readability (the more the code is nested, the more it's difficult to understand)
367
- "sonarjs/comma-or-logical-or-case": "error",
368
- "sonarjs/concise-regex": "error",
369
- "sonarjs/confidential-information-logging": "error",
370
- "sonarjs/constructor-for-side-effects": "error",
371
- "sonarjs/content-length": "error",
372
- "sonarjs/content-security-policy": "error",
373
- "sonarjs/cookie-no-httponly": "error",
374
- "sonarjs/cors": "error",
375
- "sonarjs/csrf": "error",
376
- "sonarjs/cyclomatic-complexity": ["error", { threshold: 10 }], // Measure code testability (the more paths are, the more test cases need to be implemented)
377
- "sonarjs/different-types-comparison": "error",
378
- "sonarjs/disabled-auto-escaping": "error",
379
- "sonarjs/disabled-resource-integrity": "error",
380
- "sonarjs/duplicates-in-character-class": "error",
381
- "sonarjs/elseif-without-else": "error",
382
- "sonarjs/empty-string-repetition": "error",
383
- "sonarjs/encryption-secure-mode": "error",
384
- "sonarjs/existing-groups": "error",
385
- "sonarjs/expression-complexity": ["error", { max: 3 }],
386
- "sonarjs/file-name-differ-from-class": "error",
387
- "sonarjs/file-permissions": "error",
388
- "sonarjs/file-uploads": "error",
389
- "sonarjs/fixme-tag": "error",
390
- "sonarjs/for-in": "error",
391
- "sonarjs/for-loop-increment-sign": "error",
392
- "sonarjs/frame-ancestors": "error",
393
- "sonarjs/function-inside-loop": "error",
394
- "sonarjs/function-name": "error",
395
- "sonarjs/generator-without-yield": "error",
396
- "sonarjs/hashing": "error",
397
- "sonarjs/hidden-files": "error",
398
- "sonarjs/html-has-lang": "error",
399
- "sonarjs/in-operator-type-error": "error",
400
- "sonarjs/inconsistent-function-call": "error",
401
- "sonarjs/index-of-compare-to-positive-number": "error",
402
- "sonarjs/insecure-cookie": "error",
403
- "sonarjs/insecure-jwt-token": "error",
404
- "sonarjs/inverted-assertion-arguments": "error",
405
- "sonarjs/label-has-associated-control": "error",
406
- "sonarjs/label-position": "error",
407
- "sonarjs/link-with-target-blank": "error",
408
- "sonarjs/max-switch-cases": "error",
409
- "sonarjs/media-has-caption": "error",
410
- "sonarjs/misplaced-loop-counter": "error",
411
- "sonarjs/mouse-events-a11y": "error",
412
- "sonarjs/new-cap": "error",
413
- "sonarjs/new-operator-misuse": "error",
414
- "sonarjs/no-accessor-field-mismatch": "error",
415
- "sonarjs/no-all-duplicated-branches": "error",
416
- "sonarjs/no-alphabetical-sort": "error",
417
- "sonarjs/no-angular-bypass-sanitization": "error",
418
- "sonarjs/no-array-delete": "error",
419
- "sonarjs/no-array-index-key": "error",
420
- "sonarjs/no-associative-arrays": "error",
421
- "sonarjs/no-async-constructor": "error",
422
- "sonarjs/no-base-to-string": "error",
423
- "sonarjs/no-case-label-in-switch": "error",
424
- "sonarjs/no-clear-text-protocols": "error",
425
- "sonarjs/no-code-after-done": "error",
426
- "sonarjs/no-collection-size-mischeck": "error",
427
- "sonarjs/no-commented-code": "error",
428
- "sonarjs/no-dead-store": "error",
429
- "sonarjs/no-delete-var": "error",
430
- "sonarjs/no-duplicate-in-composite": "error",
431
- "sonarjs/no-duplicated-branches": "error",
432
- "sonarjs/no-element-overwrite": "error",
433
- "sonarjs/no-empty-after-reluctant": "error",
434
- "sonarjs/no-empty-alternatives": "error",
435
- "sonarjs/no-empty-collection": "error",
436
- "sonarjs/no-empty-group": "error",
437
- "sonarjs/no-empty-test-file": "error",
438
- "sonarjs/no-equals-in-for-termination": "error",
439
- "sonarjs/no-exclusive-tests": "error",
440
- "sonarjs/no-extend-native": "error",
441
- "sonarjs/no-extra-arguments": "error",
442
- "sonarjs/no-global-this": "error",
443
- "sonarjs/no-globals-shadowing": "error",
444
- "sonarjs/no-gratuitous-expressions": "error",
445
- "sonarjs/no-hardcoded-credentials": "error",
446
- "sonarjs/no-hardcoded-ip": "error",
447
- "sonarjs/no-hook-setter-in-body": "error",
448
- "sonarjs/no-identical-conditions": "error",
449
- "sonarjs/no-identical-expressions": "error",
450
- "sonarjs/no-identical-functions": "error",
451
- "sonarjs/no-ignored-exceptions": "error",
452
- "sonarjs/no-ignored-return": "error",
453
- "sonarjs/no-implicit-dependencies": "error",
454
- "sonarjs/no-implicit-global": "error",
455
- "sonarjs/no-in-misuse": "error",
456
- "sonarjs/no-incomplete-assertions": "error",
457
- "sonarjs/no-incorrect-string-concat": "error",
458
- "sonarjs/no-infinite-loop": "error",
459
- "sonarjs/no-internal-api-use": "error",
460
- "sonarjs/no-intrusive-permissions": "error",
461
- "sonarjs/no-invalid-await": "error",
462
- "sonarjs/no-invariant-returns": "error",
463
- "sonarjs/no-inverted-boolean-check": "error",
464
- "sonarjs/no-ip-forward": "error",
465
- "sonarjs/no-labels": "error",
466
- "sonarjs/no-lonely-if": "error",
467
- "sonarjs/no-mime-sniff": "error",
468
- "sonarjs/no-misleading-array-reverse": "error",
469
- "sonarjs/no-misused-promises": "error",
470
- "sonarjs/no-mixed-content": "error",
471
- "sonarjs/no-nested-assignment": "error",
472
- "sonarjs/no-nested-functions": "error",
473
- "sonarjs/no-nested-incdec": "error",
474
- "sonarjs/no-nested-switch": "error",
475
- "sonarjs/no-nested-template-literals": "error",
476
- "sonarjs/no-one-iteration-loop": "error",
477
- "sonarjs/no-os-command-from-path": "error",
478
- "sonarjs/no-parameter-reassignment": "error",
479
- "sonarjs/no-primitive-wrappers": "error",
480
- "sonarjs/no-redundant-assignments": "error",
481
- "sonarjs/no-redundant-boolean": "error",
482
- "sonarjs/no-redundant-jump": "error",
483
- "sonarjs/no-referrer-policy": "error",
484
- "sonarjs/no-same-argument-assert": "error",
485
- "sonarjs/no-selector-parameter": "error",
486
- "sonarjs/no-self-compare": "error",
487
- "sonarjs/no-self-import": "error",
488
- "sonarjs/no-small-switch": "error",
489
- "sonarjs/no-table-as-layout": "error",
490
- "sonarjs/no-undefined-argument": "error",
491
- "sonarjs/no-unenclosed-multiline-block": "error",
492
- "sonarjs/no-uniq-key": "error",
493
- "sonarjs/no-unsafe-unzip": "error",
494
- "sonarjs/no-unstable-nested-components": "error",
495
- "sonarjs/no-unthrown-error": "error",
496
- "sonarjs/no-unused-collection": "error",
497
- "sonarjs/no-useless-call": "error",
498
- "sonarjs/no-useless-increment": "error",
499
- "sonarjs/no-useless-intersection": "error",
500
- "sonarjs/no-useless-react-setstate": "error",
501
- "sonarjs/no-vue-bypass-sanitization": "error",
502
- "sonarjs/no-weak-cipher": "error",
503
- "sonarjs/no-weak-keys": "error",
504
- "sonarjs/non-existent-operator": "error",
505
- "sonarjs/null-dereference": "error",
506
- "sonarjs/object-alt-content": "error",
507
- "sonarjs/os-command": "error",
508
- "sonarjs/post-message": "error",
509
- "sonarjs/prefer-default-last": "error",
510
- "sonarjs/prefer-enum-initializers": "error",
511
- "sonarjs/prefer-function-type": "error",
512
- "sonarjs/prefer-immediate-return": "error",
513
- "sonarjs/prefer-namespace-keyword": "error",
514
- "sonarjs/prefer-object-literal": "error",
515
- "sonarjs/prefer-object-spread": "error",
516
- "sonarjs/prefer-promise-shorthand": "error",
517
- "sonarjs/prefer-single-boolean-return": "error",
518
- "sonarjs/prefer-spread": "error",
519
- "sonarjs/prefer-string-starts-ends-with": "error",
520
- "sonarjs/prefer-type-guard": "error",
521
- "sonarjs/prefer-while": "error",
522
- "sonarjs/production-debug": "error",
523
- "sonarjs/pseudo-random": "error",
524
- "sonarjs/public-static-readonly": "error",
525
- "sonarjs/publicly-writable-directories": "error",
526
- "sonarjs/reduce-initial-value": "error",
527
- "sonarjs/session-regeneration": "error",
528
- "sonarjs/single-char-in-character-classes": "error",
529
- "sonarjs/single-character-alternation": "error",
530
- "sonarjs/sonar-jsx-no-leaked-render": "error",
531
- "sonarjs/sonar-max-lines": ["error", { maximum: 1000 }],
532
- "sonarjs/sonar-max-lines-per-function": ["error", { maximum: 200 }],
533
- "sonarjs/sonar-max-params": ["error", { max: 4 }],
534
- "sonarjs/sonar-no-control-regex": "error",
535
- "sonarjs/sonar-no-empty-character-class": "error",
536
- "sonarjs/sonar-no-fallthrough": "error",
537
- "sonarjs/sonar-no-invalid-regexp": "error",
538
- "sonarjs/sonar-no-magic-numbers": "error",
539
- "sonarjs/sonar-no-misleading-character-class": "error",
540
- "sonarjs/sonar-no-regex-spaces": "error",
541
- "sonarjs/sonar-no-unused-class-component-methods": "error",
542
- "sonarjs/sonar-prefer-regexp-exec": "error",
543
- "sonarjs/sql-queries": "error",
544
- "sonarjs/stable-tests": "error",
545
- "sonarjs/stateful-regex": "error",
546
- "sonarjs/strict-transport-security": "error",
547
- "sonarjs/super-invocation": "error",
548
- "sonarjs/switch-without-default": "error",
549
- "sonarjs/table-header": "error",
550
- "sonarjs/table-header-reference": "error",
551
- "sonarjs/test-check-exception": "error",
552
- "sonarjs/todo-tag": "warn",
553
- "sonarjs/unicode-aware-regex": "error",
554
- "sonarjs/unnecessary-character-escapes": "error",
555
- "sonarjs/unused-named-groups": "error",
556
- "sonarjs/unverified-certificate": "error",
557
- "sonarjs/unverified-hostname": "error",
558
- "sonarjs/updated-loop-counter": "error",
559
- "sonarjs/use-isnan": "error",
560
- "sonarjs/use-type-alias": "error",
561
- "sonarjs/void-use": "error",
562
- "sonarjs/weak-ssl": "error",
563
- "sonarjs/x-powered-by": "error",
564
- "sonarjs/xml-parser-xxe": "error",
565
- //#endregion
566
- //#region sort-keys-custom-order
567
- "sort-keys-custom-order/object-keys": [
568
- "error",
569
- {
570
- orderedKeys: ["id", "key", "name", "title", "label", "description"],
571
- },
572
- ],
573
- "sort-keys-custom-order/type-keys": [
574
- "error",
575
- {
576
- orderedKeys: ["id", "key", "name", "title", "label", "description"],
577
- },
578
- ],
579
- //#endregion
580
- //#region typescript-eslint
581
- "@typescript-eslint/adjacent-overload-signatures": "error",
582
- // https://www.totaltypescript.com/array-types-in-typescript
583
- "@typescript-eslint/array-type": [
584
- "error",
585
- { default: "array", readonly: "array" },
586
- ],
587
- "@typescript-eslint/await-thenable": "error",
588
- "@typescript-eslint/ban-ts-comment": [
589
- "error",
590
- {
591
- "minimumDescriptionLength": 3,
592
- "ts-check": false,
593
- "ts-expect-error": "allow-with-description",
594
- "ts-ignore": "allow-with-description",
595
- "ts-nocheck": "allow-with-description",
596
- },
597
- ],
598
- "@typescript-eslint/class-literal-property-style": ["error", "fields"],
599
- "@typescript-eslint/consistent-generic-constructors": [
600
- "error",
601
- "constructor",
602
- ],
603
- "@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
604
- "@typescript-eslint/consistent-type-assertions": [
605
- "error",
606
- {
607
- assertionStyle: "as",
608
- objectLiteralTypeAssertions: "allow-as-parameter",
609
- },
610
- ],
611
- // https://www.totaltypescript.com/type-vs-interface-which-should-you-use
612
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
613
- "@typescript-eslint/consistent-type-exports": [
614
- "error",
615
- { fixMixedExportsWithInlineTypeSpecifier: false },
616
- ],
617
- "@typescript-eslint/consistent-type-imports": [
618
- "error",
619
- {
620
- disallowTypeAnnotations: true,
621
- fixStyle: "separate-type-imports",
622
- prefer: "type-imports",
623
- },
624
- ],
625
- "@typescript-eslint/explicit-member-accessibility": [
626
- "error",
627
- { accessibility: "explicit" },
628
- ],
629
- "@typescript-eslint/method-signature-style": ["error", "property"],
630
- "@typescript-eslint/no-base-to-string": "error",
631
- "@typescript-eslint/no-confusing-non-null-assertion": "error",
632
- "@typescript-eslint/no-confusing-void-expression": "error",
633
- "@typescript-eslint/no-duplicate-enum-values": "error",
634
- "@typescript-eslint/no-duplicate-type-constituents": "error",
635
- "@typescript-eslint/no-dynamic-delete": "error",
636
- "@typescript-eslint/no-empty-interface": "error",
637
- "@typescript-eslint/no-explicit-any": [
638
- "error",
639
- { fixToUnknown: true, ignoreRestArgs: false },
640
- ],
641
- "@typescript-eslint/no-extra-non-null-assertion": "error",
642
- "@typescript-eslint/no-extraneous-class": "error",
643
- "@typescript-eslint/no-floating-promises": "error",
644
- "@typescript-eslint/no-for-in-array": "error",
645
- "@typescript-eslint/no-import-type-side-effects": "error",
646
- "@typescript-eslint/no-inferrable-types": "error",
647
- "@typescript-eslint/no-invalid-void-type": "error",
648
- "@typescript-eslint/no-meaningless-void-operator": "error",
649
- "@typescript-eslint/no-misused-new": "error",
650
- "@typescript-eslint/no-misused-promises": "error",
651
- "@typescript-eslint/no-mixed-enums": "error",
652
- "@typescript-eslint/no-namespace": "error",
653
- "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
654
- "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
655
- "@typescript-eslint/no-non-null-assertion": "error",
656
- "@typescript-eslint/no-require-imports": "error",
657
- "@typescript-eslint/no-this-alias": "error",
658
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
659
- "@typescript-eslint/no-unnecessary-condition": "error",
660
- "@typescript-eslint/no-unnecessary-qualifier": "error",
661
- "@typescript-eslint/no-unnecessary-type-arguments": "error",
662
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
663
- "@typescript-eslint/no-unnecessary-type-constraint": "error",
664
- "@typescript-eslint/no-unsafe-argument": "error",
665
- "@typescript-eslint/no-unsafe-assignment": "error",
666
- "@typescript-eslint/no-unsafe-call": "error",
667
- "@typescript-eslint/no-unsafe-declaration-merging": "error",
668
- "@typescript-eslint/no-unsafe-enum-comparison": "error",
669
- "@typescript-eslint/no-unsafe-function-type": "error",
670
- "@typescript-eslint/no-unsafe-member-access": "error",
671
- "@typescript-eslint/no-unsafe-return": "error",
672
- "@typescript-eslint/no-useless-empty-export": "error",
673
- "@typescript-eslint/no-wrapper-object-types": "error",
674
- "@typescript-eslint/prefer-as-const": "error",
675
- "@typescript-eslint/prefer-for-of": "error",
676
- "@typescript-eslint/prefer-function-type": "error",
677
- "@typescript-eslint/prefer-includes": "error",
678
- "@typescript-eslint/prefer-literal-enum-member": "error",
679
- "@typescript-eslint/prefer-namespace-keyword": "error",
680
- "@typescript-eslint/prefer-nullish-coalescing": "error",
681
- "@typescript-eslint/prefer-optional-chain": "error",
682
- "@typescript-eslint/prefer-readonly": "error",
683
- "@typescript-eslint/prefer-regexp-exec": "error",
684
- "@typescript-eslint/prefer-return-this-type": "error",
685
- "@typescript-eslint/prefer-string-starts-ends-with": "error",
686
- "@typescript-eslint/class-methods-use-this": "error",
687
- "@typescript-eslint/prefer-ts-expect-error": "error",
688
- "@typescript-eslint/promise-function-async": "error",
689
- "@typescript-eslint/default-param-last": "error",
690
- "@typescript-eslint/restrict-plus-operands": "error",
691
- "@typescript-eslint/restrict-template-expressions": "error",
692
- "@typescript-eslint/dot-notation": "error",
693
- "@typescript-eslint/sort-type-constituents": "error",
694
- "@typescript-eslint/switch-exhaustiveness-check": "error",
695
- "@typescript-eslint/no-array-constructor": "error",
696
- "@typescript-eslint/triple-slash-reference": "error",
697
- "@typescript-eslint/unbound-method": "error",
698
- "@typescript-eslint/no-dupe-class-members": "error",
699
- "@typescript-eslint/unified-signatures": "error",
700
- "@typescript-eslint/no-empty-function": "error",
701
- "@typescript-eslint/no-empty-object-type": "error",
702
- "@typescript-eslint/no-implied-eval": "error",
703
- "@typescript-eslint/no-invalid-this": "error",
704
- "@typescript-eslint/no-deprecated": "error",
705
- "@typescript-eslint/no-loop-func": "error",
706
- "@typescript-eslint/no-loss-of-precision": "error",
707
- "@typescript-eslint/no-shadow": "error",
708
- "@typescript-eslint/return-await": "error",
709
- "@typescript-eslint/only-throw-error": "error",
710
- "@typescript-eslint/require-await": "error",
711
- "@typescript-eslint/no-unused-expressions": "error",
712
- "@typescript-eslint/no-unused-vars": [
713
- "error",
714
- { ignoreRestSiblings: true },
715
- ],
716
- "@typescript-eslint/no-useless-constructor": "error",
717
- //#endregion
718
- },
719
- },
720
- {
721
- files: ["**/*.{js,jsx,cjs,mjs}"],
722
- ...tseslint.configs.disableTypeChecked,
723
- },
724
- {
725
- files: ["**/*.{jsx,tsx}"],
726
- plugins: {
727
- "react": reactPlugin,
728
- "react-hooks": reactHooksPlugin,
729
- },
730
- settings: {
731
- react: {
732
- version: "detect",
733
- },
734
- },
735
- rules: {
736
- "react/boolean-prop-naming": [
737
- "error",
738
- { rule: "^(is|has)[A-Z]([A-Za-z0-9]?)+" },
739
- ],
740
- "react-hooks/exhaustive-deps": "warn",
741
- "react-hooks/rules-of-hooks": "error",
742
- "react/button-has-type": "error",
743
- "react/checked-requires-onchange-or-readonly": "error",
744
- "react/display-name": "error",
745
- "react/forbid-component-props": "error",
746
- "react/forward-ref-uses-ref": "error",
747
- "react/hook-use-state": "error",
748
- "react/iframe-missing-sandbox": "error",
749
- "react/jsx-boolean-value": "error",
750
- "react/jsx-fragments": "error",
751
- "react/jsx-handler-names": "error",
752
- "react/jsx-key": "error",
753
- "react/jsx-no-bind": "error",
754
- "react/jsx-no-constructed-context-values": "error",
755
- "react/jsx-no-leaked-render": "error",
756
- "react/jsx-no-script-url": "error",
757
- "react/jsx-no-target-blank": "error",
758
- "react/jsx-no-useless-fragment": "error",
759
- "react/jsx-pascal-case": "error",
760
- "react/jsx-props-no-spread-multi": "error",
761
- "react/jsx-sort-props": "error",
762
- "react/jsx-uses-react": "error",
763
- "react/jsx-uses-vars": "error",
764
- "react/no-access-state-in-setstate": "error",
765
- "react/no-array-index-key": "error",
766
- "react/no-arrow-function-lifecycle": "error",
767
- "react/no-children-prop": "error",
768
- "react/no-danger-with-children": "error",
769
- "react/no-did-mount-set-state": "error",
770
- "react/no-did-update-set-state": "error",
771
- "react/no-direct-mutation-state": "error",
772
- "react/no-find-dom-node": "error",
773
- "react/no-is-mounted": "error",
774
- "react/no-namespace": "error",
775
- "react/no-object-type-as-default-prop": "error",
776
- "react/no-redundant-should-component-update": "error",
777
- "react/no-render-return-value": "error",
778
- "react/no-string-refs": "error",
779
- "react/no-this-in-sfc": "error",
780
- "react/no-typos": "error",
781
- "react/no-unescaped-entities": "error",
782
- "react/no-unsafe": "error",
783
- "react/no-unstable-nested-components": "error",
784
- "react/no-unused-class-component-methods": "error",
785
- "react/no-unused-state": "error",
786
- "react/no-will-update-set-state": "error",
787
- "react/prefer-read-only-props": "error",
788
- "react/prefer-stateless-function": "error",
789
- "react/self-closing-comp": "error",
790
- "react/style-prop-object": "error",
791
- "react/void-dom-elements-no-children": "error",
792
- },
793
- },
794
- {
795
- files: [
796
- "**/test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
797
- "**/*.test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
798
- ],
799
- plugins: {
800
- "jest-formatting": jestFormattingPlugin,
801
- "vitest": vitestPlugin,
802
- },
803
- rules: {
804
- "jest-formatting/padding-around-all": "error",
805
- "vitest/consistent-test-it": [
806
- "error",
807
- { fn: "test", withinDescribe: "test" },
808
- ],
809
- "vitest/expect-expect": "error",
810
- "vitest/max-nested-describe": ["error", { max: 1 }],
811
- "vitest/no-alias-methods": "error",
812
- "vitest/no-commented-out-tests": "error",
813
- "vitest/no-conditional-expect": "error",
814
- "vitest/no-conditional-in-test": "error",
815
- "vitest/no-conditional-tests": "error",
816
- "vitest/no-disabled-tests": "error",
817
- "vitest/no-done-callback": "error",
818
- "vitest/no-duplicate-hooks": "error",
819
- "vitest/no-focused-tests": "error",
820
- "vitest/no-identical-title": "error",
821
- "vitest/no-import-node-test": "error",
822
- "vitest/no-mocks-import": "error",
823
- "vitest/no-standalone-expect": "error",
824
- "vitest/no-test-return-statement": "error",
825
- "vitest/prefer-called-with": "error",
826
- "vitest/prefer-comparison-matcher": "error",
827
- "vitest/prefer-each": "error",
828
- "vitest/prefer-equality-matcher": "error",
829
- "vitest/prefer-hooks-in-order": "error",
830
- "vitest/prefer-hooks-on-top": "error",
831
- "vitest/prefer-lowercase-title": "error",
832
- "vitest/prefer-mock-promise-shorthand": "error",
833
- "vitest/prefer-strict-equal": "error",
834
- "vitest/prefer-to-be": "error",
835
- "vitest/prefer-to-be-object": "error",
836
- "vitest/prefer-to-contain": "error",
837
- "vitest/prefer-to-have-length": "error",
838
- "vitest/prefer-todo": "error",
839
- "vitest/require-hook": "error",
840
- "vitest/require-local-test-context-for-concurrent-snapshots": "error",
841
- "vitest/require-to-throw-message": "error",
842
- "vitest/require-top-level-describe": "error",
843
- "vitest/valid-describe-callback": "error",
844
- "vitest/valid-expect": "error",
845
- "vitest/valid-title": ["error", { mustMatch: { test: ["^should "] } }],
846
- },
847
- },
848
- ...new FlatCompat().extends("plugin:mdx/recommended").map((config) => ({
849
- ...config,
850
- files: ["**/*.{md,mdx}"],
851
- settings: {
852
- "mdx/code-blocks": true,
853
- },
854
- })),
855
- {
856
- // Relaxed rules for example-like folder, and [config-, story-, and test]-like files
857
- files: [
858
- "**/.config/**",
859
- "**/config/**",
860
- "**/examples/**",
861
- "**/scripts/**",
862
- "**/website/**",
863
- "**/config.{js,ts,cjs,cts,mjs,mts}",
864
- "**/*.config.{js,ts,cjs,cts,mjs,mts}",
865
- "**/stories.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
866
- "**/*.stories.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
867
- "**/test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
868
- "**/*.test.{js,ts,jsx,tsx,cjs,cts,mjs,mts}",
869
- ],
870
- rules: {
871
- "import-x/no-anonymous-default-export": "off",
872
- "import-x/no-default-export": "off",
873
- "sonarjs/sonar-no-magic-numbers": "off",
874
- },
875
- },
876
- eslintPluginPrettierRecommended,
877
- );