@vinicunca/eslint-config 4.2.0 → 4.4.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,241 @@ 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, { checkForEach: true }],
705
+ "block-scoped-var": ERROR,
706
+ "camelcase": [ERROR, {
707
+ allow: ["^UNSAFE_"],
708
+ ignoreGlobals: true,
709
+ properties: NEVER
710
+ }],
711
+ "constructor-super": ERROR,
712
+ "default-case-last": ERROR,
713
+ "dot-notation": [ERROR, { allowKeywords: true }],
714
+ "eqeqeq": [ERROR, "smart"],
715
+ "for-direction": ERROR,
716
+ "new-cap": [ERROR, {
717
+ capIsNew: false,
718
+ newIsCap: true,
719
+ properties: true
720
+ }],
721
+ "no-alert": WARN,
722
+ "no-array-constructor": ERROR,
723
+ "no-async-promise-executor": ERROR,
724
+ "no-await-in-loop": ERROR,
725
+ "no-caller": ERROR,
726
+ "no-case-declarations": ERROR,
727
+ "no-class-assign": ERROR,
728
+ "no-compare-neg-zero": ERROR,
729
+ "no-cond-assign": [ERROR, ALWAYS],
730
+ "no-console": [ERROR, { allow: [WARN, ERROR] }],
731
+ "no-const-assign": ERROR,
732
+ "no-constant-binary-expression": ERROR,
733
+ "no-constant-condition": [ERROR, { checkLoops: false }],
734
+ "no-constructor-return": ERROR,
735
+ "no-control-regex": ERROR,
736
+ "no-debugger": ERROR,
737
+ "no-delete-var": ERROR,
738
+ "no-dupe-args": ERROR,
739
+ "no-dupe-class-members": ERROR,
740
+ "no-dupe-else-if": ERROR,
741
+ "no-dupe-keys": ERROR,
742
+ "no-duplicate-case": ERROR,
743
+ "no-empty": [ERROR, { allowEmptyCatch: true }],
744
+ "no-empty-character-class": ERROR,
745
+ "no-empty-pattern": ERROR,
746
+ "no-eval": ERROR,
747
+ "no-ex-assign": ERROR,
748
+ "no-extend-native": ERROR,
749
+ "no-extra-bind": ERROR,
750
+ "no-extra-boolean-cast": ERROR,
751
+ "no-fallthrough": ERROR,
752
+ "no-func-assign": ERROR,
753
+ "no-global-assign": ERROR,
754
+ "no-implied-eval": ERROR,
755
+ "no-import-assign": ERROR,
756
+ "no-invalid-regexp": ERROR,
757
+ "no-irregular-whitespace": ERROR,
758
+ "no-iterator": ERROR,
759
+ "no-labels": [ERROR, {
760
+ allowLoop: false,
761
+ allowSwitch: false
762
+ }],
763
+ "no-lone-blocks": ERROR,
764
+ "no-loss-of-precision": ERROR,
765
+ "no-misleading-character-class": ERROR,
766
+ "no-multi-str": ERROR,
767
+ "no-nested-ternary": ERROR,
768
+ "no-new": ERROR,
769
+ "no-new-func": ERROR,
770
+ "no-new-native-nonconstructor": ERROR,
771
+ "no-new-wrappers": ERROR,
772
+ "no-obj-calls": ERROR,
773
+ "no-object-constructor": ERROR,
774
+ "no-octal": ERROR,
775
+ "no-octal-escape": ERROR,
776
+ "no-promise-executor-return": ERROR,
777
+ "no-proto": ERROR,
778
+ "no-prototype-builtins": ERROR,
779
+ "no-redeclare": [ERROR, { builtinGlobals: false }],
780
+ "no-regex-spaces": ERROR,
781
+ "no-restricted-globals": [
782
+ ERROR,
783
+ {
784
+ message: "Use `globalThis` instead.",
785
+ name: "global"
786
+ },
787
+ {
788
+ message: "Use `globalThis` instead.",
789
+ name: "self"
790
+ }
791
+ ],
792
+ "no-restricted-properties": [
793
+ ERROR,
794
+ {
795
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
796
+ property: "__proto__"
797
+ },
798
+ {
799
+ message: "Use `Object.defineProperty` instead.",
800
+ property: "__defineGetter__"
801
+ },
802
+ {
803
+ message: "Use `Object.defineProperty` instead.",
804
+ property: "__defineSetter__"
805
+ },
806
+ {
807
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
808
+ property: "__lookupGetter__"
809
+ },
810
+ {
811
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
812
+ property: "__lookupSetter__"
813
+ }
814
+ ],
815
+ "no-restricted-syntax": [
816
+ ERROR,
817
+ "ForInStatement",
818
+ "TSEnumDeclaration[const=true]",
819
+ "TSExportAssignment"
820
+ ],
821
+ "no-return-assign": [ERROR, ALWAYS],
822
+ "no-self-assign": [ERROR, { props: true }],
823
+ "no-self-compare": ERROR,
824
+ "no-sequences": ERROR,
825
+ "no-shadow-restricted-names": ERROR,
826
+ "no-sparse-arrays": ERROR,
827
+ "no-template-curly-in-string": ERROR,
828
+ "no-this-before-super": ERROR,
829
+ "no-throw-literal": ERROR,
830
+ "no-undef": ERROR,
831
+ "no-undef-init": ERROR,
832
+ "no-unexpected-multiline": ERROR,
833
+ "no-unmodified-loop-condition": ERROR,
834
+ "no-unneeded-ternary": [ERROR, { defaultAssignment: false }],
835
+ "no-unreachable": ERROR,
836
+ "no-unreachable-loop": ERROR,
837
+ "no-unsafe-finally": ERROR,
838
+ "no-unsafe-negation": ERROR,
839
+ "no-unused-expressions": [ERROR, {
840
+ allowShortCircuit: true,
841
+ allowTaggedTemplates: true,
842
+ allowTernary: true
843
+ }],
844
+ "no-unused-vars": [ERROR, {
845
+ args: "none",
846
+ caughtErrors: "none",
847
+ ignoreRestSiblings: true,
848
+ vars: "all"
849
+ }],
850
+ "no-use-before-define": [ERROR, {
851
+ classes: false,
852
+ functions: false,
853
+ variables: true
854
+ }],
855
+ "no-useless-backreference": ERROR,
856
+ "no-useless-call": ERROR,
857
+ "no-useless-catch": ERROR,
858
+ "no-useless-computed-key": ERROR,
859
+ "no-useless-constructor": ERROR,
860
+ "no-useless-rename": ERROR,
861
+ "no-useless-return": ERROR,
862
+ "no-var": ERROR,
863
+ "no-with": ERROR,
864
+ "object-shorthand": [
865
+ ERROR,
866
+ ALWAYS,
867
+ {
868
+ avoidQuotes: true,
869
+ ignoreConstructors: false
870
+ }
871
+ ],
872
+ "one-var": [ERROR, { initialized: NEVER }],
873
+ "prefer-arrow-callback": [ERROR, {
874
+ allowNamedFunctions: false,
875
+ allowUnboundThis: true
876
+ }],
877
+ "prefer-const": [isInEditor ? WARN : ERROR, {
878
+ destructuring: "all",
879
+ ignoreReadBeforeAssign: true
880
+ }],
881
+ "prefer-exponentiation-operator": ERROR,
882
+ "prefer-promise-reject-errors": ERROR,
883
+ "prefer-regex-literals": [ERROR, { disallowRedundantWrapping: true }],
884
+ "prefer-rest-params": ERROR,
885
+ "prefer-spread": ERROR,
886
+ "prefer-template": ERROR,
887
+ "symbol-description": ERROR,
888
+ "unicode-bom": [ERROR, NEVER],
889
+ "unused-imports/no-unused-imports": isInEditor ? WARN : ERROR,
890
+ "unused-imports/no-unused-vars": [WARN, {
891
+ args: "after-used",
892
+ argsIgnorePattern: "^_",
893
+ ignoreRestSiblings: true,
894
+ vars: "all",
895
+ varsIgnorePattern: "^_"
896
+ }],
897
+ "use-isnan": [ERROR, {
898
+ enforceForIndexOf: true,
899
+ enforceForSwitchCase: true
900
+ }],
901
+ "valid-typeof": [ERROR, { requireStringLiterals: true }],
902
+ "vars-on-top": ERROR,
903
+ "yoda": [ERROR, NEVER],
904
+ ...overrides
815
905
  }
