@2030/eslint-config 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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,7 @@ 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
- ],
1007
+ "style/brace-style": ["error", "1tbs", { allowSingleLine: true }],
968
1008
  "symbol-description": "error",
969
1009
  "unicode-bom": ["error", "never"],
970
1010
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
@@ -984,13 +1024,6 @@ async function javascript(options = {}) {
984
1024
  "yoda": ["error", "never"],
985
1025
  ...overrides
986
1026
  }
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
1027
  }
995
1028
  ];
996
1029
  }
@@ -1031,23 +1064,6 @@ async function jsdoc(options = {}) {
1031
1064
  ];
1032
1065
  }
1033
1066
 
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
1067
  // src/configs/jsonc.ts
1052
1068
  async function jsonc(options = {}) {
1053
1069
  const {
@@ -1123,6 +1139,23 @@ async function jsonc(options = {}) {
1123
1139
  ];
1124
1140
  }
1125
1141
 
1142
+ // src/configs/jsx.ts
1143
+ async function jsx() {
1144
+ return [
1145
+ {
1146
+ files: [GLOB_JSX, GLOB_TSX],
1147
+ languageOptions: {
1148
+ parserOptions: {
1149
+ ecmaFeatures: {
1150
+ jsx: true
1151
+ }
1152
+ }
1153
+ },
1154
+ name: "jun/jsx/setup"
1155
+ }
1156
+ ];
1157
+ }
1158
+
1126
1159
  // src/configs/markdown.ts
1127
1160
  var import_eslint_merge_processors = require("eslint-merge-processors");
1128
1161
  async function markdown(options = {}) {
@@ -1131,7 +1164,7 @@ async function markdown(options = {}) {
1131
1164
  files = [GLOB_MARKDOWN],
1132
1165
  overrides = {}
1133
1166
  } = options;
1134
- const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
1167
+ const markdown2 = await interopDefault(import("@eslint/markdown"));
1135
1168
  return [
1136
1169
  {
1137
1170
  name: "jun/markdown/setup",
@@ -1173,6 +1206,7 @@ async function markdown(options = {}) {
1173
1206
  name: "jun/markdown/disables",
1174
1207
  rules: {
1175
1208
  "import/newline-after-import": "off",
1209
+ "jun/no-top-level-await": "off",
1176
1210
  "no-alert": "off",
1177
1211
  "no-console": "off",
1178
1212
  "no-labels": "off",
@@ -1186,13 +1220,13 @@ async function markdown(options = {}) {
1186
1220
  "style/comma-dangle": "off",
1187
1221
  "style/eol-last": "off",
1188
1222
  "ts/consistent-type-imports": "off",
1223
+ "ts/explicit-function-return-type": "off",
1189
1224
  "ts/no-namespace": "off",
1190
1225
  "ts/no-redeclare": "off",
1191
1226
  "ts/no-require-imports": "off",
1192
1227
  "ts/no-unused-expressions": "off",
1193
1228
  "ts/no-unused-vars": "off",
1194
1229
  "ts/no-use-before-define": "off",
1195
- "ts/no-var-requires": "off",
1196
1230
  "unicode-bom": "off",
1197
1231
  "unused-imports/no-unused-imports": "off",
1198
1232
  "unused-imports/no-unused-vars": "off",
@@ -1231,6 +1265,27 @@ async function perfectionist() {
1231
1265
  name: "jun/perfectionist/setup",
1232
1266
  plugins: {
1233
1267
  perfectionist: import_eslint_plugin_perfectionist.default
1268
+ },
1269
+ rules: {
1270
+ "perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
1271
+ "perfectionist/sort-imports": ["error", {
1272
+ groups: [
1273
+ "type",
1274
+ ["parent-type", "sibling-type", "index-type"],
1275
+ "builtin",
1276
+ "external",
1277
+ ["internal", "internal-type"],
1278
+ ["parent", "sibling", "index"],
1279
+ "side-effect",
1280
+ "object",
1281
+ "unknown"
1282
+ ],
1283
+ newlinesBetween: "ignore",
1284
+ order: "asc",
1285
+ type: "natural"
1286
+ }],
1287
+ "perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
1288
+ "perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
1234
1289
  }
1235
1290
  }
1236
1291
  ];
@@ -1325,6 +1380,13 @@ async function react(options = {}) {
1325
1380
  allowConstantExport: isAllowConstantExport,
1326
1381
  allowExportNames: [
1327
1382
  ...isUsingNext ? [
1383
+ "dynamic",
1384
+ "dynamicParams",
1385
+ "revalidate",
1386
+ "fetchCache",
1387
+ "runtime",
1388
+ "preferredRegion",
1389
+ "maxDuration",
1328
1390
  "config",
1329
1391
  "generateStaticParams",
1330
1392
  "metadata",
@@ -1389,6 +1451,31 @@ async function react(options = {}) {
1389
1451
  ];
1390
1452
  }
1391
1453
 
1454
+ // src/configs/regexp.ts
1455
+ var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
1456
+ async function regexp(options = {}) {
1457
+ const config = import_eslint_plugin_regexp.configs["flat/recommended"];
1458
+ const rules = {
1459
+ ...config.rules
1460
+ };
1461
+ if (options.level === "warn") {
1462
+ for (const key in rules) {
1463
+ if (rules[key] === "error")
1464
+ rules[key] = "warn";
1465
+ }
1466
+ }
1467
+ return [
1468
+ {
1469
+ ...config,
1470
+ name: "jun/regexp/rules",
1471
+ rules: {
1472
+ ...rules,
1473
+ ...options.overrides
1474
+ }
1475
+ }
1476
+ ];
1477
+ }
1478
+
1392
1479
  // src/configs/solid.ts
1393
1480
  async function solid(options = {}) {
1394
1481
  const {
@@ -1829,14 +1916,19 @@ async function test(options = {}) {
1829
1916
  files,
1830
1917
  name: "jun/test/rules",
1831
1918
  rules: {
1832
- "node/prefer-global/process": "off",
1833
1919
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
1834
1920
  "test/no-identical-title": "error",
1835
1921
  "test/no-import-node-test": "error",
1836
1922
  "test/no-only-tests": isInEditor ? "off" : "error",
1837
1923
  "test/prefer-hooks-in-order": "error",
1838
1924
  "test/prefer-lowercase-title": "error",
1839
- "ts/explicit-function-return-type": "off",
1925
+ // Disables
1926
+ ...{
1927
+ "jun/no-top-level-await": "off",
1928
+ "no-unused-expressions": "off",
1929
+ "node/prefer-global/process": "off",
1930
+ "ts/explicit-function-return-type": "off"
1931
+ },
1840
1932
  ...overrides
1841
1933
  }
1842
1934
  }
@@ -1928,6 +2020,7 @@ async function typescript(options = {}) {
1928
2020
  "dot-notation": "off",
1929
2021
  "no-implied-eval": "off",
1930
2022
  "ts/await-thenable": "error",
2023
+ "ts/brace-style": ["error", "1tbs", { allowSingleLine: true }],
1931
2024
  "ts/dot-notation": ["error", { allowKeywords: true }],
1932
2025
  "ts/no-floating-promises": "error",
1933
2026
  "ts/no-for-in-array": "error",
@@ -2005,7 +2098,6 @@ async function typescript(options = {}) {
2005
2098
  { "@typescript-eslint": "ts" }
2006
2099
  ),
2007
2100
  "no-dupe-class-members": "off",
2008
- "no-loss-of-precision": "off",
2009
2101
  "no-redeclare": "off",
2010
2102
  "no-use-before-define": "off",
2011
2103
  "no-useless-constructor": "off",
@@ -2024,10 +2116,14 @@ async function typescript(options = {}) {
2024
2116
  "ts/no-extraneous-class": "off",
2025
2117
  "ts/no-import-type-side-effects": "error",
2026
2118
  "ts/no-invalid-void-type": "off",
2027
- "ts/no-loss-of-precision": "error",
2028
2119
  "ts/no-non-null-assertion": "off",
2029
- "ts/no-redeclare": "error",
2120
+ "ts/no-redeclare": ["error", { builtinGlobals: false }],
2030
2121
  "ts/no-require-imports": "error",
2122
+ "ts/no-unused-expressions": ["error", {
2123
+ allowShortCircuit: true,
2124
+ allowTaggedTemplates: true,
2125
+ allowTernary: true
2126
+ }],
2031
2127
  "ts/no-unused-vars": "off",
2032
2128
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
2033
2129
  "ts/no-useless-constructor": "off",
@@ -2052,37 +2148,12 @@ async function typescript(options = {}) {
2052
2148
  ...typeAwareRules,
2053
2149
  ...overridesTypeAware
2054
2150
  }
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
- }
2151
+ }] : []
2081
2152
  ];
2082
2153
  }
2083
2154
 
2084
2155
  // src/configs/unicorn.ts
2085
- async function unicorn() {
2156
+ async function unicorn(options = {}) {
2086
2157
  return [
2087
2158
  {
2088
2159
  name: "jun/unicorn/rules",
@@ -2090,32 +2161,23 @@ async function unicorn() {
2090
2161
  unicorn: import_eslint_plugin_unicorn.default
2091
2162
  },
2092
2163
  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"
2164
+ ...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
2165
+ "unicorn/consistent-empty-array-spread": "error",
2166
+ "unicorn/error-message": "error",
2167
+ "unicorn/escape-case": "error",
2168
+ "unicorn/new-for-builtins": "error",
2169
+ "unicorn/no-instanceof-array": "error",
2170
+ "unicorn/no-new-array": "error",
2171
+ "unicorn/no-new-buffer": "error",
2172
+ "unicorn/number-literal-case": "error",
2173
+ "unicorn/prefer-dom-node-text-content": "error",
2174
+ "unicorn/prefer-includes": "error",
2175
+ "unicorn/prefer-node-protocol": "error",
2176
+ "unicorn/prefer-number-properties": "error",
2177
+ "unicorn/prefer-string-starts-ends-with": "error",
2178
+ "unicorn/prefer-type-error": "error",
2179
+ "unicorn/throw-new-error": "error"
2180
+ }
2119
2181
  }
2120
2182
  }
2121
2183
  ];
@@ -2239,7 +2301,9 @@ async function vue(options = {}) {
2239
2301
  ...pluginVue.configs["vue3-strongly-recommended"].rules,
2240
2302
  ...pluginVue.configs["vue3-recommended"].rules
2241
2303
  },
2304
+ "jun/no-top-level-await": "off",
2242
2305
  "node/prefer-global/process": "off",
2306
+ "ts/explicit-function-return-type": "off",
2243
2307
  "vue/block-order": ["error", {
2244
2308
  order: ["script", "template", "style"]
2245
2309
  }],
@@ -2297,7 +2361,7 @@ async function vue(options = {}) {
2297
2361
  multiline: "always",
2298
2362
  singleline: "always"
2299
2363
  }],
2300
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
2364
+ "vue/brace-style": ["error", "1tbs", { allowSingleLine: true }],
2301
2365
  "vue/comma-dangle": ["error", "always-multiline"],
2302
2366
  "vue/comma-spacing": ["error", { after: true, before: false }],
2303
2367
  "vue/comma-style": ["error", "last"],
@@ -2380,36 +2444,9 @@ async function yaml(options = {}) {
2380
2444
  ];
2381
2445
  }
2382
2446
 
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
2447
  // src/factory.ts
2409
2448
  var flatConfigProps = [
2410
2449
  "name",
2411
- "files",
2412
- "ignores",
2413
2450
  "languageOptions",
2414
2451
  "linterOptions",
2415
2452
  "processor",
@@ -2447,6 +2484,7 @@ function jun(options = {}, ...userConfigs) {
2447
2484
  solid: enableSolid = false,
2448
2485
  svelte: enableSvelte = false,
2449
2486
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2487
+ unicorn: enableUnicorn = true,
2450
2488
  unocss: enableUnoCSS = false,
2451
2489
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
2452
2490
  } = options;
@@ -2462,15 +2500,21 @@ function jun(options = {}, ...userConfigs) {
2462
2500
  const configs2 = [];
2463
2501
  if (enableGitignore) {
2464
2502
  if (typeof enableGitignore !== "boolean") {
2465
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
2503
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2504
+ name: "jun/gitignore",
2505
+ ...enableGitignore
2506
+ })]));
2466
2507
  } else {
2467
- configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
2508
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
2509
+ name: "jun/gitignore",
2510
+ strict: false
2511
+ })]));
2468
2512
  }
