@vinicunca/eslint-config 4.2.0 → 4.3.0

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,7 +1,10 @@
1
1
  import { FlatConfigComposer } from "eslint-flat-config-utils";
2
- import { isPackageExists } from "local-pkg";
3
2
  import process from "node:process";
3
+ import fsPromises from "node:fs/promises";
4
4
  import { fileURLToPath } from "node:url";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { isPackageExists } from "local-pkg";
5
8
  import createCommand from "eslint-plugin-command/config";
6
9
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
7
10
  import pluginAntfu from "eslint-plugin-antfu";
@@ -15,23 +18,57 @@ import globals from "globals";
15
18
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
16
19
  import { configs } from "eslint-plugin-regexp";
17
20
 
18
- //#region node_modules/.pnpm/@vinicunca+perkakas@1.12.0/node_modules/@vinicunca/perkakas/dist/is-boolean.js
21
+ //#region node_modules/.pnpm/@vinicunca+perkakas@1.13.0/node_modules/@vinicunca/perkakas/dist/is-boolean.js
19
22
  function e$2(e$3) {
20
23
  return typeof e$3 == `boolean`;
21
24
  }
22
25
 
23
26
  //#endregion
24
- //#region node_modules/.pnpm/@vinicunca+perkakas@1.12.0/node_modules/@vinicunca/perkakas/dist/is-function.js
27
+ //#region node_modules/.pnpm/@vinicunca+perkakas@1.13.0/node_modules/@vinicunca/perkakas/dist/is-function.js
25
28
  function e$1(e$3) {
26
29
  return typeof e$3 == `function`;
27
30
  }
28
31
 
29
32
  //#endregion
30
- //#region node_modules/.pnpm/@vinicunca+perkakas@1.12.0/node_modules/@vinicunca/perkakas/dist/is-number.js
33
+ //#region node_modules/.pnpm/@vinicunca+perkakas@1.13.0/node_modules/@vinicunca/perkakas/dist/is-number.js
31
34
  function e(e$3) {
32
35
  return typeof e$3 == `number` && !Number.isNaN(e$3);
33
36
  }
34
37
 
38
+ //#endregion
39
+ //#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
40
+ const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
41
+ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
42
+ let directory = path.resolve(toPath(cwd) ?? "");
43
+ const { root } = path.parse(directory);
44
+ stopAt = path.resolve(directory, toPath(stopAt ?? root));
45
+ const isAbsoluteName = path.isAbsolute(name);
46
+ while (directory) {
47
+ const filePath = isAbsoluteName ? name : path.join(directory, name);
48
+ try {
49
+ const stats = await fsPromises.stat(filePath);
50
+ if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
51
+ } catch {}
52
+ if (directory === stopAt || directory === root) break;
53
+ directory = path.dirname(directory);
54
+ }
55
+ }
56
+ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
57
+ let directory = path.resolve(toPath(cwd) ?? "");
58
+ const { root } = path.parse(directory);
59
+ stopAt = path.resolve(directory, toPath(stopAt) ?? root);
60
+ const isAbsoluteName = path.isAbsolute(name);
61
+ while (directory) {
62
+ const filePath = isAbsoluteName ? name : path.join(directory, name);
63
+ try {
64
+ const stats = fs.statSync(filePath, { throwIfNoEntry: false });
65
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
66
+ } catch {}
67
+ if (directory === stopAt || directory === root) break;
68
+ directory = path.dirname(directory);
69
+ }
70
+ }
71
+
35
72
  //#endregion
36
73
  //#region src/flags.ts
37
74
  const ERROR = "error";
@@ -298,6 +335,61 @@ async function comments() {
298
335
  }];
299
336
  }
300
337
 