816
- ];
906
+ }];
817
907
  }
818
908
 
819
909
  //#endregion
@@ -899,7 +989,7 @@ async function jsonc(options = {}) {
899
989
  "jsonc/array-bracket-spacing": [ERROR, NEVER],
900
990
  "jsonc/comma-dangle": [ERROR, NEVER],
901
991
  "jsonc/comma-style": [ERROR, "last"],
902
- "jsonc/indent": [ERROR, indent],
992
+ "jsonc/indent": [ERROR, e(indent) ? indent : indent === "tab" ? "tab" : 2],
903
993
  "jsonc/key-spacing": [ERROR, {
904
994
  afterColon: true,
905
995
  beforeColon: false
@@ -1078,23 +1168,23 @@ async function perfectionist() {
1078
1168
  }],
1079
1169
  "perfectionist/sort-imports": [ERROR, {
1080
1170
  groups: [
1081
- "type",
1171
+ "type-import",
1082
1172
  [
1083
- "parent-type",
1084
- "sibling-type",
1085
- "index-type",
1086
- "internal-type"
1173
+ "type-parent",
1174
+ "type-sibling",
1175
+ "type-index",
1176
+ "type-internal"
1087
1177
  ],
1088
- "builtin",
1089
- "external",
1090
- "internal",
1178
+ "value-builtin",
1179
+ "value-external",
1180
+ "value-internal",
1091
1181
  [
1092
- "parent",
1093
- "sibling",
1094
- "index"
1182
+ "value-parent",
1183
+ "value-sibling",
1184
+ "value-index"
1095
1185
  ],
1096
1186
  "side-effect",
1097
- "object",
1187
+ "ts-equals-import",
1098
1188
  "unknown"
1099
1189
  ],
1100
1190
  newlinesBetween: "ignore",
@@ -1115,42 +1205,55 @@ async function perfectionist() {
1115
1205
 
1116
1206
  //#endregion
1117
1207
  //#region src/configs/pnpm.ts
1208
+ async function detectCatalogUsage() {
1209
+ const workspaceFile = await findUp("pnpm-workspace.yaml");
1210
+ if (!workspaceFile) return false;
1211
+ const yaml$1 = await fsPromises.readFile(workspaceFile, "utf-8");
1212
+ return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1213
+ }
1118
1214
  async function pnpm(options) {
1119
- const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
1215
+ const [pluginPnpm, pluginYaml, yamlParser, jsoncParser] = await Promise.all([
1120
1216
  interopDefault(import("eslint-plugin-pnpm")),
1217
+ interopDefault(import("eslint-plugin-yml")),
1121
1218
  interopDefault(import("yaml-eslint-parser")),
1122
1219
  interopDefault(import("jsonc-eslint-parser"))
1123
1220
  ]);
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
- {
1221
+ const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml: yaml$1 = true } = options;
1222
+ const configs$1 = [];
1223
+ if (json) configs$1.push({
1224
+ files: ["package.json", "**/package.json"],
1225
+ languageOptions: { parser: jsoncParser },
1226
+ name: "vinicunca/pnpm/package-json",
1227
+ plugins: { pnpm: pluginPnpm },
1228
+ rules: {
1229
+ ...catalogs ? { "pnpm/json-enforce-catalog": [ERROR, {
1230
+ autofix: !isInEditor,
1231
+ ignores: ["@types/vscode"]
1232
+ }] } : {},
1233
+ "pnpm/json-prefer-workspace-settings": [ERROR, { autofix: !isInEditor }],
1234
+ "pnpm/json-valid-catalog": [ERROR, { autofix: !isInEditor }]
1235
+ }
1236
+ });
1237
+ if (yaml$1) {
1238
+ configs$1.push({
1137
1239
  files: ["pnpm-workspace.yaml"],
1138
1240
  languageOptions: { parser: yamlParser },
1139
1241
  name: "vinicunca/pnpm/pnpm-workspace-yaml",
1140
1242
  plugins: { pnpm: pluginPnpm },
1141
1243
  rules: {
1142
1244
  "pnpm/yaml-enforce-settings": [ERROR, { settings: {
1143
- catalogMode: "prefer",
1144
1245
  shellEmulator: true,
1145
1246
  trustPolicy: "no-downgrade"
1146
1247
  } }],
1147
1248
  "pnpm/yaml-no-duplicate-catalog-item": ERROR,
1148
1249
  "pnpm/yaml-no-unused-catalog-item": ERROR
1149
1250
  }
1150
- },
1151
- {
1251
+ });
1252
+ if (sort) configs$1.push({
1152
1253
  files: ["pnpm-workspace.yaml"],
1254
+ languageOptions: { parser: yamlParser },
1153
1255
  name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
1256
+ plugins: { yaml: pluginYaml },
1154
1257
  rules: { "yaml/sort-keys": [
1155
1258
  ERROR,
1156
1259
  {
@@ -1223,8 +1326,9 @@ async function pnpm(options) {
1223
1326
  pathPattern: ".*"
1224
1327
  }
1225
1328
  ] }
1226
- }
1227
- ];
1329
+ });
1330
+ }
1331
+ return configs$1;
1228
1332
  }
1229
1333
 
1230
1334
  //#endregion
@@ -1787,7 +1891,7 @@ async function svelte(options = {}) {
1787
1891
  "svelte/html-quotes": [ERROR, { prefer: quotes }],
1788
1892
  "svelte/indent": [ERROR, {
1789
1893
  alignAttributesVertically: true,
1790
- indent
1894
+ indent: e(indent) ? indent : indent === "tab" ? "tab" : 2
1791
1895
  }],
1792
1896
  "svelte/mustache-spacing": ERROR,
1793
1897
  "svelte/no-spaces-around-equal-signs-in-attribute": ERROR,
@@ -1865,7 +1969,7 @@ async function toml(options = {}) {
1865
1969
  "toml/array-bracket-newline": ERROR,
1866
1970
  "toml/array-bracket-spacing": ERROR,
1867
1971
  "toml/array-element-newline": ERROR,
1868
- "toml/indent": [ERROR, indent === "tab" ? 2 : indent],
1972
+ "toml/indent": [ERROR, e(indent) ? indent : indent === "tab" ? "tab" : 2],
1869
1973
  "toml/inline-table-curly-spacing": ERROR,
1870
1974
  "toml/key-spacing": ERROR,
1871
1975
  "toml/padding-line-between-pairs": ERROR,
@@ -1900,7 +2004,7 @@ async function typescript(options = {}) {
1900
2004
  "ts/no-floating-promises": ERROR,
1901
2005
  "ts/no-for-in-array": ERROR,
1902
2006
  "ts/no-implied-eval": ERROR,
1903
- "ts/no-misused-promises": OFF,
2007
+ "ts/no-misused-promises": ERROR,
1904
2008
  "ts/no-unnecessary-type-assertion": ERROR,
1905
2009
  "ts/no-unsafe-argument": ERROR,
1906
2010
  "ts/no-unsafe-assignment": ERROR,
@@ -1950,13 +2054,12 @@ async function typescript(options = {}) {
1950
2054
  }
1951
2055
  },
1952
2056
  ...isTypeAware ? [makeParser({
2057
+ files,
2058
+ typeAware: false
2059
+ }), makeParser({
1953
2060
  files: filesTypeAware,
1954
2061
  ignores: ignoresTypeAware,
1955
2062
  typeAware: true
1956
- }), makeParser({
1957
- files,
1958
- ignores: filesTypeAware,
1959
- typeAware: false
1960
2063
  })] : [makeParser({
1961
2064
  files,
1962
2065
  typeAware: false
@@ -1968,9 +2071,7 @@ async function typescript(options = {}) {
1968
2071
  ...renameRules(pluginTs.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
1969
2072
  ...renameRules(pluginTs.configs.strict.rules, { "@typescript-eslint": "ts" }),
1970
2073
  "no-dupe-class-members": OFF,
1971
- "no-invalid-this": OFF,
1972
2074
  "no-redeclare": OFF,
1973
- "no-unused-vars": OFF,
1974
2075
  "no-use-before-define": OFF,
1975
2076
  "no-useless-constructor": OFF,
1976
2077
  "ts/array-type": [ERROR, { default: "generic" }],
@@ -2033,33 +2134,14 @@ async function typescript(options = {}) {
2033
2134
  }] : [],
2034
2135
  ...erasableOnly ? [{
2035
2136
  name: "antfu/typescript/erasable-syntax-only",
2036
- plugins: { "erasable-syntax-only": await interopDefault(import("./lib-DEAC6Tpv.mjs")) },
2137
+ plugins: { "erasable-syntax-only": await interopDefault(import("./lib-DHxUIJ7x.mjs")) },
2037
2138
  rules: {
2038
- "erasable-syntax-only/enums": "error",
2039
- "erasable-syntax-only/import-aliases": "error",
2040
- "erasable-syntax-only/namespaces": "error",
2041
- "erasable-syntax-only/parameter-properties": "error"
2139
+ "erasable-syntax-only/enums": ERROR,
2140
+ "erasable-syntax-only/import-aliases": ERROR,
2141
+ "erasable-syntax-only/namespaces": ERROR,
2142
+ "erasable-syntax-only/parameter-properties": ERROR
2042
2143
  }
2043
- }] : [],
2044
- {
2045
- files: ["**/*.d.?([cm])ts"],
2046
- name: "vinicunca/typescript/disables/dts",
2047
- rules: {
2048
- "eslint-comments/no-unlimited-disable": OFF,
2049
- "no-restricted-syntax": OFF,
2050
- "unused-imports/no-unused-vars": OFF
2051
- }
2052
- },
2053
- {
2054
- files: ["**/*.{test,spec}.ts?(x)"],
2055
- name: "vinicunca/typescript/disables/tests",
2056
- rules: { "no-unused-expressions": OFF }
2057
- },
2058
- {
2059
- files: ["**/*.js", "**/*.cjs"],
2060
- name: "vinicunca/typescript/disables/javascript",
2061
- rules: { "ts/no-require-imports": OFF }
2062
- }
2144
+ }] : []
2063
2145
  ];
2064
2146
  }
2065
2147
 
@@ -2345,7 +2427,7 @@ async function yaml(options = {}) {
2345
2427
  "yaml/flow-mapping-curly-spacing": ERROR,
2346
2428
  "yaml/flow-sequence-bracket-newline": ERROR,
2347
2429
  "yaml/flow-sequence-bracket-spacing": ERROR,
2348
- "yaml/indent": [ERROR, indent === "tab" ? 2 : indent],
2430
+ "yaml/indent": [ERROR, e(indent) ? indent : 2],
2349
2431
  "yaml/key-spacing": ERROR,
2350
2432
  "yaml/no-tab-indent": ERROR,
2351
2433
  "yaml/quotes": [ERROR, {
@@ -2401,7 +2483,7 @@ const defaultPluginRenaming = {
2401
2483
  * The merged ESLint configurations.
2402
2484
  */
2403
2485
  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;
2486
+ 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
2487
  let isInEditor = options.isInEditor;
2406
2488
  if (isInEditor == null) {
2407
2489
  isInEditor = isInEditorEnv();
@@ -2423,10 +2505,12 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2423
2505
  configs$1.push(ignores(userIgnores), javascript({
2424
2506
  isInEditor,
2425
2507
  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 } : {
2508
+ }), comments(), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
2509
+ if (enableNode) configs$1.push(node());
2510
+ if (enableJsdoc) configs$1.push(jsdoc({ stylistic: stylisticOptions }));
2511
+ if (enableImports) configs$1.push(imports({
2428
2512
  stylistic: stylisticOptions,
2429
- ...enableImports
2513
+ ...resolveSubOptions(options, "imports")
2430
2514
  }));
2431
2515
  if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2432
2516
  if (enableVue) componentExts.push("vue");
@@ -2482,7 +2566,15 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2482
2566
  overrides: getOverrides(options, "jsonc"),
2483
2567
  stylistic: stylisticOptions
2484
2568
  }), sortPackageJson(), sortTsconfig());
2485
- if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
2569
+ if (enableCatalogs) {
2570
+ const optionsPnpm = resolveSubOptions(options, "pnpm");
2571
+ configs$1.push(pnpm({
2572
+ isInEditor,
2573
+ json: options.jsonc !== false,
2574
+ yaml: options.yaml !== false,
2575
+ ...optionsPnpm
2576
+ }));
2577
+ }
2486
2578
  if (options.yaml ?? true) configs$1.push(yaml({
2487
2579
  overrides: getOverrides(options, "yaml"),
2488
2580
  stylistic: stylisticOptions
@@ -2496,6 +2588,7 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
2496
2588
  overrides: getOverrides(options, "markdown")
2497
2589
  }));
2498
2590
  if (options.formatters) configs$1.push(formatters(options.formatters, e$2(stylisticOptions) ? {} : stylisticOptions));
2591
+ configs$1.push(disables());
2499
2592
  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
2593
  /**
2501
2594
  * User can optionally pass a flat config item to the first argument.
@@ -2525,4 +2618,4 @@ function resolveSubOptions(options, key) {
2525
2618
  }
2526
2619
 
2527
2620
  //#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 };
2621
+ 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 };