@2030/eslint-config 1.0.0-beta.2 → 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
@@ -67,6 +67,7 @@ __export(src_exports, {
67
67
  comments: () => comments,
68
68
  default: () => src_default,
69
69
  defaultPluginRenaming: () => defaultPluginRenaming,
70
+ disables: () => disables,
70
71
  ensurePackages: () => ensurePackages,
71
72
  formatters: () => formatters,
72
73
  getOverrides: () => getOverrides,
@@ -106,13 +107,13 @@ __export(src_exports, {
106
107
  });
107
108
  module.exports = __toCommonJS(src_exports);
108
109
 
109
- // node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.18.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
110
+ // node_modules/.pnpm/tsup@8.3.0_xbsphhdvxjfgldfrf2ivwsgage/node_modules/tsup/assets/cjs_shims.js
110
111
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
111
112
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
112
113
 
113
114
  // src/factory.ts
114
- var import_local_pkg4 = require("local-pkg");
115
115
  var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
116
+ var import_local_pkg4 = require("local-pkg");
116
117
 
117
118
  // src/globs.ts
118
119
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -200,7 +201,7 @@ var import_node_process = __toESM(require("process"), 1);
200
201
  var import_node_url = require("url");
201
202
  var import_local_pkg = require("local-pkg");
202
203
  var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
203
- var isCwdInScope = (0, import_local_pkg.isPackageExists)("@2030/eslint-config");
204
+ var isCwdInScope = (0, import_local_pkg.isPackageExists)("@jun2030/eslint-config");
204
205
  var parserPlain = {
205
206
  meta: {
206
207
  name: "parser-plain"
@@ -281,10 +282,10 @@ function isInEditorEnv() {
281
282
  return false;
282
283
  if (isInGitHooksOrLintStaged())
283
284
  return false;
284
- return !!import_node_process.default.env.VSCODE_PID || !!import_node_process.default.env.VSCODE_CWD || !!import_node_process.default.env.JETBRAINS_IDE || !!import_node_process.default.env.VIM || !!import_node_process.default.env.NVIM;
285
+ return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
285
286
  }
286
287
  function isInGitHooksOrLintStaged() {
287
- return !!import_node_process.default.env.GIT_PARAMS || !!import_node_process.default.env.VSCODE_GIT_COMMAND || !!import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged");
288
+ return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
288
289
  }
289
290
 
290
291
  // src/configs/astro.ts
@@ -338,7 +339,6 @@ async function astro(options = {}) {
338
339
  ...stylistic2 ? {
339
340
  "style/indent": "off",
340
341
  "style/jsx-closing-tag-location": "off",
341
- "style/jsx-indent": "off",
342
342
  "style/jsx-one-expression-per-line": "off",
343
343
  "style/no-multiple-empty-lines": "off"
344
344
  } : {},
@@ -360,13 +360,13 @@ async function command() {
360
360
  }
361
361
 
362
362
  // src/plugins.ts
363
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
364
363
  var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
364
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
365
365
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
366
366
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
367
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
367
368
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
368
369
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
369
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
370
370
 
371
371
  // src/configs/comments.ts
372
372
  async function comments() {
@@ -386,6 +386,63 @@ async function comments() {
386
386
  ];
387
387
  }
388
388
 
389
+ // src/configs/disables.ts
390
+ async function disables() {
391
+ return [
392
+ {
393
+ files: [`**/scripts/${GLOB_SRC}`],
394
+ name: "jun/disables/scripts",
395
+ rules: {
396
+ "jun/no-top-level-await": "off",
397
+ "no-console": "off",
398
+ "ts/explicit-function-return-type": "off"
399
+ }
400
+ },
401
+ {
402
+ files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
403
+ name: "jun/disables/cli",
404
+ rules: {
405
+ "jun/no-top-level-await": "off",
406
+ "no-console": "off"
407
+ }
408
+ },
409
+ {
410
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
411
+ name: "jun/disables/bin",
412
+ rules: {
413
+ "jun/no-import-dist": "off",
414
+ "jun/no-import-node-modules-by-path": "off"
415
+ }
416
+ },
417
+ {
418
+ files: ["**/*.d.?([cm])ts"],
419
+ name: "jun/disables/dts",
420
+ rules: {
421
+ "eslint-comments/no-unlimited-disable": "off",
422
+ "import/no-duplicates": "off",
423
+ "no-restricted-syntax": "off",
424
+ "unused-imports/no-unused-vars": "off"
425
+ }
426
+ },
427
+ {
428
+ files: ["**/*.js", "**/*.cjs"],
429
+ name: "jun/disables/cjs",
430
+ rules: {
431
+ "ts/no-require-imports": "off"
432
+ }
433
+ },
434
+ {
435
+ files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
436
+ name: "jun/disables/config-files",
437
+ rules: {
438
+ "jun/no-top-level-await": "off",
439
+ "no-console": "off",
440
+ "ts/explicit-function-return-type": "off"
441
+ }
442
+ }
443
+ ];
444
+ }
445
+
389
446
  // src/configs/formatters.ts
390
447
  var import_local_pkg2 = require("local-pkg");
391
448
 
@@ -426,6 +483,7 @@ async function stylistic(options = {}) {
426
483
  },
427
484
  rules: {
428
485
  ...config.rules,
486
+ "jun/consistent-chaining": "error",
429
487
  "jun/consistent-list-newline": "error",
430
488
  ...lessOpinionated ? {
431
489
  curly: ["error", "all"]
@@ -441,6 +499,16 @@ async function stylistic(options = {}) {
441
499
  }
442
500
 
443
501
  // src/configs/formatters.ts
502
+ function mergePrettierOptions(options, overrides = {}) {
503
+ return {
504
+ ...options,
505
+ ...overrides,
506
+ plugins: [
507
+ ...overrides.plugins || [],
508
+ ...options.plugins || []
509
+ ]
510
+ };
511
+ }
444
512
  async function formatters(options = {}, stylistic2 = {}) {
445
513
  if (options === true) {
446
514
  const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
@@ -517,10 +585,9 @@ async function formatters(options = {}, stylistic2 = {}) {
517
585
  rules: {
518
586
  "format/prettier": [
519
587
  "error",
520
- {
521
- ...prettierOptions,
588
+ mergePrettierOptions(prettierOptions, {
522
589
  parser: "css"
523
- }
590
+ })
524
591
  ]
525
592
  }
526
593
  },
@@ -533,10 +600,9 @@ async function formatters(options = {}, stylistic2 = {}) {
533
600
  rules: {
534
601
  "format/prettier": [
535
602
  "error",
536
- {
537
- ...prettierOptions,
603
+ mergePrettierOptions(prettierOptions, {
538
604
  parser: "scss"
539
- }
605
+ })
540
606
  ]
541
607
  }
542
608
  },
@@ -549,10 +615,9 @@ async function formatters(options = {}, stylistic2 = {}) {
549
615
  rules: {
550
616
  "format/prettier": [
551
617
  "error",
552
- {
553
- ...prettierOptions,
618
+ mergePrettierOptions(prettierOptions, {
554
619
  parser: "less"
555
- }
620
+ })
556
621
  ]
557
622
  }
558
623
  }
@@ -568,10 +633,9 @@ async function formatters(options = {}, stylistic2 = {}) {
568
633
  rules: {
569
634
  "format/prettier": [
570
635
  "error",
571
- {
572
- ...prettierOptions,
636
+ mergePrettierOptions(prettierOptions, {
573
637
  parser: "html"
574
- }
638
+ })
575
639
  ]
576
640
  }
577
641
  });
@@ -586,14 +650,12 @@ async function formatters(options = {}, stylistic2 = {}) {
586
650
  rules: {
587
651
  "format/prettier": [
588
652
  "error",
589
- {
590
- ...prettierXmlOptions,
591
- ...prettierOptions,
653
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
592
654
  parser: "xml",
593
655
  plugins: [
594
656
  "@prettier/plugin-xml"
595
657
  ]
596
- }
658
+ })
597
659
  ]
598
660
  }
599
661
  });
@@ -608,14 +670,12 @@ async function formatters(options = {}, stylistic2 = {}) {
608
670
  rules: {
609
671
  "format/prettier": [
610
672
  "error",
611
- {
612
- ...prettierXmlOptions,
613
- ...prettierOptions,
673
+ mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
614
674
  parser: "xml",
615
675
  plugins: [
616
676
  "@prettier/plugin-xml"
617
677
  ]
618
- }
678
+ })
619
679
  ]
620
680
  }
621
681
  });
@@ -633,11 +693,10 @@ async function formatters(options = {}, stylistic2 = {}) {
633
693
  rules: {
634
694
  [`format/${formater}`]: [
635
695
  "error",
636
- formater === "prettier" ? {
637
- ...prettierOptions,
696
+ formater === "prettier" ? mergePrettierOptions(prettierOptions, {
638
697
  embeddedLanguageFormatting: "off",
639
698
  parser: "markdown"
640
- } : {
699
+ }) : {
641
700
  ...dprintOptions,
642
701
  language: "markdown"
643
702
  }
@@ -654,14 +713,13 @@ async function formatters(options = {}, stylistic2 = {}) {
654
713
  rules: {
655
714
  "format/prettier": [
656
715
  "error",
657
- {
658
- ...prettierOptions,
716
+ mergePrettierOptions(prettierOptions, {
659
717
  embeddedLanguageFormatting: "off",
660
718
  parser: "slidev",
661
719
  plugins: [
662
720
  "prettier-plugin-slidev"
663
721
  ]
664
- }
722
+ })
665
723
  ]
666
724
  }
667
725
  });
@@ -677,13 +735,12 @@ async function formatters(options = {}, stylistic2 = {}) {
677
735
  rules: {
678
736
  "format/prettier": [
679
737
  "error",
680
- {
681
- ...prettierOptions,
738
+ mergePrettierOptions(prettierOptions, {
682
739
  parser: "astro",
683
740
  plugins: [
684
741
  "prettier-plugin-astro"
685
742
  ]
686
- }
743
+ })
687
744
  ]
688
745
  }
689
746
  });
@@ -711,10 +768,9 @@ async function formatters(options = {}, stylistic2 = {}) {
711
768
  rules: {
712
769
  "format/prettier": [
713
770
  "error",
714
- {
715
- ...prettierOptions,
771
+ mergePrettierOptions(prettierOptions, {
716
772
  parser: "graphql"
717
- }
773
+ })
718
774
  ]
719
775
  }
720
776
  });
@@ -723,10 +779,14 @@ async function formatters(options = {}, stylistic2 = {}) {
723
779
  }
724
780
 
725
781
  // src/configs/ignores.ts
726
- async function ignores() {
782
+ async function ignores(userIgnores = []) {
727
783
  return [
728
784
  {
729
- ignores: GLOB_EXCLUDE
785
+ ignores: [
786
+ ...GLOB_EXCLUDE,
787
+ ...userIgnores
788
+ ],
789
+ name: "jun/ignores"
730
790
  }
731
791
  ];
732
792
  }
@@ -750,7 +810,6 @@ async function imports(options = {}) {
750
810
  "import/no-named-default": "error",
751
811
  "import/no-self-import": "error",
752
812
  "import/no-webpack-loader-syntax": "error",
753
- "import/order": "error",
754
813
  "jun/import-dedupe": "error",
755
814
  "jun/no-import-dist": "error",
756
815
  "jun/no-import-node-modules-by-path": "error",
@@ -758,14 +817,6 @@ async function imports(options = {}) {
758
817
  "import/newline-after-import": ["error", { count: 1 }]
759
818
  } : {}
760
819
  }
761
- },
762
- {
763
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
764
- name: "jun/imports/disables/bin",
765
- rules: {
766
- "jun/no-import-dist": "off",
767
- "jun/no-import-node-modules-by-path": "off"
768
- }
769
820
  }
770
821
  ];
771
822
  }
@@ -817,6 +868,7 @@ async function javascript(options = {}) {
817
868
  "default-case-last": "error",
818
869
  "dot-notation": ["error", { allowKeywords: true }],
819
870
  "eqeqeq": ["error", "smart"],
871
+ "jun/no-top-level-await": "error",
820
872
  "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
821
873
  "no-alert": "error",
822
874
  "no-array-constructor": "error",
@@ -882,9 +934,6 @@ async function javascript(options = {}) {
882
934
  ],
883
935
  "no-restricted-syntax": [
884
936
  "error",
885
- "DebuggerStatement",
886
- "LabeledStatement",
887
- "WithStatement",
888
937
  "TSEnumDeclaration[const=true]",
889
938
  "TSExportAssignment"
890
939
  ],
@@ -955,16 +1004,6 @@ async function javascript(options = {}) {
955
1004
  "prefer-rest-params": "error",
956
1005
  "prefer-spread": "error",
957
1006
  "prefer-template": "error",
958
- "sort-imports": [
959
- "error",
960
- {
961
- allowSeparatedGroups: false,
962
- ignoreCase: false,
963
- ignoreDeclarationSort: true,
964
- ignoreMemberSort: false,
965
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
966
- }
967
- ],
968
1007
  "symbol-description": "error",
969
1008
  "unicode-bom": ["error", "never"],
970
1009
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
@@ -984,13 +1023,6 @@ async function javascript(options = {}) {
984
1023
  "yoda": ["error", "never"],
985
1024
  ...overrides
986
1025
  }
987
- },
988
- {
989
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
990
- name: "jun/javascript/disables/cli",
991
- rules: {
992
- "no-console": "off"
993
- }
994
1026
  }
995
1027
  ];
996
1028
  }