338
+ //#endregion
339
+ //#region src/configs/disables.ts
340
+ async function disables() {
341
+ return [
342
+ {
343
+ files: [`**/scripts/${GLOB_SRC}`],
344
+ name: "vinicunca/disables/scripts",
345
+ rules: {
346
+ "antfu/no-top-level-await": OFF,
347
+ "no-console": OFF,
348
+ "ts/explicit-function-return-type": OFF
349
+ }
350
+ },
351
+ {
352
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
353
+ name: "vinicunca/disables/cli",
354
+ rules: {
355
+ "antfu/no-top-level-await": OFF,
356
+ "no-console": OFF
357
+ }
358
+ },
359
+ {
360
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
361
+ name: "vinicunca/disables/bin",
362
+ rules: {
363
+ "antfu/no-import-dist": OFF,
364
+ "antfu/no-import-node-modules-by-path": OFF
365
+ }
366
+ },
367
+ {
368
+ files: ["**/*.d.?([cm])ts"],
369
+ name: "vinicunca/disables/dts",
370
+ rules: {
371
+ "eslint-comments/no-unlimited-disable": OFF,
372
+ "no-restricted-syntax": OFF,
373
+ "unused-imports/no-unused-vars": OFF
374
+ }
375
+ },
376
+ {
377
+ files: ["**/*.js", "**/*.cjs"],
378
+ name: "vinicunca/disables/cjs",
379
+ rules: { "ts/no-require-imports": OFF }
380
+ },
381
+ {
382
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
383
+ name: "vinicunca/disables/config-files",
384
+ rules: {
385
+ "antfu/no-top-level-await": OFF,
386
+ "no-console": OFF,
387
+ "ts/explicit-function-return-type": OFF
388
+ }
389
+ }
390
+ ];
391
+ }
392
+
301
393
  //#endregion
302
394
  //#region src/configs/stylistic.ts