2469
2513
  }
2470
2514
  const typescriptOptions = resolveSubOptions(options, "typescript");
2471
2515
  const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2472
2516
  configs2.push(
2473
- ignores(),
2517
+ ignores(options.ignores),
2474
2518
  javascript({
2475
2519
  isInEditor,
2476
2520
  overrides: getOverrides(options, "javascript")
@@ -2483,11 +2527,13 @@ function jun(options = {}, ...userConfigs) {
2483
2527
  imports({
2484
2528
  stylistic: stylisticOptions
2485
2529
  }),
2486
- unicorn(),
2487
2530
  command(),
2488
2531
  // Optional plugins (installed but not enabled by default)
2489
2532
  perfectionist()
2490
2533
  );
2534
+ if (enableUnicorn) {
2535
+ configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2536
+ }
2491
2537
  if (enableVue) {
2492
2538
  componentExts.push("vue");
2493
2539
  }
@@ -2596,6 +2642,12 @@ function jun(options = {}, ...userConfigs) {
2596
2642
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
2597
2643
  ));
2598
2644
  }
2645
+ configs2.push(
2646
+ disables()
2647
+ );
2648
+ if ("files" in options) {
2649
+ 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.');
2650
+ }
2599
2651
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
2600
2652
  if (key in options)
2601
2653
  acc[key] = options[key];
@@ -2664,6 +2716,7 @@ var src_default = jun;
2664
2716
  command,
2665
2717
  comments,
2666
2718
  defaultPluginRenaming,
2719
+ disables,
2667
2720
  ensurePackages,
2668
2721
  formatters,
2669
2722
  getOverrides,