@@ -1031,23 +1063,6 @@ async function jsdoc(options = {}) {
1031
1063
  ];
1032
1064
  }
1033
1065
 
1034
- // src/configs/jsx.ts
1035
- async function jsx() {
1036
- return [
1037
- {
1038
- files: [GLOB_JSX, GLOB_TSX],
1039
- languageOptions: {
1040
- parserOptions: {
1041
- ecmaFeatures: {
1042
- jsx: true
1043
- }
1044
- }
1045
- },
1046
- name: "jun/jsx/setup"
1047
- }
1048
- ];
1049
- }
1050
-
1051
1066
  // src/configs/jsonc.ts
1052
1067
  async function jsonc(options = {}) {
1053
1068
  const {
@@ -1123,6 +1138,23 @@ async function jsonc(options = {}) {
1123
1138
  ];
1124
1139
  }
1125
1140
 
1141
+ // src/configs/jsx.ts
1142
+ async function jsx() {
1143
+ return [
1144
+ {
1145
+ files: [GLOB_JSX, GLOB_TSX],
1146
+ languageOptions: {
1147
+ parserOptions: {
1148
+ ecmaFeatures: {
1149
+ jsx: true
1150
+ }
1151
+ }
1152
+ },
1153
+ name: "jun/jsx/setup"
1154
+ }
1155
+ ];
1156
+ }
1157
+
1126
1158
  // src/configs/markdown.ts
1127
1159
  var import_eslint_merge_processors = require("eslint-merge-processors");
1128
1160
  async function markdown(options = {}) {
@@ -1131,7 +1163,7 @@ async function markdown(options = {}) {
1131
1163
  files = [GLOB_MARKDOWN],
1132
1164
  overrides = {}
1133
1165
  } = options;
1134
- const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
1166
+ const markdown2 = await interopDefault(import("@eslint/markdown"));
1135
1167
  return [
1136
1168
  {
1137
1169
  name: "jun/markdown/setup",
@@ -1173,6 +1205,7 @@ async function markdown(options = {}) {
1173
1205
  name: "jun/markdown/disables",
1174
1206
  rules: {
1175
1207
  "import/newline-after-import": "off",
1208
+ "jun/no-top-level-await": "off",
1176
1209
  "no-alert": "off",
1177
1210
  "no-console": "off",
1178
1211
  "no-labels": "off",
@@ -1186,13 +1219,13 @@ async function markdown(options = {}) {
1186
1219
  "style/comma-dangle": "off",
1187
1220
  "style/eol-last": "off",
1188
1221
  "ts/consistent-type-imports": "off",
1222
+ "ts/explicit-function-return-type": "off",
1189
1223
  "ts/no-namespace": "off",
1190
1224
  "ts/no-redeclare": "off",
1191
1225
  "ts/no-require-imports": "off",
1192
1226
  "ts/no-unused-expressions": "off",
1193
1227
  "ts/no-unused-vars": "off",
1194
1228
  "ts/no-use-before-define": "off",
1195
- "ts/no-var-requires": "off",
1196
1229
  "unicode-bom": "off",
1197
1230
  "unused-imports/no-unused-imports": "off",
1198
1231
  "unused-imports/no-unused-vars": "off",
@@ -1231,6 +1264,27 @@ async function perfectionist() {
1231
1264
  name: "jun/perfectionist/setup",
1232
1265
  plugins: {
1233
1266
  perfectionist: import_eslint_plugin_perfectionist.default
1267
+ },
1268
+ rules: {
1269
+ "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
1270
+ "perfectionist/sort-imports": ["error", {
1271
+ groups: [
1272
+ "type",
1273
+ ["parent-type", "sibling-type", "index-type"],
1274
+ "builtin",
1275
+ "external",
1276
+ ["internal", "internal-type"],
1277
+ ["parent", "sibling", "index"],
1278
+ "side-effect",
1279
+ "object",
1280
+ "unknown"
1281
+ ],
1282
+ newlinesBetween: "ignore",
1283
+ order: "asc",
1284
+ type: "natural"
1285
+ }],
1286
+ "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
1287
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
1234
1288
  }
1235
1289
  }
1236
1290
  ];
@@ -1325,6 +1379,13 @@ async function react(options = {}) {
1325
1379
  allowConstantExport: isAllowConstantExport,
1326
1380
  allowExportNames: [
1327
1381
  ...isUsingNext ? [
1382
+ "dynamic",
1383
+ "dynamicParams",
1384
+ "revalidate",
1385
+ "fetchCache",
1386
+ "runtime",
1387
+ "preferredRegion",
1388
+ "maxDuration",
1328
1389
  "config",
1329
1390
  "generateStaticParams",
1330
1391
  "metadata",
@@ -1389,6 +1450,31 @@ async function react(options = {}) {
1389
1450
  ];
1390
1451
  }
1391
1452
 
1453
+ // src/configs/regexp.ts
1454
+ var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
1455
+ async function regexp(options = {}) {
1456
+ const config = import_eslint_plugin_regexp.configs["flat/recommended"];
1457
+ const rules = {
1458
+ ...config.rules
1459
+ };
1460
+ if (options.level === "warn") {
1461
+ for (const key in rules) {
1462
+ if (rules[key] === "error")
1463
+ rules[key] = "warn";
1464
+ }
1465
+ }
1466
+ return [
1467
+ {
1468
+ ...config,
1469
+ name: "jun/regexp/rules",
1470
+ rules: {
1471
+ ...rules,
1472
+ ...options.overrides
1473
+ }
1474
+ }
1475
+ ];
1476
+ }
1477
+
1392
1478
  // src/configs/solid.ts
1393
1479
  async function solid(options = {}) {
1394
1480
  const {
@@ -1829,14 +1915,19 @@ async function test(options = {}) {
1829
1915
  files,
1830
1916
  name: "jun/test/rules",
1831
1917
  rules: {
1832
- "node/prefer-global/process": "off",
1833
1918
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1834
1919
  "test/no-identical-title": "error",
1835
1920
  "test/no-import-node-test": "error",
1836
1921
  "test/no-only-tests": isInEditor ? "off" : "error",
1837
1922
  "test/prefer-hooks-in-order": "error",
1838
1923
  "test/prefer-lowercase-title": "error",
1839
- "ts/explicit-function-return-type": "off",
1924
+ // Disables
1925
+ ...{
1926
+ "jun/no-top-level-await": "off",
1927
+ "no-unused-expressions": "off",
1928
+ "node/prefer-global/process": "off",
1929
+ "ts/explicit-function-return-type": "off"
1930
+ },
1840
1931
  ...overrides
1841
1932
  }
1842
1933
  }
@@ -2005,7 +2096,6 @@ async function typescript(options = {}) {
2005
2096
  { "@typescript-eslint": "ts" }
2006
2097
  ),
2007
2098
  "no-dupe-class-members": "off",
2008
- "no-loss-of-precision": "off",
2009
2099
  "no-redeclare": "off",
2010
2100
  "no-use-before-define": "off",
2011
2101
  "no-useless-constructor": "off",
@@ -2024,10 +2114,14 @@ async function typescript(options = {}) {
2024
2114
  "ts/no-extraneous-class": "off",
2025
2115
  "ts/no-import-type-side-effects": "error",
2026
2116
  "ts/no-invalid-void-type": "off",
2027
- "ts/no-loss-of-precision": "error",
2028
2117
  "ts/no-non-null-assertion": "off",
2029
- "ts/no-redeclare": "error",
2118
+ "ts/no-redeclare": ["error", { builtinGlobals: false }],
2030
2119
  "ts/no-require-imports": "error",
2120
+ "ts/no-unused-expressions": ["error", {
2121
+ allowShortCircuit: true,
2122
+ allowTaggedTemplates: true,
2123
+ allowTernary: true
2124
+ }],
2031
2125
  "ts/no-unused-vars": "off",
2032
2126
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2033
2127
  "ts/no-useless-constructor": "off",
@@ -2052,37 +2146,12 @@ async function typescript(options = {}) {
2052
2146
  ...typeAwareRules,
2053
2147
  ...overridesTypeAware
2054
2148
  }
2055
- }] : [],
2056
- {
2057
- files: ["**/*.d.?([cm])ts"],
2058
- name: "jun/typescript/disables/dts",
2059
- rules: {
2060
- "eslint-comments/no-unlimited-disable": "off",
2061
- "import/no-duplicates": "off",
2062
- "no-restricted-syntax": "off",
2063
- "unused-imports/no-unused-vars": "off"
2064
- }
2065
- },
2066
- {
2067
- files: ["**/*.{test,spec}.ts?(x)"],
2068
- name: "jun/typescript/disables/test",
2069
- rules: {
2070
- "no-unused-expressions": "off"
2071
- }
2072
- },
2073
- {
2074
- files: ["**/*.js", "**/*.cjs"],
2075
- name: "jun/typescript/disables/cjs",
2076
- rules: {
2077
- "ts/no-require-imports": "off",
2078
- "ts/no-var-requires": "off"
2079
- }
2080
- }
2149
+ }] : []
2081
2150
  ];
2082
2151
  }
2083
2152
 
2084
2153
  // src/configs/unicorn.ts
2085
- async function unicorn() {
2154
+ async function unicorn(options = {}) {
2086
2155
  return [
2087
2156
  {
2088
2157
  name: "jun/unicorn/rules",
@@ -2090,32 +2159,23 @@ async function unicorn() {
2090
2159
  unicorn: import_eslint_plugin_unicorn.default
2091
2160
  },
2092
2161
  rules: {
2093
- // Pass error message when throwing errors
2094
- "unicorn/error-message": "error",
2095
- // Uppercase regex escapes
2096
- "unicorn/escape-case": "error",
2097
- // Array.isArray instead of instanceof
2098
- "unicorn/no-instanceof-array": "error",
2099
- // Ban `new Array` as `Array` constructor's params are ambiguous
2100
- "unicorn/no-new-array": "error",
2101
- // Prevent deprecated `new Buffer()`
2102
- "unicorn/no-new-buffer": "error",
2103
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
2104
- "unicorn/number-literal-case": "error",
2105
- // textContent instead of innerText
2106
- "unicorn/prefer-dom-node-text-content": "error",
2107
- // includes over indexOf when checking for existence
2108
- "unicorn/prefer-includes": "error",
2109
- // Prefer using the node: protocol
2110
- "unicorn/prefer-node-protocol": "error",
2111
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
2112
- "unicorn/prefer-number-properties": "error",
2113
- // String methods startsWith/endsWith instead of more complicated stuff
2114
- "unicorn/prefer-string-starts-ends-with": "error",
2115
- // Enforce throwing type error when throwing error while checking typeof
2116
- "unicorn/prefer-type-error": "error",
2117
- // Use new when throwing error
2118
- "unicorn/throw-new-error": "error"
2162
+ ...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
2163
+ "unicorn/consistent-empty-array-spread": "error",
2164
+ "unicorn/error-message": "error",
2165
+ "unicorn/escape-case": "error",
2166
+ "unicorn/new-for-builtins": "error",
2167
+ "unicorn/no-instanceof-array": "error",
2168
+ "unicorn/no-new-array": "error",
2169
+ "unicorn/no-new-buffer": "error",
2170
+ "unicorn/number-literal-case": "error",
2171
+ "unicorn/prefer-dom-node-text-content": "error",
2172
+ "unicorn/prefer-includes": "error",
2173
+ "unicorn/prefer-node-protocol": "error",
2174
+ "unicorn/prefer-number-properties": "error",
2175
+ "unicorn/prefer-string-starts-ends-with": "error",
2176
+ "unicorn/prefer-type-error": "error",
2177
+ "unicorn/throw-new-error": "error"
2178
+ }
2119
2179
  }
2120
2180
  }
2121
2181
  ];
@@ -2239,7 +2299,9 @@ async function vue(options = {}) {
2239
2299
  ...pluginVue.configs["vue3-strongly-recommended"].rules,
2240
2300
  ...pluginVue.configs["vue3-recommended"].rules
2241
2301
  },
2302
+ "jun/no-top-level-await": "off",
2242
2303
  "node/prefer-global/process": "off",
2304
+ "ts/explicit-function-return-type": "off",
2243
2305
  "vue/block-order": ["error", {
2244
2306
  order: ["script", "template", "style"]
2245
2307
  }],
@@ -2297,7 +2359,7 @@ async function vue(options = {}) {
2297
2359
  multiline: "always",
2298
2360
  singleline: "always"
2299
2361
  }],
2300
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
2362
+ "vue/brace-style": ["error", "1tbs", { allowSingleLine: true }],
2301
2363
  "vue/comma-dangle": ["error", "always-multiline"],
2302
2364
  "vue/comma-spacing": ["error", { after: true, before: false }],
2303
2365
  "vue/comma-style": ["error", "last"],
@@ -2380,36 +2442,9 @@ async function yaml(options = {}) {
2380
2442
  ];
2381
2443
  }
2382
2444
 
2383
- // src/configs/regexp.ts
2384
- var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
2385
- async function regexp(options = {}) {
2386
- const config = import_eslint_plugin_regexp.configs["flat/recommended"];
2387
- const rules = {
2388
- ...config.rules
2389
- };
2390
- if (options.level === "warn") {
2391
- for (const key in rules) {
2392
- if (rules[key] === "error")
2393
- rules[key] = "warn";
2394
- }
2395
- }
2396
- return [
2397
- {
2398
- ...config,
2399
- name: "jun/regexp/rules",
2400
- rules: {
2401
- ...rules,
2402
- ...options.overrides
2403
- }
2404
- }
2405
- ];
2406
- }
2407
-
2408
2445
  // src/factory.ts
2409
2446
  var flatConfigProps = [
2410
2447
  "name",
2411
- "files",
2412
- "ignores",
2413
2448
  "languageOptions",
2414
2449
  "linterOptions",
2415
2450
  "processor",
@@ -2447,6 +2482,7 @@ function jun(options = {}, ...userConfigs) {
2447
2482
  solid: enableSolid = false,
2448
2483
  svelte: enableSvelte = false,
2449
2484
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2485
+ unicorn: enableUnicorn = true,
2450
2486
  unocss: enableUnoCSS = false,
2451
2487
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2452
2488
  } = options;
@@ -2462,15 +2498,21 @@ function jun(options = {}, ...userConfigs) {
2462
2498
  const configs2 = [];
2463
2499
  if (enableGitignore) {
2464
2500
  if (typeof enableGitignore !== "boolean") {
2465
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2501
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2502
+ name: "jun/gitignore",
2503
+ ...enableGitignore
2504
+ })]));
2466
2505
  } else {
2467
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
2506
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2507
+ name: "jun/gitignore",
2508
+ strict: false
2509
+ })]));
2468
2510
  }