303
395
  const STYLISTIC_CONFIG_DEFAULTS = {
@@ -577,243 +669,225 @@ async function imports(options = {}) {
577
669
  //#region src/configs/javascript.ts
578
670
  async function javascript(options = {}) {
579
671
  const { isInEditor = false, overrides = {} } = options;
580
- return [
581
- {
582
- languageOptions: {
672
+ return [{
673
+ languageOptions: {
674
+ ecmaVersion: "latest",
675
+ globals: {
676
+ ...globals.browser,
677
+ ...globals.es2021,
678
+ ...globals.node,
679
+ document: "readonly",
680
+ navigator: "readonly",
681
+ window: "readonly"
682
+ },
683
+ parserOptions: {
684
+ ecmaFeatures: { jsx: true },
583
685
  ecmaVersion: "latest",
584
- globals: {
585
- ...globals.browser,
586
- ...globals.es2021,
587
- ...globals.node,
588
- document: "readonly",
589
- navigator: "readonly",
590
- window: "readonly"
591
- },
592
- parserOptions: {
593
- ecmaFeatures: { jsx: true },
594
- ecmaVersion: "latest",
595
- sourceType: "module"
596
- },
597
686
  sourceType: "module"
598
687
  },
599
- linterOptions: { reportUnusedDisableDirectives: true },
600
- name: "vinicunca/javascript/setup"
688
+ sourceType: "module"
601
689
  },
602
- {
603
- name: "vinicunca/javascript/rules",
604
- plugins: {
605
- "antfu": pluginAntfu,
606
- "unused-imports": pluginUnusedImports
607
- },
608
- rules: {
609
- "accessor-pairs": [ERROR, {
610
- enforceForClassMembers: true,
611
- setWithoutGet: true
612
- }],
613
- "array-callback-return": [ERROR, { checkForEach: true }],
614
- "block-scoped-var": ERROR,
615
- "camelcase": [ERROR, {
616
- allow: ["^UNSAFE_"],
617
- ignoreGlobals: true,
618
- properties: NEVER
619
- }],
620
- "constructor-super": ERROR,
621
- "default-case-last": ERROR,
622
- "dot-notation": [ERROR, { allowKeywords: true }],
623
- "eqeqeq": [ERROR, "smart"],
624
- "for-direction": ERROR,
625
- "new-cap": [ERROR, {
626
- capIsNew: false,
627
- properties: true
628
- }],
629
- "no-alert": WARN,
630
- "no-array-constructor": ERROR,
631
- "no-async-promise-executor": ERROR,
632
- "no-await-in-loop": ERROR,
633
- "no-caller": ERROR,
634
- "no-case-declarations": ERROR,
635
- "no-class-assign": ERROR,
636
- "no-compare-neg-zero": ERROR,
637
- "no-cond-assign": [ERROR, ALWAYS],
638
- "no-console": [ERROR, { allow: [WARN, ERROR] }],
639
- "no-const-assign": ERROR,
640
- "no-constant-binary-expression": ERROR,
641
- "no-constant-condition": [ERROR, { checkLoops: false }],
642
- "no-constructor-return": ERROR,
643
- "no-control-regex": ERROR,
644
- "no-debugger": ERROR,
645
- "no-delete-var": ERROR,
646
- "no-dupe-args": ERROR,
647
- "no-dupe-class-members": ERROR,
648
- "no-dupe-else-if": ERROR,
649
- "no-dupe-keys": ERROR,
650
- "no-duplicate-case": ERROR,
651
- "no-empty": [ERROR, { allowEmptyCatch: true }],
652
- "no-empty-character-class": ERROR,
653
- "no-empty-pattern": ERROR,
654
- "no-eval": ERROR,
655
- "no-ex-assign": ERROR,
656
- "no-extend-native": ERROR,
657
- "no-extra-bind": ERROR,
658
- "no-extra-boolean-cast": ERROR,
659
- "no-fallthrough": ERROR,
660
- "no-func-assign": ERROR,
661
- "no-global-assign": ERROR,
662
- "no-implied-eval": ERROR,
663
- "no-import-assign": ERROR,
664
- "no-invalid-regexp": ERROR,
665
- "no-invalid-this": ERROR,
666
- "no-irregular-whitespace": ERROR,
667
- "no-iterator": ERROR,
668
- "no-labels": ERROR,
669
- "no-lone-blocks": ERROR,
670
- "no-loss-of-precision": ERROR,
671
- "no-misleading-character-class": ERROR,
672
- "no-multi-str": ERROR,
673
- "no-nested-ternary": ERROR,
674
- "no-new": ERROR,
675
- "no-new-func": ERROR,
676
- "no-new-native-nonconstructor": ERROR,
677
- "no-new-wrappers": ERROR,
678
- "no-obj-calls": ERROR,
679
- "no-object-constructor": ERROR,
680
- "no-octal": ERROR,
681
- "no-octal-escape": ERROR,
682
- "no-promise-executor-return": ERROR,
683
- "no-proto": ERROR,
684
- "no-prototype-builtins": ERROR,
685
- "no-redeclare": [ERROR, { builtinGlobals: false }],
686
- "no-regex-spaces": ERROR,
687
- "no-restricted-globals": [
688
- ERROR,
689
- {
690
- message: "Use `globalThis` instead.",
691
- name: "global"
692
- },
693
- {
694
- message: "Use `globalThis` instead.",
695
- name: "self"
696
- }
697
- ],
698
- "no-restricted-properties": [
699
- ERROR,
700
- {
701
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
702
- property: "__proto__"
703
- },
704
- {
705
- message: "Use `Object.defineProperty` instead.",
706
- property: "__defineGetter__"
707
- },
708
- {
709
- message: "Use `Object.defineProperty` instead.",
710
- property: "__defineSetter__"
711
- },
712
- {
713
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
714
- property: "__lookupGetter__"
715
- },
716
- {
717
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
718
- property: "__lookupSetter__"
719
- }
720
- ],
721
- "no-restricted-syntax": [
722
- ERROR,
723
- "ForInStatement",
724
- "TSEnumDeclaration[const=true]",
725
- "TSExportAssignment"
726
- ],
727
- "no-return-assign": [ERROR, ALWAYS],
728
- "no-self-assign": [ERROR, { props: true }],
729
- "no-self-compare": ERROR,
730
- "no-sequences": ERROR,
731
- "no-shadow-restricted-names": ERROR,
732
- "no-sparse-arrays": ERROR,
733
- "no-template-curly-in-string": ERROR,
734
- "no-this-before-super": ERROR,
735
- "no-throw-literal": ERROR,
736
- "no-undef": ERROR,
737
- "no-undef-init": ERROR,
738
- "no-unexpected-multiline": ERROR,
739
- "no-unmodified-loop-condition": ERROR,
740
- "no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
741
- "no-unreachable": ERROR,
742
- "no-unreachable-loop": ERROR,
743
- "no-unsafe-finally": ERROR,
744
- "no-unsafe-negation": ERROR,
745
- "no-unused-expressions": [ERROR, {
746
- allowShortCircuit: true,
747
- allowTaggedTemplates: true,
748
- allowTernary: true
749
- }],
750
- "no-unused-vars": [ERROR, {
751
- args: "none",
752
- caughtErrors: "none",
753
- ignoreRestSiblings: true,
754
- vars: "all"
755
- }],
756
- "no-use-before-define": [ERROR, {
757
- classes: false,
758
- functions: false,
759
- variables: true
760
- }],
761
- "no-useless-backreference": ERROR,
762
- "no-useless-call": ERROR,
763
- "no-useless-catch": ERROR,
764
- "no-useless-computed-key": ERROR,
765
- "no-useless-constructor": ERROR,
766
- "no-useless-rename": ERROR,
767
- "no-useless-return": ERROR,
768
- "no-var": ERROR,
769
- "no-with": ERROR,
770
- "object-shorthand": [
771
- ERROR,
772
- ALWAYS,
773
- {
774
- avoidQuotes: true,
775
- ignoreConstructors: false
776
- }
777
- ],
778
- "one-var": [ERROR, { initialized: NEVER }],
779
- "prefer-arrow-callback": [ERROR],
780
- "prefer-const": [ERROR, {
781
- destructuring: "all",
782
- ignoreReadBeforeAssign: true
783
- }],
784
- "prefer-exponentiation-operator": ERROR,
785
- "prefer-promise-reject-errors": ERROR,
786
- "prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
787
- "prefer-rest-params": ERROR,
788
- "prefer-spread": ERROR,
789
- "prefer-template": ERROR,
790
- "sort-imports": [OFF],
791
- "symbol-description": ERROR,
792
- "unicode-bom": [ERROR, NEVER],
793
- "unused-imports/no-unused-imports": isInEditor ? OFF : ERROR,
794
- "unused-imports/no-unused-vars": [WARN, {
795
- args: "after-used",
796
- argsIgnorePattern: "^_",
797
- ignoreRestSiblings: true,
798
- vars: "all",
799
- varsIgnorePattern: "^_"
800
- }],
801
- "use-isnan": [ERROR, {
802
- enforceForIndexOf: true,
803
- enforceForSwitchCase: true
804
- }],
805
- "valid-typeof": [ERROR, { requireStringLiterals: true }],
806
- "vars-on-top": ERROR,
807
- "yoda": [ERROR, NEVER],
808
- ...overrides
809
- }
690
+ linterOptions: { reportUnusedDisableDirectives: true },
691
+ name: "vinicunca/javascript/setup"
692
+ }, {
693
+ name: "vinicunca/javascript/rules",
694
+ plugins: {
695
+ "antfu": pluginAntfu,
696
+ "unused-imports": pluginUnusedImports
810
697
  },
811
- {
812
- files: [`**/scripts/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
813
- name: "vinicunca/javascript/disables",
814
- rules: { "no-console": OFF }
698
+ rules: {
699
+ "accessor-pairs": [ERROR, {
700
+ enforceForClassMembers: true,
701
+ setWithoutGet: true
702
+ }],
703
+ "antfu/no-top-level-await": ERROR,
704
+ "array-callback-return": ERROR,
705
+ "block-scoped-var": ERROR,
706
+ "constructor-super": ERROR,
707
+ "default-case-last": ERROR,
708
+ "dot-notation": [ERROR, { allowKeywords: true }],
709
+ "eqeqeq": [ERROR, "smart"],
710
+ "new-cap": [ERROR, {
711
+ capIsNew: false,
712
+ newIsCap: true,
713
+ properties: true
714
+ }],
715
+ "no-alert": ERROR,
716
+ "no-array-constructor": ERROR,
717
+ "no-async-promise-executor": ERROR,
718
+ "no-caller": ERROR,
719
+ "no-case-declarations": ERROR,
720
+ "no-class-assign": ERROR,
721
+ "no-compare-neg-zero": ERROR,
722
+ "no-cond-assign": [ERROR, "always"],
723
+ "no-console": [ERROR, { allow: ["warn", ERROR] }],
724
+ "no-const-assign": ERROR,
725
+ "no-control-regex": ERROR,
726
+ "no-debugger": ERROR,
727
+ "no-delete-var": ERROR,
728
+ "no-dupe-args": ERROR,
729
+ "no-dupe-class-members": ERROR,
730
+ "no-dupe-keys": ERROR,
731
+ "no-duplicate-case": ERROR,
732
+ "no-empty": [ERROR, { allowEmptyCatch: true }],
733
+ "no-empty-character-class": ERROR,
734
+ "no-empty-pattern": ERROR,
735
+ "no-eval": ERROR,
736
+ "no-ex-assign": ERROR,
737
+ "no-extend-native": ERROR,
738
+ "no-extra-bind": ERROR,
739
+ "no-extra-boolean-cast": ERROR,
740
+ "no-fallthrough": ERROR,
741
+ "no-func-assign": ERROR,
742
+ "no-global-assign": ERROR,
743
+ "no-implied-eval": ERROR,
744
+ "no-import-assign": ERROR,
745
+ "no-invalid-regexp": ERROR,
746
+ "no-irregular-whitespace": ERROR,
747
+ "no-iterator": ERROR,
748
+ "no-labels": [ERROR, {
749
+ allowLoop: false,
750
+ allowSwitch: false
751
+ }],
752
+ "no-lone-blocks": ERROR,
753
+ "no-loss-of-precision": ERROR,
754
+ "no-misleading-character-class": ERROR,
755
+ "no-multi-str": ERROR,
756
+ "no-new": ERROR,
757
+ "no-new-func": ERROR,
758
+ "no-new-native-nonconstructor": ERROR,
759
+ "no-new-wrappers": ERROR,
760
+ "no-obj-calls": ERROR,
761
+ "no-octal": ERROR,
762
+ "no-octal-escape": ERROR,
763
+ "no-proto": ERROR,
764
+ "no-prototype-builtins": ERROR,
765
+ "no-redeclare": [ERROR, { builtinGlobals: false }],
766
+ "no-regex-spaces": ERROR,
767
+ "no-restricted-globals": [
768
+ ERROR,
769
+ {
770
+ message: "Use `globalThis` instead.",
771
+ name: "global"
772
+ },
773
+ {
774
+ message: "Use `globalThis` instead.",
775
+ name: "self"
776
+ }
777
+ ],
778
+ "no-restricted-properties": [
779
+ ERROR,
780
+ {
781
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
782
+ property: "__proto__"
783
+ },
784
+ {
785
+ message: "Use `Object.defineProperty` instead.",
786
+ property: "__defineGetter__"
787
+ },
788
+ {
789
+ message: "Use `Object.defineProperty` instead.",
790
+ property: "__defineSetter__"
791
+ },
792
+ {
793
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
794
+ property: "__lookupGetter__"
795
+ },
796
+ {
797
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
798
+ property: "__lookupSetter__"
799
+ }
800
+ ],
801
+ "no-restricted-syntax": [
802
+ ERROR,
803
+ "TSEnumDeclaration[const=true]",
804
+ "TSExportAssignment"
805
+ ],
806
+ "no-self-assign": [ERROR, { props: true }],
807
+ "no-self-compare": ERROR,
808
+ "no-sequences": ERROR,
809
+ "no-shadow-restricted-names": ERROR,
810
+ "no-sparse-arrays": ERROR,
811
+ "no-template-curly-in-string": ERROR,
812
+ "no-this-before-super": ERROR,
813
+ "no-throw-literal": ERROR,
814
+ "no-undef": ERROR,
815
+ "no-undef-init": ERROR,
816
+ "no-unexpected-multiline": ERROR,
817
+ "no-unmodified-loop-condition": ERROR,
818
+ "no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
819
+ "no-unreachable": ERROR,
820
+ "no-unreachable-loop": ERROR,
821
+ "no-unsafe-finally": ERROR,
822
+ "no-unsafe-negation": ERROR,
823
+ "no-unused-expressions": [ERROR, {
824
+ allowShortCircuit: true,
825
+ allowTaggedTemplates: true,
826
+ allowTernary: true
827
+ }],
828
+ "no-unused-vars": [ERROR, {
829
+ args: "none",
830
+ caughtErrors: "none",
831
+ ignoreRestSiblings: true,
832
+ vars: "all"
833
+ }],
834
+ "no-use-before-define": [ERROR, {
835
+ classes: false,
836
+ functions: false,
837
+ variables: true
838
+ }],
839
+ "no-useless-backreference": ERROR,
840
+ "no-useless-call": ERROR,
841
+ "no-useless-catch": ERROR,
842
+ "no-useless-computed-key": ERROR,
843
+ "no-useless-constructor": ERROR,
844
+ "no-useless-rename": ERROR,
845
+ "no-useless-return": ERROR,
846
+ "no-var": ERROR,
847
+ "no-with": ERROR,
848
+ "object-shorthand": [
849
+ ERROR,
850
+ "always",
851
+ {
852
+ avoidQuotes: true,
853
+ ignoreConstructors: false
854
+ }
855
+ ],
856
+ "one-var": [ERROR, { initialized: "never" }],
857
+ "prefer-arrow-callback": [ERROR, {
858
+ allowNamedFunctions: false,
859
+ allowUnboundThis: true
860
+ }],
861
+ "prefer-const": [isInEditor ? "warn" : ERROR, {
862
+ destructuring: "all",
863
+ ignoreReadBeforeAssign: true
864
+ }],
865
+ "prefer-exponentiation-operator": ERROR,
866
+ "prefer-promise-reject-errors": ERROR,
867
+ "prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
868
+ "prefer-rest-params": ERROR,
869
+ "prefer-spread": ERROR,
870
+ "prefer-template": ERROR,
871
+ "symbol-description": ERROR,
872
+ "unicode-bom": [ERROR, "never"],
873
+ "unused-imports/no-unused-imports": isInEditor ? "warn" : ERROR,
874
+ "unused-imports/no-unused-vars": [ERROR, {
875
+ args: "after-used",
876
+ argsIgnorePattern: "^_",
877
+ ignoreRestSiblings: true,
878
+ vars: "all",
879
+ varsIgnorePattern: "^_"
880
+ }],
881
+ "use-isnan": [ERROR, {
882
+ enforceForIndexOf: true,
883
+ enforceForSwitchCase: true
884
+ }],
885
+ "valid-typeof": [ERROR, { requireStringLiterals: true }],
886
+ "vars-on-top": ERROR,
887
+ "yoda": [ERROR, "never"],
888
+ ...overrides
815
889
  }
816
- ];
890
+ }];
817
891
  }
818
892
 
819
893
  //#endregion
@@ -899,7 +973,7 @@ async function jsonc(options = {}) {
899
973
  "jsonc/array-bracket-spacing": [ERROR, NEVER],
900
974
  "jsonc/comma-dangle": [ERROR, NEVER],
901
975
  "jsonc/comma-style": [ERROR, "last"],
902
- "jsonc/indent": [ERROR, indent],
976
+ "jsonc/indent": [ERROR, e(indent) ? indent : indent === "tab" ? "tab" : 2],
903
977
  "jsonc/key-spacing": [ERROR, {
904
978
  afterColon: true,
905
979
  beforeColon: false
@@ -1078,23 +1152,23 @@ async function perfectionist() {
1078
1152
  }],
1079
1153
  "perfectionist/sort-imports": [ERROR, {
1080
1154
  groups: [
1081
- "type",
1155
+ "type-import",
1082
1156
  [
1083
- "parent-type",
1084
- "sibling-type",
1085
- "index-type",
1086
- "internal-type"
1157
+ "type-parent",
1158
+ "type-sibling",
1159
+ "type-index",
1160
+ "type-internal"
1087
1161
  ],
1088
- "builtin",
1089
- "external",
1090
- "internal",
1162
+ "value-builtin",
1163
+ "value-external",
1164
+ "value-internal",
1091
1165
  [
1092
- "parent",
1093
- "sibling",
1094
- "index"
1166
+ "value-parent",
1167
+ "value-sibling",
1168
+ "value-index"
1095
1169
  ],
1096
1170
  "side-effect",
1097
- "object",
1171
+ "ts-equals-import",
1098
1172
  "unknown"
1099
1173
  ],
1100
1174
  newlinesBetween: "ignore",
@@ -1115,42 +1189,55 @@ async function perfectionist() {
1115
1189
 
1116
1190
  //#endregion
1117
1191
  //#region src/configs/pnpm.ts
1192
+ async function detectCatalogUsage() {
1193
+ const workspaceFile = await findUp("pnpm-workspace.yaml");
1194
+ if (!workspaceFile) return false;
1195
+ const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
1196
+ return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1197
+ }
1118
1198
  async function pnpm(options) {
1119
- const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
1199
+ const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
1120
1200
  interopDefault(import("eslint-plugin-pnpm")),
1201
+ interopDefault(import("eslint-plugin-yml")),
1121
1202
  interopDefault(import("yaml-eslint-parser")),
1122
1203
  interopDefault(import("jsonc-eslint-parser"))
1123
1204
  ]);
1124
- return [
1125
- {
1126
- files: ["package.json", "**/package.json"],
1127
- languageOptions: { parser: jsoncParser },
1128
- name: "vinicunca/pnpm/package.json",
1129
- plugins: { pnpm: pluginPnpm },
1130
- rules: {
1131
- "pnpm/json-enforce-catalog": [ERROR, { autofix: !options.isInEditor }],
1132
- "pnpm/json-prefer-workspace-settings": [ERROR, { autofix: !options.isInEditor }],
1133
- "pnpm/json-valid-catalog": [ERROR, { autofix: !options.isInEditor }]
1134
- }
1135
- },
1136
- {
1205
+ const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml: yaml$1 = true } = options;
1206
+ const configs$1 = [];
1207
+ if (json) configs$1.push({
1208
+ files: ["package.json", "**/package.json"],
1209
+ languageOptions: { parser: jsoncParser },
1210
+ name: "vinicunca/pnpm/package-json",
1211
+ plugins: { pnpm: pluginPnpm },
1212
+ rules: {
1213
+ ...catalogs ? { "pnpm/json-enforce-catalog": [ERROR, {
1214
+ autofix: !isInEditor,
1215
+ ignores: ["@types/vscode"]
1216
+ }] } : {},
1217
+ "pnpm/json-prefer-workspace-settings": [ERROR, { autofix: !isInEditor }],
1218
+ "pnpm/json-valid-catalog": [ERROR, { autofix: !isInEditor }]
1219
+ }
1220
+ });
1221
+ if (yaml$1) {
1222
+ configs$1.push({
1137
1223
  files: ["pnpm-workspace.yaml"],
1138
1224
  languageOptions: { parser: yamlParser },
1139
1225
  name: "vinicunca/pnpm/pnpm-workspace-yaml",
1140
1226
  plugins: { pnpm: pluginPnpm },
1141
1227
  rules: {
1142
1228
  "pnpm/yaml-enforce-settings": [ERROR, { settings: {
1143
- catalogMode: "prefer",
1144
1229
  shellEmulator: true,
1145
1230
  trustPolicy: "no-downgrade"
1146
1231
  } }],
1147
1232
  "pnpm/yaml-no-duplicate-catalog-item": ERROR,
1148
1233
  "pnpm/yaml-no-unused-catalog-item": ERROR
1149
1234
  }
1150
- },
1151
- {
1235
+ });
1236
+ if (sort) configs$1.push({
1152
1237
  files: ["pnpm-workspace.yaml"],
1238
+ languageOptions: { parser: yamlParser },
1153
1239
  name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
1240
+ plugins: { yaml: pluginYaml },
1154
1241
  rules: { "yaml/sort-keys": [
1155
1242
  ERROR,
1156
1243
  {
@@ -1223,8 +1310,9 @@ async function pnpm(options) {
1223
1310
  pathPattern: ".*"
1224
1311
  }
1225
1312
  ] }
1226
- }
1227
- ];
1313
+ });
1314
+ }
1315
+ return configs$1;
1228
1316
  }
1229
1317
 
1230
1318
  //#endregion
@@ -1787,7 +1875,7 @@ async function svelte(options = {}) {
1787
1875
  "svelte/html-quotes": [ERROR, { prefer: quotes }],
1788
1876
  "svelte/indent": [ERROR, {
1789
1877
  alignAttributesVertically: true,
1790
- indent
1878
+ indent: e(indent) ? indent : indent === "tab" ? "tab" : 2
1791
1879
  }],
1792
1880
  "svelte/mustache-spacing": ERROR,
1793
1881
  "svelte/no-spaces-around-equal-signs-in-attribute": ERROR,
@@ -1865,7 +1953,7 @@ async function toml(options = {}) {
1865
1953
  "toml/array-bracket-newline": ERROR,
1866
1954
  "toml/array-bracket-spacing": ERROR,
1867
1955
  "toml/array-element-newline": ERROR,
1868
- "toml/indent": [ERROR, indent === "tab" ? 2 : indent],
1956
+ "toml/indent": [ERROR, e(indent) ? indent : indent === "tab" ? "tab" : 2],
1869
1957
  "toml/inline-table-curly-spacing": ERROR,
1870
1958
  "toml/key-spacing": ERROR,
1871
1959
  "toml/padding-line-between-pairs": ERROR,
@@ -2033,7 +2121,7 @@ async function typescript(options = {}) {
2033
2121
  }] : [],
2034
2122
  ...erasableOnly ? [{
2035
2123
  name: "antfu/typescript/erasable-syntax-only",
2036
- plugins: { "erasable-syntax-only": await interopDefault(import("./lib-DEAC6Tpv.mjs")) },
2124
+ plugins: { "erasable-syntax-only": await interopDefault(import("./lib-DHxUIJ7x.mjs")) },
2037
2125
  rules: {
2038
2126
  "erasable-syntax-only/enums": "error",
2039
2127
  "erasable-syntax-only/import-aliases": "error",
@@ -2345,7 +2433,7 @@ async function yaml(options = {}) {
2345
2433
  "yaml/flow-mapping-curly-spacing": ERROR,
2346
2434
  "yaml/flow-sequence-bracket-newline": ERROR,
2347
2435
  "yaml/flow-sequence-bracket-spacing": ERROR,
2348
- "yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
2436
+ "yaml/indent": [ERROR, e(indent) ? indent : 2],
2349
2437
  "yaml/key-spacing": ERROR,
2350
2438
  "yaml/no-tab-indent": ERROR,
2351
2439
  "yaml/quotes": [ERROR, {
@@ -2401,7 +2489,7 @@ const defaultPluginRenaming = {
2401
2489
  * The merged ESLint configurations.
2402
2490
  */
2403
2491
  function vinicuncaESLint(options = {}, ...userConfigs) {
2404
- const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNextjs = false, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2492
+ const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2405
2493
  let isInEditor = options.isInEditor;
2406
2494
  if (isInEditor == null) {
2407
2495
  isInEditor = isInEditorEnv();
@@ -2423,10 +2511,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2423
2511
  configs$1.push(ignores(userIgnores), javascript({
2424
2512
  isInEditor,
2425
2513
  overrides: getOverrides(options, "javascript")
2426
- }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
2427
- if (enableImports) configs$1.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
2514
+ }), comments(), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
2515
+ if (enableNode) configs$1.push(node());
2516
+ if (enableJsdoc) configs$1.push(jsdoc({ stylistic: stylisticOptions }));
2517
+ if (enableImports) configs$1.push(imports({
2428
2518
  stylistic: stylisticOptions,
2429
- ...enableImports
2519
+ ...resolveSubOptions(options, "imports")
2430
2520
  }));
2431
2521
  if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2432
2522
  if (enableVue) componentExts.push("vue");
@@ -2482,7 +2572,15 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2482
2572
  overrides: getOverrides(options, "jsonc"),
2483
2573
  stylistic: stylisticOptions
2484
2574
  }), sortPackageJson(), sortTsconfig());
2485
- if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
2575
+ if (enableCatalogs) {
2576
+ const optionsPnpm = resolveSubOptions(options, "pnpm");
2577
+ configs$1.push(pnpm({
2578
+ isInEditor,
2579
+ json: options.jsonc !== false,
2580
+ yaml: options.yaml !== false,
2581
+ ...optionsPnpm
2582
+ }));
2583
+ }
2486
2584
  if (options.yaml ?? true) configs$1.push(yaml({
2487
2585
  overrides: getOverrides(options, "yaml"),
2488
2586
  stylistic: stylisticOptions
@@ -2496,6 +2594,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2496
2594
  overrides: getOverrides(options, "markdown")
2497
2595
  }));
2498
2596
  if (options.formatters) configs$1.push(formatters(options.formatters, e$2(stylisticOptions) ? {} : stylisticOptions));
2597
+ configs$1.push(disables());
2499
2598
  if ("files" in options) throw new Error("[@vinicunca/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
2500
2599
  /**
2501
2600
  * User can optionally pass a flat config item to the first argument.
@@ -2525,4 +2624,4 @@ function resolveSubOptions(options, key) {
2525
2624
  }
2526
2625
 
2527
2626
  //#endregion
2528
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
2627
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };