@nelsonlaidev/oxlint-config 0.4.0 → 1.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/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { mergeWith, pick } from "es-toolkit/object";
2
- import { isPackageExists } from "local-pkg";
1
+ import { merge } from "ts-deepmerge";
3
2
  //#region src/globs.ts
4
3
  const GLOB_SRC_EXT = "{js,jsx,ts,tsx,cjs,cts,mjs,mts}";
5
4
  const GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
@@ -9,17 +8,17 @@ const GLOB_TS = "**/*.{ts,cts,mts}";
9
8
  const GLOB_TSX = "**/*.{tsx,ctsx,mtsx}";
10
9
  //#endregion
11
10
  //#region src/configs/command.ts
12
- const command = () => [{
11
+ const command = () => ({
13
12
  files: [GLOB_SRC],
14
13
  jsPlugins: [{
15
14
  name: "command",
16
15
  specifier: "eslint-plugin-command"
17
16
  }],
18
17
  rules: { "command/command": "error" }
19
- }];
18
+ });
20
19
  //#endregion
21
20
  //#region src/configs/de-morgan.ts
22
- const deMorgan = () => [{
21
+ const deMorgan = () => ({
23
22
  files: [GLOB_SRC],
24
23
  jsPlugins: [{
25
24
  name: "de-morgan",
@@ -29,10 +28,10 @@ const deMorgan = () => [{
29
28
  "de-morgan/no-negated-conjunction": "error",
30
29
  "de-morgan/no-negated-disjunction": "error"
31
30
  }
32
- }];
31
+ });
33
32
  //#endregion
34
33
  //#region src/configs/eslint.ts
35
- const eslint = () => [{
34
+ const eslint = () => ({
36
35
  files: [GLOB_SRC],
37
36
  plugins: ["eslint"],
38
37
  rules: {
@@ -130,10 +129,10 @@ const eslint = () => [{
130
129
  "eslint/use-isnan": "error",
131
130
  "eslint/valid-typeof": "error"
132
131
  }
133
- }];
132
+ });
134
133
  //#endregion
135
134
  //#region src/configs/import-sort.ts
136
- const importSort = () => [{
135
+ const importSort = () => ({
137
136
  files: [GLOB_SRC],
138
137
  jsPlugins: [{
139
138
  name: "import-sort",
@@ -160,10 +159,10 @@ const importSort = () => [{
160
159
  ["^\\.\\.", "^\\."]
161
160
  ] }]
162
161
  }
163
- }];
162
+ });
164
163
  //#endregion
165
164
  //#region src/configs/imports.ts
166
- const imports = () => [{
165
+ const imports = () => ({
167
166
  files: [GLOB_SRC],
168
167
  plugins: ["import"],
169
168
  rules: {
@@ -188,20 +187,20 @@ const imports = () => [{
188
187
  "import/no-self-import": "error",
189
188
  "import/no-webpack-loader-syntax": "error"
190
189
  }
191
- }];
190
+ });
192
191
  //#endregion
193
192
  //#region src/configs/jsdoc.ts
194
- const jsdoc = () => [{
193
+ const jsdoc = () => ({
195
194
  files: [GLOB_SRC],
196
195
  plugins: ["jsdoc"],
197
196
  rules: {
198
197
  "jsdoc/check-tag-names": "error",
199
198
  "jsdoc/empty-tags": "error"
200
199
  }
201
- }];
200
+ });
202
201
  //#endregion
203
202
  //#region src/configs/jsx-a11y.ts
204
- const jsxA11y = () => [{
203
+ const jsxA11y = () => ({
205
204
  files: [GLOB_SRC],
206
205
  plugins: ["jsx-a11y"],
207
206
  rules: {
@@ -351,10 +350,10 @@ const jsxA11y = () => [{
351
350
  "jsx-a11y/scope": "error",
352
351
  "jsx-a11y/tabindex-no-positive": "error"
353
352
  }
354
- }];
353
+ });
355
354
  //#endregion
356
355
  //#region src/configs/nelsonlaidev.ts
357
- const nelsonlaidev = () => [{
356
+ const nelsonlaidev = () => ({
358
357
  files: [GLOB_SRC],
359
358
  jsPlugins: [{
360
359
  name: "nelsonlaidev",
@@ -367,49 +366,20 @@ const nelsonlaidev = () => [{
367
366
  "nelsonlaidev/shadcn-cva-variants-suffix": "error",
368
367
  "nelsonlaidev/shadcn-prefer-spinner": "error"
369
368
  }
370
- }];
371
- //#endregion
372
- //#region src/configs/nextjs.ts
373
- const nextjs = () => [{
374
- files: [GLOB_SRC],
375
- plugins: ["nextjs"],
376
- rules: {
377
- "nextjs/google-font-display": "error",
378
- "nextjs/google-font-preconnect": "error",
379
- "nextjs/inline-script-id": "error",
380
- "nextjs/next-script-for-ga": "error",
381
- "nextjs/no-assign-module-variable": "error",
382
- "nextjs/no-async-client-component": "error",
383
- "nextjs/no-before-interactive-script-outside-document": "error",
384
- "nextjs/no-css-tags": "error",
385
- "nextjs/no-document-import-in-page": "error",
386
- "nextjs/no-duplicate-head": "error",
387
- "nextjs/no-head-element": "error",
388
- "nextjs/no-head-import-in-document": "error",
389
- "nextjs/no-html-link-for-pages": "error",
390
- "nextjs/no-img-element": "error",
391
- "nextjs/no-page-custom-font": "error",
392
- "nextjs/no-script-component-in-head": "error",
393
- "nextjs/no-styled-jsx-in-document": "error",
394
- "nextjs/no-sync-scripts": "error",
395
- "nextjs/no-title-in-document-head": "error",
396
- "nextjs/no-typos": "error",
397
- "nextjs/no-unwanted-polyfillio": "error"
398
- }
399
- }];
369
+ });
400
370
  //#endregion
401
371
  //#region src/configs/node.ts
402
- const node = () => [{
372
+ const node = () => ({
403
373
  files: [GLOB_SRC],
404
374
  plugins: ["node"],
405
375
  rules: {
406
376
  "node/no-exports-assign": "error",
407
377
  "node/no-path-concat": "error"
408
378
  }
409
- }];
379
+ });
410
380
  //#endregion
411
381
  //#region src/configs/oxc.ts
412
- const oxc = () => [{
382
+ const oxc = () => ({
413
383
  files: [GLOB_SRC],
414
384
  plugins: ["oxc"],
415
385
  rules: {
@@ -435,60 +405,10 @@ const oxc = () => [{
435
405
  "oxc/only-used-in-recursion": "error",
436
406
  "oxc/uninvoked-array-callback": "error"
437
407
  }
438
- }];
439
- //#endregion
440
- //#region src/configs/playwright.ts
441
- const playwright = (config) => [{
442
- files: config.files,
443
- jsPlugins: [{
444
- name: "playwright",
445
- specifier: "eslint-plugin-playwright"
446
- }],
447
- rules: {
448
- "eslint/no-empty-pattern": "off",
449
- "playwright/consistent-spacing-between-blocks": "error",
450
- "playwright/expect-expect": ["error", {
451
- assertFunctionNames: config.assertFunctionNames ?? [],
452
- assertFunctionPatterns: config.assertFunctionPatterns ?? []
453
- }],
454
- "playwright/max-nested-describe": "error",
455
- "playwright/missing-playwright-await": "error",
456
- "playwright/no-conditional-expect": "error",
457
- "playwright/no-conditional-in-test": "error",
458
- "playwright/no-duplicate-hooks": "error",
459
- "playwright/no-duplicate-slow": "error",
460
- "playwright/no-element-handle": "error",
461
- "playwright/no-eval": "error",
462
- "playwright/no-focused-test": "error",
463
- "playwright/no-force-option": "error",
464
- "playwright/no-nested-step": "error",
465
- "playwright/no-networkidle": "error",
466
- "playwright/no-page-pause": "error",
467
- "playwright/no-skipped-test": "error",
468
- "playwright/no-standalone-expect": "error",
469
- "playwright/no-unsafe-references": "error",
470
- "playwright/no-unused-locators": "error",
471
- "playwright/no-useless-await": "error",
472
- "playwright/no-useless-not": "error",
473
- "playwright/no-wait-for-navigation": "error",
474
- "playwright/no-wait-for-selector": "error",
475
- "playwright/no-wait-for-timeout": "error",
476
- "playwright/prefer-hooks-in-order": "error",
477
- "playwright/prefer-hooks-on-top": "error",
478
- "playwright/prefer-locator": "error",
479
- "playwright/prefer-to-have-count": "error",
480
- "playwright/prefer-to-have-length": "error",
481
- "playwright/prefer-web-first-assertions": "error",
482
- "playwright/valid-describe-callback": "error",
483
- "playwright/valid-expect": "error",
484
- "playwright/valid-expect-in-promise": "error",
485
- "playwright/valid-test-tags": "error",
486
- "playwright/valid-title": "error"
487
- }
488
- }];
408
+ });
489
409
  //#endregion
490
410
  //#region src/configs/promise.ts
491
- const promise = () => [{
411
+ const promise = () => ({
492
412
  files: [GLOB_SRC],
493
413
  plugins: ["promise"],
494
414
  rules: {
@@ -509,123 +429,10 @@ const promise = () => [{
509
429
  "promise/spec-only": "error",
510
430
  "promise/valid-params": "error"
511
431
  }
512
- }];
513
- //#endregion
514
- //#region src/configs/react.ts
515
- const react = () => [{
516
- files: [GLOB_SRC],
517
- jsPlugins: [{
518
- name: "@eslint-react",
519
- specifier: "@eslint-react/eslint-plugin"
520
- }, {
521
- name: "react-hooks-js",
522
- specifier: "eslint-plugin-react-hooks"
523
- }],
524
- rules: {
525
- "@eslint-react/dom-no-dangerously-set-innerhtml": "error",
526
- "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": "error",
527
- "@eslint-react/dom-no-find-dom-node": "error",
528
- "@eslint-react/dom-no-flush-sync": "error",
529
- "@eslint-react/dom-no-hydrate": "error",
530
- "@eslint-react/dom-no-missing-button-type": "error",
531
- "@eslint-react/dom-no-missing-iframe-sandbox": "error",
532
- "@eslint-react/dom-no-render": "error",
533
- "@eslint-react/dom-no-render-return-value": "error",
534
- "@eslint-react/dom-no-script-url": "error",
535
- "@eslint-react/dom-no-string-style-prop": "error",
536
- "@eslint-react/dom-no-unknown-property": "error",
537
- "@eslint-react/dom-no-unsafe-iframe-sandbox": "error",
538
- "@eslint-react/dom-no-unsafe-target-blank": "error",
539
- "@eslint-react/dom-no-use-form-state": "error",
540
- "@eslint-react/dom-no-void-elements-with-children": "error",
541
- "@eslint-react/error-boundaries": "error",
542
- "@eslint-react/exhaustive-deps": "error",
543
- "@eslint-react/globals": "error",
544
- "@eslint-react/immutability": "error",
545
- "@eslint-react/jsx-no-children-prop": "error",
546
- "@eslint-react/jsx-no-children-prop-with-children": "error",
547
- "@eslint-react/jsx-no-comment-textnodes": "error",
548
- "@eslint-react/jsx-no-key-after-spread": "error",
549
- "@eslint-react/jsx-no-leaked-dollar": "error",
550
- "@eslint-react/jsx-no-leaked-semicolon": "error",
551
- "@eslint-react/jsx-no-namespace": "error",
552
- "@eslint-react/jsx-no-useless-fragment": "error",
553
- "@eslint-react/naming-convention-context-name": "error",
554
- "@eslint-react/naming-convention-id-name": "error",
555
- "@eslint-react/naming-convention-ref-name": "error",
556
- "@eslint-react/no-access-state-in-setstate": "error",
557
- "@eslint-react/no-array-index-key": "error",
558
- "@eslint-react/no-children-count": "error",
559
- "@eslint-react/no-children-for-each": "error",
560
- "@eslint-react/no-children-map": "error",
561
- "@eslint-react/no-children-only": "error",
562
- "@eslint-react/no-children-to-array": "error",
563
- "@eslint-react/no-class-component": "error",
564
- "@eslint-react/no-clone-element": "error",
565
- "@eslint-react/no-component-will-mount": "error",
566
- "@eslint-react/no-component-will-receive-props": "error",
567
- "@eslint-react/no-component-will-update": "error",
568
- "@eslint-react/no-context-provider": "error",
569
- "@eslint-react/no-create-ref": "error",
570
- "@eslint-react/no-direct-mutation-state": "error",
571
- "@eslint-react/no-duplicate-key": "error",
572
- "@eslint-react/no-forward-ref": "error",
573
- "@eslint-react/no-missing-component-display-name": "error",
574
- "@eslint-react/no-missing-context-display-name": "error",
575
- "@eslint-react/no-missing-key": "error",
576
- "@eslint-react/no-misused-capture-owner-stack": "error",
577
- "@eslint-react/no-nested-component-definitions": "error",
578
- "@eslint-react/no-nested-lazy-component-declarations": "error",
579
- "@eslint-react/no-set-state-in-component-did-mount": "error",
580
- "@eslint-react/no-set-state-in-component-did-update": "error",
581
- "@eslint-react/no-set-state-in-component-will-update": "error",
582
- "@eslint-react/no-unnecessary-use-prefix": "error",
583
- "@eslint-react/no-unsafe-component-will-mount": "error",
584
- "@eslint-react/no-unsafe-component-will-receive-props": "error",
585
- "@eslint-react/no-unsafe-component-will-update": "error",
586
- "@eslint-react/no-unstable-context-value": "error",
587
- "@eslint-react/no-unstable-default-props": "error",
588
- "@eslint-react/no-unused-class-component-members": "error",
589
- "@eslint-react/no-unused-state": "error",
590
- "@eslint-react/no-use-context": "error",
591
- "@eslint-react/purity": "error",
592
- "@eslint-react/refs": "error",
593
- "@eslint-react/rsc-function-definition": "error",
594
- "@eslint-react/rules-of-hooks": "error",
595
- "@eslint-react/set-state-in-effect": "error",
596
- "@eslint-react/set-state-in-render": "error",
597
- "@eslint-react/static-components": "off",
598
- "@eslint-react/unsupported-syntax": "error",
599
- "@eslint-react/use-memo": "error",
600
- "@eslint-react/use-state": "error",
601
- "@eslint-react/web-api-no-leaked-event-listener": "error",
602
- "@eslint-react/web-api-no-leaked-fetch": "error",
603
- "@eslint-react/web-api-no-leaked-intersection-observer": "error",
604
- "@eslint-react/web-api-no-leaked-interval": "error",
605
- "@eslint-react/web-api-no-leaked-resize-observer": "error",
606
- "@eslint-react/web-api-no-leaked-timeout": "error",
607
- "react-hooks-js/config": "error",
608
- "react-hooks-js/error-boundaries": "off",
609
- "react-hooks-js/exhaustive-deps": "off",
610
- "react-hooks-js/gating": "error",
611
- "react-hooks-js/globals": "off",
612
- "react-hooks-js/immutability": "off",
613
- "react-hooks-js/incompatible-library": "error",
614
- "react-hooks-js/preserve-manual-memoization": "error",
615
- "react-hooks-js/purity": "off",
616
- "react-hooks-js/refs": "off",
617
- "react-hooks-js/rules-of-hooks": "off",
618
- "react-hooks-js/set-state-in-effect": "off",
619
- "react-hooks-js/set-state-in-render": "off",
620
- "react-hooks-js/static-components": "off",
621
- "react-hooks-js/unsupported-syntax": "off",
622
- "react-hooks-js/use-memo": "off",
623
- "react-hooks-js/void-use-memo": "error"
624
- }
625
- }];
432
+ });
626
433
  //#endregion
627
434
  //#region src/configs/regexp.ts
628
- const regexp = () => [{
435
+ const regexp = () => ({
629
436
  files: [GLOB_SRC],
630
437
  jsPlugins: [{
631
438
  name: "regexp",
@@ -700,10 +507,10 @@ const regexp = () => [{
700
507
  "regexp/strict": "error",
701
508
  "regexp/use-ignore-case": "error"
702
509
  }
703
- }];
510
+ });
704
511
  //#endregion
705
512
  //#region src/configs/sonarjs.ts
706
- const sonarjs = () => [{
513
+ const sonarjs = () => ({
707
514
  files: [GLOB_SRC],
708
515
  jsPlugins: [{
709
516
  name: "sonarjs",
@@ -717,6 +524,7 @@ const sonarjs = () => [{
717
524
  "sonarjs/array-callback-without-return": "error",
718
525
  "sonarjs/array-constructor": "off",
719
526
  "sonarjs/arrow-function-convention": "off",
527
+ "sonarjs/assertions-in-test-cases": "error",
720
528
  "sonarjs/assertions-in-tests": "off",
721
529
  "sonarjs/async-test-assertions": "error",
722
530
  "sonarjs/aws-apigateway-public-api": "error",
@@ -772,6 +580,7 @@ const sonarjs = () => [{
772
580
  "sonarjs/empty-string-repetition": "error",
773
581
  "sonarjs/encryption-secure-mode": "error",
774
582
  "sonarjs/existing-groups": "error",
583
+ "sonarjs/explicit-test-skip": "error",
775
584
  "sonarjs/expression-complexity": "off",
776
585
  "sonarjs/file-header": "off",
777
586
  "sonarjs/file-name-differ-from-class": "off",
@@ -803,6 +612,7 @@ const sonarjs = () => [{
803
612
  "sonarjs/max-lines-per-function": "off",
804
613
  "sonarjs/max-switch-cases": "error",
805
614
  "sonarjs/max-union-size": "off",
615
+ "sonarjs/memoize-cache-key": "error",
806
616
  "sonarjs/misplaced-loop-counter": "error",
807
617
  "sonarjs/nested-control-flow": "off",
808
618
  "sonarjs/new-operator-misuse": "error",
@@ -821,6 +631,8 @@ const sonarjs = () => [{
821
631
  "sonarjs/no-commented-code": "off",
822
632
  "sonarjs/no-control-regex": "error",
823
633
  "sonarjs/no-dead-store": "error",
634
+ "sonarjs/no-debug-commands-in-ui-tests": "error",
635
+ "sonarjs/no-default-utility-imports": "error",
824
636
  "sonarjs/no-delete-var": "error",
825
637
  "sonarjs/no-duplicate-in-composite": "error",
826
638
  "sonarjs/no-duplicate-string": "off",
@@ -838,6 +650,7 @@ const sonarjs = () => [{
838
650
  "sonarjs/no-exclusive-tests": "error",
839
651
  "sonarjs/no-extra-arguments": "error",
840
652
  "sonarjs/no-fallthrough": "error",
653
+ "sonarjs/no-fixed-wait-in-tests": "error",
841
654
  "sonarjs/no-floating-point-equality": "error",
842
655
  "sonarjs/no-for-in-iterable": "off",
843
656
  "sonarjs/no-forced-browser-interaction": "error",
@@ -862,6 +675,7 @@ const sonarjs = () => [{
862
675
  "sonarjs/no-inconsistent-returns": "off",
863
676
  "sonarjs/no-incorrect-string-concat": "off",
864
677
  "sonarjs/no-internal-api-use": "error",
678
+ "sonarjs/no-interpolation-in-inline-snapshots": "error",
865
679
  "sonarjs/no-intrusive-permissions": "off",
866
680
  "sonarjs/no-invalid-regexp": "error",
867
681
  "sonarjs/no-invariant-returns": "error",
@@ -872,6 +686,7 @@ const sonarjs = () => [{
872
686
  "sonarjs/no-mime-sniff": "error",
873
687
  "sonarjs/no-misleading-array-reverse": "error",
874
688
  "sonarjs/no-misleading-character-class": "error",
689
+ "sonarjs/no-mixed-completion-style": "error",
875
690
  "sonarjs/no-mixed-content": "off",
876
691
  "sonarjs/no-nested-assignment": "error",
877
692
  "sonarjs/no-nested-conditional": "error",
@@ -927,9 +742,11 @@ const sonarjs = () => [{
927
742
  "sonarjs/object-alt-content": "error",
928
743
  "sonarjs/operation-returning-nan": "off",
929
744
  "sonarjs/os-command": "off",
745
+ "sonarjs/parameterized-tests": "error",
930
746
  "sonarjs/post-message": "error",
931
747
  "sonarjs/prefer-default-last": "error",
932
748
  "sonarjs/prefer-immediate-return": "off",
749
+ "sonarjs/prefer-native-lodash-alternative": "error",
933
750
  "sonarjs/prefer-object-literal": "off",
934
751
  "sonarjs/prefer-promise-shorthand": "error",
935
752
  "sonarjs/prefer-read-only-props": "off",
@@ -957,6 +774,7 @@ const sonarjs = () => [{
957
774
  "sonarjs/strict-transport-security": "error",
958
775
  "sonarjs/strings-comparison": "off",
959
776
  "sonarjs/super-linear-regex": "error",
777
+ "sonarjs/synchronous-suite-callback": "error",
960
778
  "sonarjs/table-header": "error",
961
779
  "sonarjs/table-header-reference": "error",
962
780
  "sonarjs/test-check-exception": "error",
@@ -979,52 +797,20 @@ const sonarjs = () => [{
979
797
  "sonarjs/x-powered-by": "error",
980
798
  "sonarjs/xml-parser-xxe": "error"
981
799
  }
982
- }];
800
+ });
983
801
  //#endregion
984
802
  //#region src/configs/stylistic.ts
985
- const stylistic = () => [{
803
+ const stylistic = () => ({
986
804
  files: [GLOB_SRC],
987
805
  jsPlugins: [{
988
806
  name: "@stylistic",
989
807
  specifier: "@stylistic/eslint-plugin"
990
808
  }],
991
809
  rules: { "@stylistic/multiline-comment-style": ["error", "separate-lines"] }
992
- }];
993
- //#endregion
994
- //#region src/configs/tailwindcss.ts
995
- const tailwindcss = (options) => [{
996
- files: [GLOB_SRC],
997
- jsPlugins: [{
998
- name: "better-tailwindcss",
999
- specifier: "eslint-plugin-better-tailwindcss"
1000
- }],
1001
- rules: {
1002
- "better-tailwindcss/enforce-canonical-classes": ["error", {
1003
- collapse: options.canonical?.collapse ?? true,
1004
- logical: options.canonical?.logical ?? true
1005
- }],
1006
- "better-tailwindcss/enforce-consistent-class-order": ["error", {
1007
- order: options.classOrder?.order ?? "official",
1008
- componentClassOrder: options.classOrder?.componentOrder ?? "preserve",
1009
- componentClassPosition: options.classOrder?.componentPosition ?? "start",
1010
- unknownClassOrder: options.classOrder?.unknownOrder ?? "preserve",
1011
- unknownClassPosition: options.classOrder?.unknownPosition ?? "start"
1012
- }],
1013
- "better-tailwindcss/enforce-consistent-important-position": "off",
1014
- "better-tailwindcss/enforce-consistent-variable-syntax": "off",
1015
- "better-tailwindcss/enforce-consistent-variant-order": "error",
1016
- "better-tailwindcss/enforce-shorthand-classes": options.canonical?.logical ?? true ? "off" : "error",
1017
- "better-tailwindcss/no-conflicting-classes": "error",
1018
- "better-tailwindcss/no-deprecated-classes": "error",
1019
- "better-tailwindcss/no-duplicate-classes": "error",
1020
- "better-tailwindcss/no-restricted-classes": ["error", { restrict: options.restrict ?? [] }],
1021
- "better-tailwindcss/no-unknown-classes": ["error", { ignore: options.ignore ?? [] }],
1022
- "better-tailwindcss/no-unnecessary-whitespace": ["error", { allowMultiline: options.whitespace?.allowMultiline ?? true }]
1023
- }
1024
- }];
810
+ });
1025
811
  //#endregion
1026
812
  //#region src/configs/typescript.ts
1027
- const typescript = () => [{
813
+ const typescript = () => ({
1028
814
  files: [GLOB_SRC],
1029
815
  plugins: ["typescript", "eslint"],
1030
816
  rules: {
@@ -1162,17 +948,18 @@ const typescript = () => [{
1162
948
  "typescript/unified-signatures": "error",
1163
949
  "typescript/use-unknown-in-catch-callback-variable": "error"
1164
950
  }
1165
- }, {
951
+ });
952
+ const typescriptDeclarations = () => ({
1166
953
  files: ["**/*.d.ts"],
1167
954
  plugins: ["typescript"],
1168
955
  rules: {
1169
956
  "typescript/consistent-indexed-object-style": "off",
1170
957
  "typescript/consistent-type-definitions": "off"
1171
958
  }
1172
- }];
959
+ });
1173
960
  //#endregion
1174
961
  //#region src/configs/unicorn.ts
1175
- const unicorn = () => [{
962
+ const unicorn = () => ({
1176
963
  files: [GLOB_SRC],
1177
964
  plugins: ["unicorn", "eslint"],
1178
965
  rules: {
@@ -1191,6 +978,7 @@ const unicorn = () => [{
1191
978
  "unicorn/error-message": "error",
1192
979
  "unicorn/escape-case": "error",
1193
980
  "unicorn/explicit-length-check": "error",
981
+ "unicorn/explicit-timer-delay": "error",
1194
982
  "unicorn/filename-case": "error",
1195
983
  "unicorn/import-style": "error",
1196
984
  "unicorn/max-nested-calls": "off",
@@ -1206,6 +994,7 @@ const unicorn = () => [{
1206
994
  "unicorn/no-array-sort": "error",
1207
995
  "unicorn/no-await-expression-member": "error",
1208
996
  "unicorn/no-await-in-promise-methods": "error",
997
+ "unicorn/no-confusing-array-with": "error",
1209
998
  "unicorn/no-console-spaces": "error",
1210
999
  "unicorn/no-document-cookie": "off",
1211
1000
  "unicorn/no-empty-file": "error",
@@ -1311,76 +1100,21 @@ const unicorn = () => [{
1311
1100
  "unicorn/text-encoding-identifier-case": ["error", { withDash: true }],
1312
1101
  "unicorn/throw-new-error": "error"
1313
1102
  }
1314
- }];
1315
- //#endregion
1316
- //#region src/configs/vitest.ts
1317
- const vitest = (config) => [{
1318
- files: config.files,
1319
- plugins: ["vitest"],
1320
- rules: {
1321
- "vitest/consistent-test-it": ["error", { fn: "test" }],
1322
- "vitest/expect-expect": "error",
1323
- "vitest/no-commented-out-tests": "error",
1324
- "vitest/no-conditional-expect": "error",
1325
- "vitest/no-disabled-tests": "error",
1326
- "vitest/no-focused-tests": "error",
1327
- "vitest/no-identical-title": "error",
1328
- "vitest/no-import-node-test": "error",
1329
- "vitest/no-interpolation-in-snapshots": "error",
1330
- "vitest/no-mocks-import": "error",
1331
- "vitest/no-standalone-expect": "error",
1332
- "vitest/no-unneeded-async-expect-function": "error",
1333
- "vitest/prefer-called-exactly-once-with": "error",
1334
- "vitest/prefer-mock-return-shorthand": "error",
1335
- "vitest/require-local-test-context-for-concurrent-snapshots": "error",
1336
- "vitest/valid-describe-callback": "error",
1337
- "vitest/valid-expect": "error",
1338
- "vitest/valid-expect-in-promise": "error",
1339
- "vitest/valid-title": "error",
1340
- "vitest/warn-todo": "error"
1341
- }
1342
- }];
1103
+ });
1343
1104
  //#endregion
1344
1105
  //#region src/configs/zod.ts
1345
- const zod = () => [{
1106
+ const zod = () => ({
1346
1107
  files: [GLOB_SRC],
1347
1108
  jsPlugins: [{
1348
1109
  name: "import-zod",
1349
1110
  specifier: "eslint-plugin-import-zod"
1350
1111
  }],
1351
1112
  rules: { "import-zod/prefer-zod-namespace": "error" }
1352
- }];
1113
+ });
1353
1114
  //#endregion
1354
1115
  //#region src/base.ts
1355
- const concatArrays = (target, source) => {
1356
- if (Array.isArray(target) && Array.isArray(source)) return [...target, ...source];
1357
- };
1358
- const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1359
- const overrides = [
1360
- ...oxc(),
1361
- ...eslint(),
1362
- ...command(),
1363
- ...typescript(),
1364
- ...unicorn(),
1365
- ...promise(),
1366
- ...node(),
1367
- ...jsxA11y(),
1368
- ...imports(),
1369
- ...jsdoc(),
1370
- ...nelsonlaidev(),
1371
- ...stylistic(),
1372
- ...deMorgan(),
1373
- ...zod(),
1374
- ...regexp(),
1375
- ...sonarjs(),
1376
- ...importSort()
1377
- ];
1378
- if (userConfig.react ?? isPackageExists("react")) overrides.push(...react());
1379
- if (userConfig.nextjs ?? isPackageExists("next")) overrides.push(...nextjs());
1380
- if (userConfig.vitest) overrides.push(...vitest(userConfig.vitest));
1381
- if (userConfig.playwright) overrides.push(...playwright(userConfig.playwright));
1382
- if (userConfig.tailwindcss) overrides.push(...tailwindcss(userConfig.tailwindcss));
1383
- return mergeWith({
1116
+ const defineConfig = (config = {}) => {
1117
+ return merge({
1384
1118
  options: {
1385
1119
  typeAware: true,
1386
1120
  maxWarnings: 0,
@@ -1393,7 +1127,26 @@ const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1393
1127
  es2022: true
1394
1128
  },
1395
1129
  ignorePatterns: ["**/routeTree.gen.ts"],
1396
- overrides,
1130
+ overrides: [
1131
+ oxc(),
1132
+ eslint(),
1133
+ command(),
1134
+ typescript(),
1135
+ typescriptDeclarations(),
1136
+ unicorn(),
1137
+ promise(),
1138
+ node(),
1139
+ jsxA11y(),
1140
+ imports(),
1141
+ jsdoc(),
1142
+ nelsonlaidev(),
1143
+ stylistic(),
1144
+ deMorgan(),
1145
+ zod(),
1146
+ regexp(),
1147
+ sonarjs(),
1148
+ importSort()
1149
+ ],
1397
1150
  settings: {
1398
1151
  "jsx-a11y": { components: {
1399
1152
  Button: "button",
@@ -1402,29 +1155,280 @@ const defineConfig = ({ config = {}, custom: userConfig = {} } = {}) => {
1402
1155
  Textarea: "textarea",
1403
1156
  Link: "a"
1404
1157
  } },
1405
- ...userConfig.tailwindcss && { "better-tailwindcss": {
1158
+ "better-tailwindcss": {
1406
1159
  detectComponentClasses: false,
1407
1160
  rootFontSize: 16
1408
- } }
1161
+ }
1409
1162
  }
1410
- }, {
1163
+ }, config);
1164
+ };
1165
+ //#endregion
1166
+ //#region src/utils.ts
1167
+ function mergeConfig(base, override) {
1168
+ const { plugins: basePlugins = [], jsPlugins: baseJsPlugins = [], ...baseConfig } = base;
1169
+ const { plugins: overridePlugins = [], jsPlugins: overrideJsPlugins, ...overrideConfig } = override;
1170
+ const config = merge.withOptions({
1171
+ allowUndefinedOverrides: false,
1172
+ mergeArrays: false
1173
+ }, baseConfig, overrideConfig);
1174
+ const plugins = [...new Set([...basePlugins, ...overridePlugins])];
1175
+ let jsPlugins = baseJsPlugins;
1176
+ if (overrideJsPlugins === null) jsPlugins = null;
1177
+ else if (overrideJsPlugins) jsPlugins = [...baseJsPlugins ?? [], ...overrideJsPlugins];
1178
+ return {
1411
1179
  ...config,
1412
- settings: {
1413
- ...config.settings,
1414
- ...userConfig.tailwindcss && { "better-tailwindcss": pick(userConfig.tailwindcss, [
1415
- "entryPoint",
1416
- "tailwindConfig",
1417
- "tsconfig",
1418
- "cwd",
1419
- "detectComponentClasses",
1420
- "rootFontSize",
1421
- "messageStyle",
1422
- "selectors"
1423
- ]) }
1180
+ plugins,
1181
+ jsPlugins
1182
+ };
1183
+ }
1184
+ //#endregion
1185
+ //#region src/configs/nextjs.ts
1186
+ const nextjs = (options = {}) => {
1187
+ return mergeConfig({
1188
+ files: [GLOB_SRC],
1189
+ plugins: ["nextjs"],
1190
+ rules: {
1191
+ "nextjs/google-font-display": "error",
1192
+ "nextjs/google-font-preconnect": "error",
1193
+ "nextjs/inline-script-id": "error",
1194
+ "nextjs/next-script-for-ga": "error",
1195
+ "nextjs/no-assign-module-variable": "error",
1196
+ "nextjs/no-async-client-component": "error",
1197
+ "nextjs/no-before-interactive-script-outside-document": "error",
1198
+ "nextjs/no-css-tags": "error",
1199
+ "nextjs/no-document-import-in-page": "error",
1200
+ "nextjs/no-duplicate-head": "error",
1201
+ "nextjs/no-head-element": "error",
1202
+ "nextjs/no-head-import-in-document": "error",
1203
+ "nextjs/no-html-link-for-pages": "error",
1204
+ "nextjs/no-img-element": "error",
1205
+ "nextjs/no-page-custom-font": "error",
1206
+ "nextjs/no-script-component-in-head": "error",
1207
+ "nextjs/no-styled-jsx-in-document": "error",
1208
+ "nextjs/no-sync-scripts": "error",
1209
+ "nextjs/no-title-in-document-head": "error",
1210
+ "nextjs/no-typos": "error",
1211
+ "nextjs/no-unwanted-polyfillio": "error"
1212
+ }
1213
+ }, options);
1214
+ };
1215
+ //#endregion
1216
+ //#region src/configs/playwright.ts
1217
+ const playwright = (options = {}) => {
1218
+ return mergeConfig({
1219
+ files: [GLOB_SRC],
1220
+ jsPlugins: [{
1221
+ name: "playwright",
1222
+ specifier: "eslint-plugin-playwright"
1223
+ }],
1224
+ rules: {
1225
+ "eslint/no-empty-pattern": "off",
1226
+ "playwright/consistent-spacing-between-blocks": "error",
1227
+ "playwright/expect-expect": "error",
1228
+ "playwright/max-nested-describe": "error",
1229
+ "playwright/missing-playwright-await": "error",
1230
+ "playwright/no-conditional-expect": "error",
1231
+ "playwright/no-conditional-in-test": "error",
1232
+ "playwright/no-duplicate-hooks": "error",
1233
+ "playwright/no-duplicate-slow": "error",
1234
+ "playwright/no-element-handle": "error",
1235
+ "playwright/no-eval": "error",
1236
+ "playwright/no-focused-test": "error",
1237
+ "playwright/no-force-option": "error",
1238
+ "playwright/no-nested-step": "error",
1239
+ "playwright/no-networkidle": "error",
1240
+ "playwright/no-page-pause": "error",
1241
+ "playwright/no-skipped-test": "error",
1242
+ "playwright/no-standalone-expect": "error",
1243
+ "playwright/no-unsafe-references": "error",
1244
+ "playwright/no-unused-locators": "error",
1245
+ "playwright/no-useless-await": "error",
1246
+ "playwright/no-useless-not": "error",
1247
+ "playwright/no-wait-for-navigation": "error",
1248
+ "playwright/no-wait-for-selector": "error",
1249
+ "playwright/no-wait-for-timeout": "error",
1250
+ "playwright/prefer-hooks-in-order": "error",
1251
+ "playwright/prefer-hooks-on-top": "error",
1252
+ "playwright/prefer-locator": "error",
1253
+ "playwright/prefer-to-have-count": "error",
1254
+ "playwright/prefer-to-have-length": "error",
1255
+ "playwright/prefer-web-first-assertions": "error",
1256
+ "playwright/valid-describe-callback": "error",
1257
+ "playwright/valid-expect": "error",
1258
+ "playwright/valid-expect-in-promise": "error",
1259
+ "playwright/valid-test-tags": "error",
1260
+ "playwright/valid-title": "error"
1261
+ }
1262
+ }, options);
1263
+ };
1264
+ //#endregion
1265
+ //#region src/configs/react.ts
1266
+ const react = (options = {}) => {
1267
+ return mergeConfig({
1268
+ files: [GLOB_SRC],
1269
+ jsPlugins: [{
1270
+ name: "@eslint-react",
1271
+ specifier: "@eslint-react/eslint-plugin"
1272
+ }, {
1273
+ name: "react-hooks-js",
1274
+ specifier: "eslint-plugin-react-hooks"
1275
+ }],
1276
+ rules: {
1277
+ "@eslint-react/dom-no-dangerously-set-innerhtml": "error",
1278
+ "@eslint-react/dom-no-dangerously-set-innerhtml-with-children": "error",
1279
+ "@eslint-react/dom-no-find-dom-node": "error",
1280
+ "@eslint-react/dom-no-flush-sync": "error",
1281
+ "@eslint-react/dom-no-hydrate": "error",
1282
+ "@eslint-react/dom-no-missing-button-type": "error",
1283
+ "@eslint-react/dom-no-missing-iframe-sandbox": "error",
1284
+ "@eslint-react/dom-no-render": "error",
1285
+ "@eslint-react/dom-no-render-return-value": "error",
1286
+ "@eslint-react/dom-no-script-url": "error",
1287
+ "@eslint-react/dom-no-string-style-prop": "error",
1288
+ "@eslint-react/dom-no-unknown-property": "error",
1289
+ "@eslint-react/dom-no-unsafe-iframe-sandbox": "error",
1290
+ "@eslint-react/dom-no-unsafe-target-blank": "error",
1291
+ "@eslint-react/dom-no-use-form-state": "error",
1292
+ "@eslint-react/dom-no-void-elements-with-children": "error",
1293
+ "@eslint-react/error-boundaries": "error",
1294
+ "@eslint-react/exhaustive-deps": "error",
1295
+ "@eslint-react/globals": "error",
1296
+ "@eslint-react/immutability": "error",
1297
+ "@eslint-react/jsx-no-children-prop": "error",
1298
+ "@eslint-react/jsx-no-children-prop-with-children": "error",
1299
+ "@eslint-react/jsx-no-comment-textnodes": "error",
1300
+ "@eslint-react/jsx-no-key-after-spread": "error",
1301
+ "@eslint-react/jsx-no-leaked-dollar": "error",
1302
+ "@eslint-react/jsx-no-leaked-semicolon": "error",
1303
+ "@eslint-react/jsx-no-namespace": "error",
1304
+ "@eslint-react/jsx-no-useless-fragment": "error",
1305
+ "@eslint-react/naming-convention-context-name": "error",
1306
+ "@eslint-react/naming-convention-id-name": "error",
1307
+ "@eslint-react/naming-convention-ref-name": "error",
1308
+ "@eslint-react/no-access-state-in-setstate": "error",
1309
+ "@eslint-react/no-array-index-key": "error",
1310
+ "@eslint-react/no-children-count": "error",
1311
+ "@eslint-react/no-children-for-each": "error",
1312
+ "@eslint-react/no-children-map": "error",
1313
+ "@eslint-react/no-children-only": "error",
1314
+ "@eslint-react/no-children-to-array": "error",
1315
+ "@eslint-react/no-class-component": "error",
1316
+ "@eslint-react/no-clone-element": "error",
1317
+ "@eslint-react/no-component-will-mount": "error",
1318
+ "@eslint-react/no-component-will-receive-props": "error",
1319
+ "@eslint-react/no-component-will-update": "error",
1320
+ "@eslint-react/no-context-provider": "error",
1321
+ "@eslint-react/no-create-ref": "error",
1322
+ "@eslint-react/no-direct-mutation-state": "error",
1323
+ "@eslint-react/no-duplicate-key": "error",
1324
+ "@eslint-react/no-forward-ref": "error",
1325
+ "@eslint-react/no-missing-component-display-name": "error",
1326
+ "@eslint-react/no-missing-context-display-name": "error",
1327
+ "@eslint-react/no-missing-key": "error",
1328
+ "@eslint-react/no-misused-capture-owner-stack": "error",
1329
+ "@eslint-react/no-nested-component-definitions": "error",
1330
+ "@eslint-react/no-nested-lazy-component-declarations": "error",
1331
+ "@eslint-react/no-set-state-in-component-did-mount": "error",
1332
+ "@eslint-react/no-set-state-in-component-did-update": "error",
1333
+ "@eslint-react/no-set-state-in-component-will-update": "error",
1334
+ "@eslint-react/no-unnecessary-use-prefix": "error",
1335
+ "@eslint-react/no-unsafe-component-will-mount": "error",
1336
+ "@eslint-react/no-unsafe-component-will-receive-props": "error",
1337
+ "@eslint-react/no-unsafe-component-will-update": "error",
1338
+ "@eslint-react/no-unstable-context-value": "error",
1339
+ "@eslint-react/no-unstable-default-props": "error",
1340
+ "@eslint-react/no-unused-class-component-members": "error",
1341
+ "@eslint-react/no-unused-state": "error",
1342
+ "@eslint-react/no-use-context": "error",
1343
+ "@eslint-react/purity": "error",
1344
+ "@eslint-react/refs": "error",
1345
+ "@eslint-react/rsc-function-definition": "error",
1346
+ "@eslint-react/rules-of-hooks": "error",
1347
+ "@eslint-react/set-state-in-effect": "error",
1348
+ "@eslint-react/set-state-in-render": "error",
1349
+ "@eslint-react/static-components": "off",
1350
+ "@eslint-react/unsupported-syntax": "error",
1351
+ "@eslint-react/use-memo": "error",
1352
+ "@eslint-react/use-state": "error",
1353
+ "@eslint-react/web-api-no-leaked-event-listener": "error",
1354
+ "@eslint-react/web-api-no-leaked-fetch": "error",
1355
+ "@eslint-react/web-api-no-leaked-intersection-observer": "error",
1356
+ "@eslint-react/web-api-no-leaked-interval": "error",
1357
+ "@eslint-react/web-api-no-leaked-resize-observer": "error",
1358
+ "@eslint-react/web-api-no-leaked-timeout": "error",
1359
+ "react-hooks-js/config": "error",
1360
+ "react-hooks-js/error-boundaries": "off",
1361
+ "react-hooks-js/exhaustive-deps": "off",
1362
+ "react-hooks-js/gating": "error",
1363
+ "react-hooks-js/globals": "off",
1364
+ "react-hooks-js/immutability": "off",
1365
+ "react-hooks-js/incompatible-library": "error",
1366
+ "react-hooks-js/preserve-manual-memoization": "error",
1367
+ "react-hooks-js/purity": "off",
1368
+ "react-hooks-js/refs": "off",
1369
+ "react-hooks-js/rules-of-hooks": "off",
1370
+ "react-hooks-js/set-state-in-effect": "off",
1371
+ "react-hooks-js/set-state-in-render": "off",
1372
+ "react-hooks-js/static-components": "off",
1373
+ "react-hooks-js/unsupported-syntax": "off",
1374
+ "react-hooks-js/use-memo": "off",
1375
+ "react-hooks-js/void-use-memo": "error"
1376
+ }
1377
+ }, options);
1378
+ };
1379
+ //#endregion
1380
+ //#region src/configs/tailwindcss.ts
1381
+ const tailwindcss = (options = {}) => {
1382
+ return mergeConfig({
1383
+ files: [GLOB_SRC],
1384
+ jsPlugins: [{
1385
+ name: "better-tailwindcss",
1386
+ specifier: "eslint-plugin-better-tailwindcss"
1387
+ }],
1388
+ rules: {
1389
+ "better-tailwindcss/enforce-canonical-classes": "error",
1390
+ "better-tailwindcss/enforce-consistent-class-order": "error",
1391
+ "better-tailwindcss/enforce-consistent-variant-order": "error",
1392
+ "better-tailwindcss/no-conflicting-classes": "error",
1393
+ "better-tailwindcss/no-deprecated-classes": "error",
1394
+ "better-tailwindcss/no-duplicate-classes": "error",
1395
+ "better-tailwindcss/no-restricted-classes": "error",
1396
+ "better-tailwindcss/no-unknown-classes": "error",
1397
+ "better-tailwindcss/no-unnecessary-whitespace": "error"
1398
+ }
1399
+ }, options);
1400
+ };
1401
+ //#endregion
1402
+ //#region src/configs/vitest.ts
1403
+ const vitest = (options = {}) => {
1404
+ return mergeConfig({
1405
+ files: [GLOB_SRC],
1406
+ plugins: ["vitest"],
1407
+ rules: {
1408
+ "vitest/consistent-test-it": ["error", { fn: "test" }],
1409
+ "vitest/expect-expect": "error",
1410
+ "vitest/no-commented-out-tests": "error",
1411
+ "vitest/no-conditional-expect": "error",
1412
+ "vitest/no-disabled-tests": "error",
1413
+ "vitest/no-focused-tests": "error",
1414
+ "vitest/no-identical-title": "error",
1415
+ "vitest/no-import-node-test": "error",
1416
+ "vitest/no-interpolation-in-snapshots": "error",
1417
+ "vitest/no-mocks-import": "error",
1418
+ "vitest/no-standalone-expect": "error",
1419
+ "vitest/no-unneeded-async-expect-function": "error",
1420
+ "vitest/prefer-called-exactly-once-with": "error",
1421
+ "vitest/prefer-mock-return-shorthand": "error",
1422
+ "vitest/require-local-test-context-for-concurrent-snapshots": "error",
1423
+ "vitest/valid-describe-callback": "error",
1424
+ "vitest/valid-expect": "error",
1425
+ "vitest/valid-expect-in-promise": "error",
1426
+ "vitest/valid-title": "error",
1427
+ "vitest/warn-todo": "error"
1424
1428
  }
1425
- }, concatArrays);
1429
+ }, options);
1426
1430
  };
1427
1431
  //#endregion
1428
- export { GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, defineConfig };
1432
+ export { GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, defineConfig, nextjs, playwright, react, tailwindcss, vitest };
1429
1433
 
1430
1434
  //# sourceMappingURL=index.mjs.map