@debbl/eslint-config 1.1.1 → 2.0.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.cjs CHANGED
@@ -54,40 +54,16 @@ __export(src_exports, {
54
54
  combine: () => combine,
55
55
  comments: () => comments,
56
56
  config: () => config,
57
- configPrettier: () => import_eslint_config_prettier.default,
58
57
  default: () => src_default,
59
58
  ignores: () => ignores,
60
59
  imports: () => imports,
60
+ interopDefault: () => interopDefault,
61
61
  javascript: () => javascript,
62
62
  jsdoc: () => jsdoc,
63
63
  jsonc: () => jsonc,
64
64
  markdown: () => markdown,
65
65
  node: () => node,
66
- parserJsonc: () => import_jsonc_eslint_parser.default,
67
- parserTs: () => parserTs,
68
- parserVue: () => import_vue_eslint_parser.default,
69
- parserYml: () => import_yaml_eslint_parser.default,
70
66
  perfectionist: () => perfectionist,
71
- pluginAntfu: () => import_eslint_plugin_antfu.default,
72
- pluginComments: () => import_eslint_plugin_eslint_comments.default,
73
- pluginImport: () => pluginImport,
74
- pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
75
- pluginJsonc: () => pluginJsonc,
76
- pluginMarkdown: () => import_eslint_plugin_markdown.default,
77
- pluginNext: () => pluginNext,
78
- pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
79
- pluginNode: () => import_eslint_plugin_n.default,
80
- pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
81
- pluginPrettier: () => import_eslint_plugin_prettier.default,
82
- pluginReact: () => import_eslint_plugin_react.default,
83
- pluginReactHooks: () => import_eslint_plugin_react_hooks.default,
84
- pluginTailwindcss: () => import_eslint_plugin_tailwindcss.default,
85
- pluginTs: () => import_eslint_plugin.default,
86
- pluginUnicorn: () => import_eslint_plugin_unicorn.default,
87
- pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
88
- pluginVitest: () => import_eslint_plugin_vitest.default,
89
- pluginVue: () => import_eslint_plugin_vue.default,
90
- pluginYml: () => pluginYml,
91
67
  prettier: () => prettier,
92
68
  sortPackageJson: () => sortPackageJson,
93
69
  sortTsconfig: () => sortTsconfig,
@@ -99,40 +75,17 @@ __export(src_exports, {
99
75
  });
100
76
  module.exports = __toCommonJS(src_exports);
101
77
 
102
- // src/plugins.ts
103
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
104
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
105
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
106
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
107
- var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
108
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
109
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
110
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
111
- var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
112
- var import_eslint_plugin_vitest = __toESM(require("eslint-plugin-vitest"), 1);
113
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
114
- var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
115
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
116
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
117
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
118
- var pluginNext = __toESM(require("@next/eslint-plugin-next"), 1);
119
- var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
120
- var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
121
- var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
122
- var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
123
- var pluginYml = __toESM(require("eslint-plugin-yml"), 1);
124
- var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
125
- var pluginJsonc = __toESM(require("eslint-plugin-jsonc"), 1);
126
- var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
127
- var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
128
-
129
78
  // src/configs/comments.ts
130
- function comments() {
79
+ async function comments() {
80
+ const pluginComments = await interopDefault(
81
+ // @ts-expect-error missing types
82
+ import("eslint-plugin-eslint-comments")
83
+ );
131
84
  return [
132
85
  {
133
86
  name: "eslint:eslint-comments",
134
87
  plugins: {
135
- "eslint-comments": import_eslint_plugin_eslint_comments.default
88
+ "eslint-comments": pluginComments
136
89
  },
137
90
  rules: {
138
91
  "eslint-comments/no-aggregating-enable": "error",
@@ -214,7 +167,7 @@ var GLOB_EXCLUDE = [
214
167
  // src/configs/ignores.ts
215
168
  var REGEX_SPLIT_ALL_CRLF = /\r?\n/g;
216
169
  var splitPattern = (pattern) => pattern.split(REGEX_SPLIT_ALL_CRLF);
217
- function ignores(options) {
170
+ async function ignores(options) {
218
171
  const { enableGitignore } = options;
219
172
  if (enableGitignore) {
220
173
  let ignorePath = ".gitignore";
@@ -239,13 +192,28 @@ function ignores(options) {
239
192
  ];
240
193
  }
241
194
 
195
+ // src/utils.ts
196
+ async function combine(...configs) {
197
+ const resolved = await Promise.all(configs);
198
+ return resolved.flat();
199
+ }
200
+ async function interopDefault(m) {
201
+ const resolved = await m;
202
+ return resolved.default || resolved;
203
+ }
204
+
242
205
  // src/configs/imports.ts
243
- function imports() {
206
+ async function imports() {
207
+ const [pluginAntfu, pluginImport] = await Promise.all([
208
+ interopDefault(import("eslint-plugin-antfu")),
209
+ // @ts-expect-error missing types
210
+ interopDefault(import("eslint-plugin-i"))
211
+ ]);
244
212
  return [
245
213
  {
246
214
  name: "eslint:imports",
247
215
  plugins: {
248
- antfu: import_eslint_plugin_antfu.default,
216
+ antfu: pluginAntfu,
249
217
  import: pluginImport
250
218
  },
251
219
  rules: {
@@ -269,9 +237,15 @@ function imports() {
269
237
 
270
238
  // src/configs/javascript.ts
271
239
  var import_globals = __toESM(require("globals"), 1);
272
- function javascript() {
240
+ async function javascript() {
241
+ const [pluginAntfu, pluginUnusedImports] = await Promise.all([
242
+ interopDefault(import("eslint-plugin-antfu")),
243
+ // @ts-expect-error missing types
244
+ interopDefault(import("eslint-plugin-unused-imports"))
245
+ ]);
273
246
  return [
274
247
  {
248
+ name: "eslint:javascript",
275
249
  languageOptions: {
276
250
  ecmaVersion: 2022,
277
251
  globals: {
@@ -294,10 +268,9 @@ function javascript() {
294
268
  linterOptions: {
295
269
  reportUnusedDisableDirectives: true
296
270
  },
297
- name: "eslint:javascript",
298
271
  plugins: {
299
- "antfu": import_eslint_plugin_antfu.default,
300
- "unused-imports": import_eslint_plugin_unused_imports.default
272
+ "antfu": pluginAntfu,
273
+ "unused-imports": pluginUnusedImports
301
274
  },
302
275
  rules: {
303
276
  "accessor-pairs": [
@@ -509,8 +482,8 @@ function javascript() {
509
482
  }
510
483
  },
511
484
  {
512
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
513
485
  name: "eslint:scripts-overrides",
486
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
514
487
  rules: {
515
488
  "no-console": "off"
516
489
  }
@@ -519,12 +492,13 @@ function javascript() {
519
492
  }
520
493
 
521
494
  // src/configs/jsdoc.ts
522
- function jsdoc() {
495
+ async function jsdoc() {
523
496
  return [
524
497
  {
525
498
  name: "eslint:jsdoc",
526
499
  plugins: {
527
- jsdoc: import_eslint_plugin_jsdoc.default
500
+ // @ts-expect-error missing types
501
+ jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
528
502
  },
529
503
  rules: {
530
504
  "jsdoc/check-access": "warn",
@@ -550,7 +524,11 @@ function jsdoc() {
550
524
  }
551
525
 
552
526
  // src/configs/jsonc.ts
553
- function jsonc() {
527
+ async function jsonc() {
528
+ const [pluginJsonc, parserJsonc] = await Promise.all([
529
+ interopDefault(import("eslint-plugin-jsonc")),
530
+ interopDefault(import("jsonc-eslint-parser"))
531
+ ]);
554
532
  return [
555
533
  {
556
534
  name: "eslint:jsonc:setup",
@@ -559,11 +537,11 @@ function jsonc() {
559
537
  }
560
538
  },
561
539
  {
540
+ name: "eslint:jsonc:rules",
562
541
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
563
542
  languageOptions: {
564
- parser: import_jsonc_eslint_parser.default
543
+ parser: parserJsonc
565
544
  },
566
- name: "eslint:jsonc:rules",
567
545
  rules: {
568
546
  "jsonc/no-bigint-literals": "error",
569
547
  "jsonc/no-binary-expression": "error",
@@ -616,21 +594,23 @@ function jsonc() {
616
594
  }
617
595
 
618
596
  // src/configs/markdown.ts
619
- function markdown(options = {}) {
597
+ async function markdown(options = {}) {
620
598
  const { componentExts = [] } = options;
621
599
  return [
622
600
  {
623
- name: "antfu:markdown:setup",
601
+ name: "eslint:markdown:setup",
624
602
  plugins: {
625
- markdown: import_eslint_plugin_markdown.default
603
+ // @ts-expect-error missing types
604
+ markdown: await interopDefault(import("eslint-plugin-markdown"))
626
605
  }
627
606
  },
628
607
  {
608
+ name: "eslint:markdown:processor",
629
609
  files: [GLOB_MARKDOWN],
630
- name: "antfu:markdown:processor",
631
610
  processor: "markdown/markdown"
632
611
  },
633
612
  {
613
+ name: "eslint:markdown:rules",
634
614
  files: [
635
615
  GLOB_MARKDOWN_CODE,
636
616
  ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
@@ -642,7 +622,6 @@ function markdown(options = {}) {
642
622
  }
643
623
  }
644
624
  },
645
- name: "antfu:markdown:rules",
646
625
  rules: {
647
626
  "antfu/no-cjs-exports": "off",
648
627
  "antfu/no-ts-export-equal": "off",
@@ -689,12 +668,13 @@ function markdown(options = {}) {
689
668
  }
690
669
 
691
670
  // src/configs/node.ts
692
- function node() {
671
+ async function node() {
672
+ const pluginNode = await interopDefault(import("eslint-plugin-n"));
693
673
  return [
694
674
  {
695
675
  name: "eslint:node",
696
676
  plugins: {
697
- n: import_eslint_plugin_n.default
677
+ n: pluginNode
698
678
  },
699
679
  rules: {
700
680
  "n/handle-callback-err": ["error", "^(err|error)$"],
@@ -711,11 +691,11 @@ function node() {
711
691
  }
712
692
 
713
693
  // src/configs/sort.ts
714
- function sortPackageJson() {
694
+ async function sortPackageJson() {
715
695
  return [
716
696
  {
717
- files: ["**/package.json"],
718
697
  name: "eslint:sort-package-json",
698
+ files: ["**/package.json"],
719
699
  rules: {
720
700
  "jsonc/sort-array-values": [
721
701
  "error",
@@ -795,11 +775,11 @@ function sortPackageJson() {
795
775
  }
796
776
  ];
797
777
  }
798
- function sortTsconfig() {
778
+ async function sortTsconfig() {
799
779
  return [
800
780
  {
801
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
802
781
  name: "eslint:sort-tsconfig",
782
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
803
783
  rules: {
804
784
  "jsonc/sort-keys": [
805
785
  "error",
@@ -923,44 +903,49 @@ function sortTsconfig() {
923
903
 
924
904
  // src/configs/typescript.ts
925
905
  var import_node_process = __toESM(require("process"), 1);
926
- function typescript(options) {
906
+ var typeAwareRules = {
907
+ "dot-notation": "off",
908
+ "no-implied-eval": "off",
909
+ "no-throw-literal": "off",
910
+ "@typescript-eslint/await-thenable": "error",
911
+ "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
912
+ "@typescript-eslint/no-floating-promises": "error",
913
+ "@typescript-eslint/no-for-in-array": "error",
914
+ "@typescript-eslint/no-implied-eval": "error",
915
+ "@typescript-eslint/no-misused-promises": "error",
916
+ "@typescript-eslint/no-throw-literal": "error",
917
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
918
+ "@typescript-eslint/no-unsafe-argument": "error",
919
+ "@typescript-eslint/no-unsafe-assignment": "error",
920
+ "@typescript-eslint/no-unsafe-call": "error",
921
+ "@typescript-eslint/no-unsafe-member-access": "error",
922
+ "@typescript-eslint/no-unsafe-return": "error",
923
+ "@typescript-eslint/restrict-plus-operands": "error",
924
+ "@typescript-eslint/restrict-template-expressions": "error",
925
+ "@typescript-eslint/unbound-method": "error"
926
+ };
927
+ async function typescript(options) {
927
928
  const {
928
929
  componentExts = [],
929
930
  parserOptions = {},
930
931
  tsconfigPath
931
932
  } = options ?? {};
932
- const typeAwareRules = {
933
- "dot-notation": "off",
934
- "no-implied-eval": "off",
935
- "no-throw-literal": "off",
936
- "@typescript-eslint/await-thenable": "error",
937
- "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
938
- "@typescript-eslint/no-floating-promises": "error",
939
- "@typescript-eslint/no-for-in-array": "error",
940
- "@typescript-eslint/no-implied-eval": "error",
941
- "@typescript-eslint/no-misused-promises": "error",
942
- "@typescript-eslint/no-throw-literal": "error",
943
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
944
- "@typescript-eslint/no-unsafe-argument": "error",
945
- "@typescript-eslint/no-unsafe-assignment": "error",
946
- "@typescript-eslint/no-unsafe-call": "error",
947
- "@typescript-eslint/no-unsafe-member-access": "error",
948
- "@typescript-eslint/no-unsafe-return": "error",
949
- "@typescript-eslint/restrict-plus-operands": "error",
950
- "@typescript-eslint/restrict-template-expressions": "error",
951
- "@typescript-eslint/unbound-method": "error"
952
- };
933
+ const [pluginTs, parserTs, pluginAntfu] = await Promise.all([
934
+ interopDefault(import("@typescript-eslint/eslint-plugin")),
935
+ interopDefault(import("@typescript-eslint/parser")),
936
+ interopDefault(import("eslint-plugin-antfu"))
937
+ ]);
953
938
  return [
954
939
  {
955
940
  // Install the plugins without globs, so they can be configured separately.
956
941
  name: "eslint:typescript:setup",
957
942
  plugins: {
958
- "antfu": import_eslint_plugin_antfu.default,
959
- "import": pluginImport,
960
- "@typescript-eslint": import_eslint_plugin.default
943
+ "antfu": pluginAntfu,
944
+ "@typescript-eslint": pluginTs
961
945
  }
962
946
  },
963
947
  {
948
+ name: "eslint:typescript:rules",
964
949
  files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
965
950
  languageOptions: {
966
951
  parser: parserTs,
@@ -974,10 +959,9 @@ function typescript(options) {
974
959
  ...parserOptions
975
960
  }
976
961
  },
977
- name: "eslint:typescript:rules",
978
962
  rules: {
979
- ...import_eslint_plugin.default.configs["eslint-recommended"].overrides[0].rules,
980
- ...import_eslint_plugin.default.configs.strict.rules,
963
+ ...pluginTs.configs["eslint-recommended"].overrides[0].rules,
964
+ ...pluginTs.configs.strict.rules,
981
965
  "antfu/generic-spacing": "error",
982
966
  "antfu/named-tuple-spacing": "error",
983
967
  "antfu/no-cjs-exports": "error",
@@ -1027,8 +1011,8 @@ function typescript(options) {
1027
1011
  }
1028
1012
  },
1029
1013
  {
1030
- files: ["**/*.d.ts"],
1031
1014
  name: "eslint:typescript:dts-overrides",
1015
+ files: ["**/*.d.ts"],
1032
1016
  rules: {
1033
1017
  "eslint-comments/no-unlimited-disable": "off",
1034
1018
  "import/no-duplicates": "off",
@@ -1037,8 +1021,8 @@ function typescript(options) {
1037
1021
  }
1038
1022
  },
1039
1023
  {
1040
- files: ["**/*.{test,spec}.ts?(x)"],
1041
1024
  name: "eslint:typescript:tests-overrides",
1025
+ files: ["**/*.{test,spec}.ts?(x)"],
1042
1026
  rules: {
1043
1027
  "no-unused-expressions": "off"
1044
1028
  }
@@ -1055,12 +1039,13 @@ function typescript(options) {
1055
1039
  }
1056
1040
 
1057
1041
  // src/configs/unicorn.ts
1058
- function unicorn() {
1042
+ async function unicorn() {
1043
+ const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
1059
1044
  return [
1060
1045
  {
1061
1046
  name: "eslint:unicorn",
1062
1047
  plugins: {
1063
- unicorn: import_eslint_plugin_unicorn.default
1048
+ unicorn: pluginUnicorn
1064
1049
  },
1065
1050
  rules: {
1066
1051
  // Pass error message when throwing errors
@@ -1095,34 +1080,41 @@ function unicorn() {
1095
1080
  }
1096
1081
 
1097
1082
  // src/configs/vue.ts
1098
- function vue(options = {}) {
1083
+ async function vue(options = {}) {
1084
+ const [pluginVue, parserVue] = await Promise.all([
1085
+ // @ts-expect-error missing types
1086
+ interopDefault(import("eslint-plugin-vue")),
1087
+ interopDefault(import("vue-eslint-parser"))
1088
+ ]);
1099
1089
  return [
1100
1090
  {
1101
1091
  name: "eslint:vue:setup",
1102
1092
  plugins: {
1103
- vue: import_eslint_plugin_vue.default
1093
+ vue: pluginVue
1104
1094
  }
1105
1095
  },
1106
1096
  {
1097
+ name: "eslint:vue:rules",
1107
1098
  files: [GLOB_VUE],
1108
1099
  languageOptions: {
1109
- parser: import_vue_eslint_parser.default,
1100
+ parser: parserVue,
1110
1101
  parserOptions: {
1111
1102
  ecmaFeatures: {
1112
1103
  jsx: true
1113
1104
  },
1114
1105
  extraFileExtensions: [".vue"],
1115
- parser: options.typescript ? parserTs : null,
1106
+ parser: options.typescript ? await interopDefault(
1107
+ import("@typescript-eslint/parser")
1108
+ ) : null,
1116
1109
  sourceType: "module"
1117
1110
  }
1118
1111
  },
1119
- name: "eslint:vue:rules",
1120
- processor: import_eslint_plugin_vue.default.processors[".vue"],
1112
+ processor: pluginVue.processors[".vue"],
1121
1113
  rules: {
1122
- ...import_eslint_plugin_vue.default.configs.base.rules,
1123
- ...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
1124
- ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
1125
- ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules,
1114
+ ...pluginVue.configs.base.rules,
1115
+ ...pluginVue.configs["vue3-essential"].rules,
1116
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
1117
+ ...pluginVue.configs["vue3-recommended"].rules,
1126
1118
  "node/prefer-global/process": "off",
1127
1119
  "vue/block-order": [
1128
1120
  "error",
@@ -1228,7 +1220,11 @@ function vue(options = {}) {
1228
1220
  }
1229
1221
 
1230
1222
  // src/configs/yml.ts
1231
- function yml() {
1223
+ async function yml() {
1224
+ const [pluginYml, parserYml] = await Promise.all([
1225
+ interopDefault(import("eslint-plugin-yml")),
1226
+ interopDefault(import("yaml-eslint-parser"))
1227
+ ]);
1232
1228
  return [
1233
1229
  {
1234
1230
  name: "eslint:yaml:setup",
@@ -1237,11 +1233,11 @@ function yml() {
1237
1233
  }
1238
1234
  },
1239
1235
  {
1236
+ name: "eslint:yaml:rules",
1240
1237
  files: [GLOB_YAML],
1241
1238
  languageOptions: {
1242
- parser: import_yaml_eslint_parser.default
1239
+ parser: parserYml
1243
1240
  },
1244
- name: "eslint:yaml:rules",
1245
1241
  rules: {
1246
1242
  ...pluginYml.configs.standard.rules,
1247
1243
  ...pluginYml.configs.prettier.rules,
@@ -1259,24 +1255,29 @@ function yml() {
1259
1255
  }
1260
1256
 
1261
1257
  // src/configs/test.ts
1262
- function test() {
1258
+ async function test() {
1259
+ const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
1260
+ interopDefault(import("eslint-plugin-vitest")),
1261
+ // @ts-expect-error missing types
1262
+ interopDefault(import("eslint-plugin-no-only-tests"))
1263
+ ]);
1263
1264
  return [
1264
1265
  {
1265
1266
  name: "eslint:test:setup",
1266
1267
  plugins: {
1267
1268
  test: {
1268
- ...import_eslint_plugin_vitest.default,
1269
+ ...pluginVitest,
1269
1270
  rules: {
1270
- ...import_eslint_plugin_vitest.default.rules,
1271
+ ...pluginVitest.rules,
1271
1272
  // extend `test/no-only-tests` rule
1272
- ...import_eslint_plugin_no_only_tests.default.rules
1273
+ ...pluginNoOnlyTests.rules
1273
1274
  }
1274
1275
  }
1275
1276
  }
1276
1277
  },
1277
1278
  {
1278
- files: GLOB_TESTS,
1279
1279
  name: "eslint:test:rules",
1280
+ files: GLOB_TESTS,
1280
1281
  rules: {
1281
1282
  "test/consistent-test-it": [
1282
1283
  "error",
@@ -1292,28 +1293,37 @@ function test() {
1292
1293
  }
1293
1294
 
1294
1295
  // src/configs/perfectionist.ts
1295
- function perfectionist() {
1296
+ async function perfectionist() {
1297
+ const pluginPerfectionist = await interopDefault(
1298
+ // @ts-expect-error missing types
1299
+ import("eslint-plugin-perfectionist")
1300
+ );
1296
1301
  return [
1297
1302
  {
1298
1303
  name: "eslint:perfectionist",
1299
1304
  plugins: {
1300
- perfectionist: import_eslint_plugin_perfectionist.default
1305
+ perfectionist: pluginPerfectionist
1301
1306
  }
1302
1307
  }
1303
1308
  ];
1304
1309
  }
1305
1310
 
1306
1311
  // src/configs/prettier.ts
1307
- function prettier(options) {
1312
+ async function prettier(options) {
1313
+ const [pluginPrettier, configPrettier] = await Promise.all([
1314
+ interopDefault(import("eslint-plugin-prettier")),
1315
+ // @ts-expect-error missing types
1316
+ interopDefault(import("eslint-config-prettier"))
1317
+ ]);
1308
1318
  return [
1309
1319
  {
1310
1320
  name: "eslint:prettier",
1311
1321
  plugins: {
1312
- prettier: import_eslint_plugin_prettier.default
1322
+ prettier: pluginPrettier
1313
1323
  },
1314
1324
  rules: {
1315
- ...import_eslint_config_prettier.default.rules,
1316
- ...import_eslint_plugin_prettier.default.configs.recommended.rules,
1325
+ ...configPrettier.rules,
1326
+ ...pluginPrettier.configs.recommended.rules,
1317
1327
  "prettier/prettier": [
1318
1328
  "warn",
1319
1329
  {
@@ -1326,17 +1336,31 @@ function prettier(options) {
1326
1336
  ];
1327
1337
  }
1328
1338
 
1329
- // src/utils.ts
1330
- function combine(...configs) {
1331
- return configs.flat();
1332
- }
1333
-
1334
1339
  // src/configs/react.ts
1335
- function next() {
1340
+ async function next() {
1341
+ const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
1336
1342
  return [
1337
1343
  {
1344
+ name: "eslint:next:setup",
1338
1345
  plugins: {
1339
1346
  "@next/next": pluginNext
1347
+ }
1348
+ },
1349
+ {
1350
+ name: "eslint:next:rules",
1351
+ files: [GLOB_TSX, GLOB_JSX],
1352
+ languageOptions: {
1353
+ parserOptions: {
1354
+ sourceType: "module",
1355
+ ecmaFeatures: {
1356
+ jsx: true
1357
+ }
1358
+ }
1359
+ },
1360
+ settings: {
1361
+ react: {
1362
+ version: "detect"
1363
+ }
1340
1364
  },
1341
1365
  rules: {
1342
1366
  ...pluginNext.configs.recommended.rules,
@@ -1345,45 +1369,69 @@ function next() {
1345
1369
  }
1346
1370
  ];
1347
1371
  }
1348
- function react(options = {}) {
1372
+ async function react(options = {}) {
1349
1373
  const { next: enableNext = false } = options;
1350
- const _react = {
1351
- name: "eslint:react",
1352
- plugins: {
1353
- "react": import_eslint_plugin_react.default,
1354
- "react-hooks": import_eslint_plugin_react_hooks.default
1355
- },
1356
- settings: {
1357
- react: {
1358
- version: "18.0"
1374
+ const [pluginReact, pluginReactHooks] = await Promise.all([
1375
+ // @ts-expect-error missing types
1376
+ interopDefault(import("eslint-plugin-react")),
1377
+ // @ts-expect-error missing types
1378
+ interopDefault(import("eslint-plugin-react-hooks"))
1379
+ ]);
1380
+ const _react = [
1381
+ {
1382
+ name: "eslint:react:setup",
1383
+ plugins: {
1384
+ "react": pluginReact,
1385
+ "react-hooks": pluginReactHooks
1359
1386
  }
1360
1387
  },
1361
- rules: {
1362
- ...import_eslint_plugin_react.default.configs.recommended.rules,
1363
- ...import_eslint_plugin_react_hooks.default.configs.recommended.rules,
1364
- "jsx-quotes": ["error", "prefer-double"],
1365
- "react/react-in-jsx-scope": "off",
1366
- "react/jsx-indent": [1, 2],
1367
- "react/jsx-indent-props": [1, 2],
1368
- "react/jsx-closing-bracket-location": [
1369
- 1,
1370
- { selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
1371
- ]
1388
+ {
1389
+ name: "eslint:react:rules",
1390
+ files: [GLOB_TSX, GLOB_JSX],
1391
+ languageOptions: {
1392
+ parserOptions: {
1393
+ sourceType: "module",
1394
+ ecmaFeatures: {
1395
+ jsx: true
1396
+ }
1397
+ }
1398
+ },
1399
+ settings: {
1400
+ react: {
1401
+ version: "detect"
1402
+ }
1403
+ },
1404
+ rules: {
1405
+ ...pluginReact.configs.recommended.rules,
1406
+ ...pluginReactHooks.configs.recommended.rules,
1407
+ "jsx-quotes": ["error", "prefer-double"],
1408
+ "react/react-in-jsx-scope": "off",
1409
+ "react/jsx-indent": [1, 2],
1410
+ "react/jsx-indent-props": [1, 2],
1411
+ "react/jsx-closing-bracket-location": [
1412
+ 1,
1413
+ { selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
1414
+ ]
1415
+ }
1372
1416
  }
1373
- };
1417
+ ];
1374
1418
  return combine(_react, enableNext ? next() : []);
1375
1419
  }
1376
1420
 
1377
1421
  // src/configs/tailwindcss.ts
1378
- function tailwindcss() {
1422
+ async function tailwindcss() {
1423
+ const pluginTailwindcss = await interopDefault(
1424
+ // @ts-expect-error missing types
1425
+ import("eslint-plugin-tailwindcss")
1426
+ );
1379
1427
  return [
1380
1428
  {
1381
1429
  name: "eslint:tailwindcss",
1382
1430
  plugins: {
1383
- tailwindcss: import_eslint_plugin_tailwindcss.default
1431
+ tailwindcss: pluginTailwindcss
1384
1432
  },
1385
1433
  rules: {
1386
- ...import_eslint_plugin_tailwindcss.default.configs.recommended.rules
1434
+ ...pluginTailwindcss.configs.recommended.rules
1387
1435
  }
1388
1436
  }
1389
1437
  ];
@@ -1490,39 +1538,15 @@ var src_default = config;
1490
1538
  combine,
1491
1539
  comments,
1492
1540
  config,
1493
- configPrettier,
1494
1541
  ignores,
1495
1542
  imports,
1543
+ interopDefault,
1496
1544
  javascript,
1497
1545
  jsdoc,
1498
1546
  jsonc,
1499
1547
  markdown,
1500
1548
  node,
1501
- parserJsonc,
1502
- parserTs,
1503
- parserVue,
1504
- parserYml,
1505
1549
  perfectionist,
1506
- pluginAntfu,
1507
- pluginComments,
1508
- pluginImport,
1509
- pluginJsdoc,
1510
- pluginJsonc,
1511
- pluginMarkdown,
1512
- pluginNext,
1513
- pluginNoOnlyTests,
1514
- pluginNode,
1515
- pluginPerfectionist,
1516
- pluginPrettier,
1517
- pluginReact,
1518
- pluginReactHooks,
1519
- pluginTailwindcss,
1520
- pluginTs,
1521
- pluginUnicorn,
1522
- pluginUnusedImports,
1523
- pluginVitest,
1524
- pluginVue,
1525
- pluginYml,
1526
1550
  prettier,
1527
1551
  sortPackageJson,
1528
1552
  sortTsconfig,