2469
2511
  }
2470
2512
  const typescriptOptions = resolveSubOptions(options, "typescript");
2471
2513
  const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2472
2514
  configs2.push(
2473
- ignores(),
2515
+ ignores(options.ignores),
2474
2516
  javascript({
2475
2517
  isInEditor,
2476
2518
  overrides: getOverrides(options, "javascript")
@@ -2483,11 +2525,13 @@ function jun(options = {}, ...userConfigs) {
2483
2525
  imports({
2484
2526
  stylistic: stylisticOptions
2485
2527
  }),
2486
- unicorn(),
2487
2528
  command(),
2488
2529
  // Optional plugins (installed but not enabled by default)
2489
2530
  perfectionist()
2490
2531
  );
2532
+ if (enableUnicorn) {
2533
+ configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2534
+ }
2491
2535
  if (enableVue) {
2492
2536
  componentExts.push("vue");
2493
2537
  }
@@ -2596,6 +2640,12 @@ function jun(options = {}, ...userConfigs) {
2596
2640
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2597
2641
  ));
2598
2642
  }
2643
+ configs2.push(
2644
+ disables()
2645
+ );
2646
+ if ("files" in options) {
2647
+ throw new Error('[@jun2030/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.');
2648
+ }
2599
2649
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
2600
2650
  if (key in options)
2601
2651
  acc[key] = options[key];
@@ -2664,6 +2714,7 @@ var src_default = jun;
2664
2714
  command,
2665
2715
  comments,
2666
2716
  defaultPluginRenaming,
2717
+ disables,
2667
2718
  ensurePackages,
2668
2719
  formatters,
2669
2720
  getOverrides,