@jsse/eslint-config 0.2.20 → 0.2.21

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.
Files changed (136) hide show
  1. package/dist/cli.cjs +1 -1
  2. package/dist/cli.js +1 -1
  3. package/dist/esm/cli.d.ts +1 -0
  4. package/dist/esm/cli.js +96 -0
  5. package/dist/esm/cli.js.map +1 -0
  6. package/dist/esm/config-fns.d.ts +56 -0
  7. package/dist/esm/config-fns.js +76 -0
  8. package/dist/esm/config-fns.js.map +1 -0
  9. package/dist/esm/configs/antfu.d.ts +4 -0
  10. package/dist/esm/configs/antfu.js +31 -0
  11. package/dist/esm/configs/antfu.js.map +1 -0
  12. package/dist/esm/configs/comments.d.ts +2 -0
  13. package/dist/esm/configs/comments.js +17 -0
  14. package/dist/esm/configs/comments.js.map +1 -0
  15. package/dist/esm/configs/gql.d.ts +2 -0
  16. package/dist/esm/configs/gql.js +5 -0
  17. package/dist/esm/configs/gql.js.map +1 -0
  18. package/dist/esm/configs/ignores.d.ts +2 -0
  19. package/dist/esm/configs/ignores.js +10 -0
  20. package/dist/esm/configs/ignores.js.map +1 -0
  21. package/dist/esm/configs/imports.d.ts +2 -0
  22. package/dist/esm/configs/imports.js +30 -0
  23. package/dist/esm/configs/imports.js.map +1 -0
  24. package/dist/esm/configs/javascript.d.ts +6 -0
  25. package/dist/esm/configs/javascript.js +263 -0
  26. package/dist/esm/configs/javascript.js.map +1 -0
  27. package/dist/esm/configs/jsdoc.d.ts +2 -0
  28. package/dist/esm/configs/jsdoc.js +32 -0
  29. package/dist/esm/configs/jsdoc.js.map +1 -0
  30. package/dist/esm/configs/jsonc.d.ts +4 -0
  31. package/dist/esm/configs/jsonc.js +77 -0
  32. package/dist/esm/configs/jsonc.js.map +1 -0
  33. package/dist/esm/configs/markdown.d.ts +4 -0
  34. package/dist/esm/configs/markdown.js +123 -0
  35. package/dist/esm/configs/markdown.js.map +1 -0
  36. package/dist/esm/configs/n.d.ts +2 -0
  37. package/dist/esm/configs/n.js +22 -0
  38. package/dist/esm/configs/n.js.map +1 -0
  39. package/dist/esm/configs/no-only-tests.d.ts +4 -0
  40. package/dist/esm/configs/no-only-tests.js +32 -0
  41. package/dist/esm/configs/no-only-tests.js.map +1 -0
  42. package/dist/esm/configs/perfectionist.d.ts +7 -0
  43. package/dist/esm/configs/perfectionist.js +61 -0
  44. package/dist/esm/configs/perfectionist.js.map +1 -0
  45. package/dist/esm/configs/prettier.d.ts +7 -0
  46. package/dist/esm/configs/prettier.js +127 -0
  47. package/dist/esm/configs/prettier.js.map +1 -0
  48. package/dist/esm/configs/react.d.ts +6 -0
  49. package/dist/esm/configs/react.js +302 -0
  50. package/dist/esm/configs/react.js.map +1 -0
  51. package/dist/esm/configs/sort-package-json.d.ts +7 -0
  52. package/dist/esm/configs/sort-package-json.js +90 -0
  53. package/dist/esm/configs/sort-package-json.js.map +1 -0
  54. package/dist/esm/configs/sort-tsconfig.d.ts +14 -0
  55. package/dist/esm/configs/sort-tsconfig.js +134 -0
  56. package/dist/esm/configs/sort-tsconfig.js.map +1 -0
  57. package/dist/esm/configs/stylistic.d.ts +2 -0
  58. package/dist/esm/configs/stylistic.js +38 -0
  59. package/dist/esm/configs/stylistic.js.map +1 -0
  60. package/dist/esm/configs/tailwind.d.ts +2 -0
  61. package/dist/esm/configs/tailwind.js +49 -0
  62. package/dist/esm/configs/tailwind.js.map +1 -0
  63. package/dist/esm/configs/toml.d.ts +2 -0
  64. package/dist/esm/configs/toml.js +51 -0
  65. package/dist/esm/configs/toml.js.map +1 -0
  66. package/dist/esm/configs/ts/parser.d.ts +7 -0
  67. package/dist/esm/configs/ts/parser.js +66 -0
  68. package/dist/esm/configs/ts/parser.js.map +1 -0
  69. package/dist/esm/configs/ts/requires-type-checking.d.ts +1 -0
  70. package/dist/esm/configs/ts/requires-type-checking.js +58 -0
  71. package/dist/esm/configs/ts/requires-type-checking.js.map +1 -0
  72. package/dist/esm/configs/ts/typescript-language-options.d.ts +2 -0
  73. package/dist/esm/configs/ts/typescript-language-options.js +23 -0
  74. package/dist/esm/configs/ts/typescript-language-options.js.map +1 -0
  75. package/dist/esm/configs/ts/typescript-rules.d.ts +6 -0
  76. package/dist/esm/configs/ts/typescript-rules.js +416 -0
  77. package/dist/esm/configs/ts/typescript-rules.js.map +1 -0
  78. package/dist/esm/configs/ts/typescript.d.ts +4 -0
  79. package/dist/esm/configs/ts/typescript.js +110 -0
  80. package/dist/esm/configs/ts/typescript.js.map +1 -0
  81. package/dist/esm/configs/tsdoc.d.ts +2 -0
  82. package/dist/esm/configs/tsdoc.js +17 -0
  83. package/dist/esm/configs/tsdoc.js.map +1 -0
  84. package/dist/esm/configs/unicorn.d.ts +2 -0
  85. package/dist/esm/configs/unicorn.js +116 -0
  86. package/dist/esm/configs/unicorn.js.map +1 -0
  87. package/dist/esm/configs/vitest.d.ts +4 -0
  88. package/dist/esm/configs/vitest.js +30 -0
  89. package/dist/esm/configs/vitest.js.map +1 -0
  90. package/dist/esm/configs/yml.d.ts +4 -0
  91. package/dist/esm/configs/yml.js +52 -0
  92. package/dist/esm/configs/yml.js.map +1 -0
  93. package/dist/esm/const.d.ts +5 -0
  94. package/dist/esm/const.js +12 -0
  95. package/dist/esm/const.js.map +1 -0
  96. package/dist/esm/define-config.d.ts +7 -0
  97. package/dist/esm/define-config.js +234 -0
  98. package/dist/esm/define-config.js.map +1 -0
  99. package/dist/esm/dev.d.ts +4 -0
  100. package/dist/esm/dev.js +26 -0
  101. package/dist/esm/dev.js.map +1 -0
  102. package/dist/esm/fixable.d.ts +1 -0
  103. package/dist/esm/fixable.js +390 -0
  104. package/dist/esm/fixable.js.map +1 -0
  105. package/dist/esm/globs.d.ts +25 -0
  106. package/dist/esm/globs.js +74 -0
  107. package/dist/esm/globs.js.map +1 -0
  108. package/dist/esm/index.d.ts +8 -0
  109. package/dist/esm/index.js +9 -0
  110. package/dist/esm/index.js.map +1 -0
  111. package/dist/esm/lager.d.ts +31 -0
  112. package/dist/esm/lager.js +87 -0
  113. package/dist/esm/lager.js.map +1 -0
  114. package/dist/esm/plugindex.d.ts +7 -0
  115. package/dist/esm/plugindex.js +61 -0
  116. package/dist/esm/plugindex.js.map +1 -0
  117. package/dist/esm/plugins-all.d.ts +23 -0
  118. package/dist/esm/plugins-all.js +27 -0
  119. package/dist/esm/plugins-all.js.map +1 -0
  120. package/dist/esm/plugins.d.ts +983 -0
  121. package/dist/esm/plugins.js +113 -0
  122. package/dist/esm/plugins.js.map +1 -0
  123. package/dist/esm/presets.d.ts +2 -0
  124. package/dist/esm/presets.js +13 -0
  125. package/dist/esm/presets.js.map +1 -0
  126. package/dist/esm/types.d.ts +255 -0
  127. package/dist/esm/types.js +2 -0
  128. package/dist/esm/types.js.map +1 -0
  129. package/dist/esm/utils.d.ts +51 -0
  130. package/dist/esm/utils.js +157 -0
  131. package/dist/esm/utils.js.map +1 -0
  132. package/dist/index.cjs +188 -143
  133. package/dist/index.d.cts +18 -20
  134. package/dist/index.d.ts +18 -20
  135. package/dist/index.js +193 -151
  136. package/package.json +12 -5
package/dist/index.cjs CHANGED
@@ -3043,9 +3043,12 @@ __export(src_exports, {
3043
3043
  GLOB_TSX: () => GLOB_TSX,
3044
3044
  GLOB_YAML: () => GLOB_YAML,
3045
3045
  SLOW_RULES: () => SLOW_RULES,
3046
+ changeRuleEntrySeverity: () => changeRuleEntrySeverity,
3046
3047
  combine: () => combine,
3047
3048
  combineAsync: () => combineAsync,
3048
3049
  default: () => jsse,
3050
+ defineConfig: () => defineConfig,
3051
+ error2warn: () => error2warn,
3049
3052
  importJsoncLibs: () => importJsoncLibs,
3050
3053
  importParserJsonc: () => importParserJsonc,
3051
3054
  importPluginJsdoc: () => importPluginJsdoc,
@@ -3064,7 +3067,6 @@ __export(src_exports, {
3064
3067
  isInEditor: () => isInEditor,
3065
3068
  jsse: () => jsse,
3066
3069
  jsseReact: () => jsseReact,
3067
- jssestd: () => jssestd,
3068
3070
  parserPlain: () => parserPlain,
3069
3071
  parserTs: () => parserTs,
3070
3072
  pluginAntfu: () => import_eslint_plugin_antfu.default,
@@ -3078,7 +3080,8 @@ __export(src_exports, {
3078
3080
  renameRules: () => renameRules,
3079
3081
  safeImportPluginTailwind: () => safeImportPluginTailwind,
3080
3082
  turnOffRules: () => turnOffRules,
3081
- uniqueStrings: () => uniqueStrings
3083
+ uniqueStrings: () => uniqueStrings,
3084
+ warn2error: () => warn2error
3082
3085
  });
3083
3086
  module.exports = __toCommonJS(src_exports);
3084
3087
 
@@ -3092,7 +3095,7 @@ var SLOW_RULES = [
3092
3095
  "unicorn/no-unnecessary-polyfills"
3093
3096
  ];
3094
3097
 
3095
- // src/factory.ts
3098
+ // src/define-config.ts
3096
3099
  var import_node_fs3 = __toESM(require("fs"), 1);
3097
3100
  var import_node_process6 = __toESM(require("process"), 1);
3098
3101
 
@@ -9956,81 +9959,6 @@ function resolvePackage(name, options = {}) {
9956
9959
  }
9957
9960
  }
9958
9961
 
9959
- // src/globs.ts
9960
- var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
9961
- var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
9962
- var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
9963
- var GLOB_JS = "**/*.?([cm])js";
9964
- var GLOB_JSX = "**/*.?([cm])jsx";
9965
- var GLOB_TS = "**/*.?([cm])ts";
9966
- var GLOB_TSX = "**/*.?([cm])tsx";
9967
- var GLOB_STYLE = "**/*.{c,le,sc}ss";
9968
- var GLOB_CSS = "**/*.css";
9969
- var GLOB_LESS = "**/*.less";
9970
- var GLOB_SCSS = "**/*.scss";
9971
- var GLOB_JSON = "**/*.json";
9972
- var GLOB_JSON5 = "**/*.json5";
9973
- var GLOB_JSONC = "**/*.jsonc";
9974
- var GLOB_TOML = "**/*.toml";
9975
- var GLOB_MARKDOWN = "**/*.md";
9976
- var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
9977
- var GLOB_GRAPHQL = ["**/*.graphql", "**/*.gql"];
9978
- var GLOB_YAML = "**/*.y?(a)ml";
9979
- var GLOB_HTML = "**/*.htm?(l)";
9980
- var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
9981
- var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
9982
- var GLOB_TESTS = [
9983
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
9984
- `**/*.spec.${GLOB_SRC_EXT}`,
9985
- `**/*.test.${GLOB_SRC_EXT}`,
9986
- `**/*.bench.${GLOB_SRC_EXT}`,
9987
- `**/*.benchmark.${GLOB_SRC_EXT}`
9988
- ];
9989
- var GLOB_ALL_SRC = [
9990
- GLOB_SRC,
9991
- GLOB_STYLE,
9992
- GLOB_JSON,
9993
- GLOB_JSON5,
9994
- GLOB_MARKDOWN,
9995
- GLOB_YAML,
9996
- GLOB_HTML
9997
- ];
9998
- var GLOB_EXCLUDE = [
9999
- "**/__snapshots__",
10000
- "**/.cache",
10001
- "**/.changeset",
10002
- "**/.history",
10003
- "**/.idea",
10004
- "**/.next",
10005
- "**/.nuxt",
10006
- "**/.output",
10007
- "**/.temp",
10008
- "**/.tmp",
10009
- "**/.vercel",
10010
- "**/.vite-inspect",
10011
- "**/.vitepress/cache",
10012
- "**/*.bak",
10013
- "**/*.min.*",
10014
- "**/.yarn",
10015
- "**/.pnp.*",
10016
- "**/auto-import?(s).d.ts",
10017
- "**/bun.lockb",
10018
- "**/CHANGELOG*.md",
10019
- "**/components.d.ts",
10020
- "**/coverage",
10021
- "**/dist",
10022
- "**/LICENSE*",
10023
- "**/node_modules",
10024
- "**/out",
10025
- "**/output",
10026
- "**/package-lock.json",
10027
- "**/pnpm-lock.yaml",
10028
- "**/scratch",
10029
- "**/temp",
10030
- "**/tmp",
10031
- "**/yarn.lock"
10032
- ];
10033
-
10034
9962
  // node_modules/.pnpm/neverthrow@8.0.0/node_modules/neverthrow/dist/index.es.js
10035
9963
  var defaultErrorConfig = {
10036
9964
  withStackTrace: false
@@ -10450,7 +10378,7 @@ var fromThrowable = Result.fromThrowable;
10450
10378
  var import_node_process3 = __toESM(require("process"), 1);
10451
10379
 
10452
10380
  // src/lager.ts
10453
- var levels = {
10381
+ var LAGER_LEVELS = {
10454
10382
  trace: 10,
10455
10383
  debug: 20,
10456
10384
  info: 30,
@@ -10464,7 +10392,7 @@ function isLagerLevel(level) {
10464
10392
  var Lager = class {
10465
10393
  _level = "info";
10466
10394
  id = "lager";
10467
- levelNo = levels[this._level];
10395
+ levelNo = LAGER_LEVELS[this._level];
10468
10396
  prefix = "";
10469
10397
  constructor(options) {
10470
10398
  const { level, id, prefix } = {
@@ -10475,7 +10403,7 @@ var Lager = class {
10475
10403
  };
10476
10404
  this.id = id;
10477
10405
  this._level = isLagerLevel(level) ? level : "info";
10478
- this.levelNo = levels[this._level];
10406
+ this.levelNo = LAGER_LEVELS[this._level];
10479
10407
  this.prefix = prefix;
10480
10408
  this.log = this.log.bind(this);
10481
10409
  this.debug = this.debug.bind(this);
@@ -10485,46 +10413,41 @@ var Lager = class {
10485
10413
  }
10486
10414
  set level(level) {
10487
10415
  this._level = level;
10488
- this.levelNo = levels[level];
10416
+ this.levelNo = LAGER_LEVELS[level];
10489
10417
  }
10490
10418
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10491
10419
  log(...args) {
10492
- console.log(...args);
10420
+ console.log(this.prefix, ...args);
10493
10421
  }
10494
10422
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10495
10423
  trace(...args) {
10496
- if (this.levelNo > levels.trace) {
10497
- return;
10424
+ if (this.levelNo <= LAGER_LEVELS.trace) {
10425
+ console.trace(this.prefix, ...args);
10498
10426
  }
10499
- console.trace(...args);
10500
10427
  }
10501
10428
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10502
10429
  debug(...args) {
10503
- if (this.levelNo > levels.debug) {
10504
- return;
10430
+ if (this.levelNo <= LAGER_LEVELS.debug) {
10431
+ console.debug(this.prefix, ...args);
10505
10432
  }
10506
- console.debug(...args);
10507
10433
  }
10508
10434
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10509
10435
  info(...args) {
10510
- if (this.levelNo > levels.info) {
10511
- return;
10436
+ if (this.levelNo <= LAGER_LEVELS.info) {
10437
+ console.info(this.prefix, ...args);
10512
10438
  }
10513
- console.info("[@jsse/eslint-config]", ...args);
10514
10439
  }
10515
10440
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10516
10441
  warn(...args) {
10517
- if (this.levelNo > levels.warn) {
10518
- return;
10442
+ if (this.levelNo <= LAGER_LEVELS.warn) {
10443
+ console.warn(this.prefix, ...args);
10519
10444
  }
10520
- console.warn(...args);
10521
10445
  }
10522
10446
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10523
10447
  error(...args) {
10524
- if (this.levelNo > levels.error) {
10525
- return;
10448
+ if (this.levelNo <= LAGER_LEVELS.error) {
10449
+ console.error(this.prefix, ...args);
10526
10450
  }
10527
- console.error(...args);
10528
10451
  }
10529
10452
  };
10530
10453
  var log = new Lager();
@@ -10614,12 +10537,11 @@ function turnOffRules(configs, off) {
10614
10537
  }
10615
10538
  }
10616
10539
  for (const config of configs) {
10617
- for (const cfgRules of [config.rules, config.plugins]) {
10618
- if (cfgRules) {
10619
- for (const rule of off) {
10620
- if (cfgRules[rule] !== void 0 && cfgRules[rule] !== "off" && cfgRules[rule] !== 0) {
10621
- cfgRules[rule] = "off";
10622
- }
10540
+ const cfgRules = config.rules;
10541
+ if (cfgRules) {
10542
+ for (const rule of off) {
10543
+ if (cfgRules[rule] !== void 0 && cfgRules[rule] !== "off" && cfgRules[rule] !== 0) {
10544
+ cfgRules[rule] = "off";
10623
10545
  }
10624
10546
  }
10625
10547
  }
@@ -10627,12 +10549,57 @@ function turnOffRules(configs, off) {
10627
10549
  }
10628
10550
  return configs;
10629
10551
  }
10552
+ function changeRuleEntrySeverity(ruleConfig, level) {
10553
+ if (Array.isArray(ruleConfig)) {
10554
+ if (ruleConfig[0] !== level) {
10555
+ ruleConfig[0] = level;
10556
+ }
10557
+ return ruleConfig;
10558
+ }
10559
+ return level;
10560
+ }
10561
+ function error2warn(configs) {
10562
+ for (const config of configs) {
10563
+ if (config.rules) {
10564
+ config.rules = Object.fromEntries(
10565
+ Object.entries(config.rules).map(([key, value]) => {
10566
+ if (value === "error" || value === 2) {
10567
+ return [key, changeRuleEntrySeverity(value, "warn")];
10568
+ }
10569
+ if (Array.isArray(value) && (value[0] === "error" || value[0] === 2)) {
10570
+ return [key, changeRuleEntrySeverity(value, "warn")];
10571
+ }
10572
+ return [key, value];
10573
+ })
10574
+ );
10575
+ }
10576
+ }
10577
+ return configs;
10578
+ }
10579
+ function warn2error(configs) {
10580
+ for (const config of configs) {
10581
+ if (config.rules) {
10582
+ config.rules = Object.fromEntries(
10583
+ Object.entries(config.rules).map(([key, value]) => {
10584
+ if (value === "warn" || value === 1) {
10585
+ return [key, changeRuleEntrySeverity(value, "error")];
10586
+ }
10587
+ if (Array.isArray(value) && (value[0] === "warn" || value[0] === 1)) {
10588
+ return [key, changeRuleEntrySeverity(value, "error")];
10589
+ }
10590
+ return [key, value];
10591
+ })
10592
+ );
10593
+ }
10594
+ }
10595
+ return configs;
10596
+ }
10630
10597
 
10631
10598
  // src/plugins.ts
10599
+ var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
10632
10600
  var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
10633
10601
  var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
10634
10602
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
10635
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
10636
10603
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
10637
10604
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
10638
10605
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
@@ -10745,35 +10712,33 @@ async function safeImportPluginTailwind() {
10745
10712
  }
10746
10713
 
10747
10714
  // src/configs/antfu.ts
10748
- var antfu = async () => {
10715
+ var antfu = async (options) => {
10749
10716
  return [
10750
10717
  {
10751
10718
  name: "jsse/antfu",
10752
10719
  plugins: {
10753
10720
  antfu: import_eslint_plugin_antfu.default
10754
10721
  },
10755
- // @ts-expect-error - antfu plugin types err
10756
10722
  rules: {
10757
- "antfu/no-import-node-modules-by-path": "error",
10758
- "antfu/top-level-function": "error"
10759
- }
10760
- },
10761
- {
10762
- files: ["**/src/**/*"],
10763
- name: "jsse/antfu/src",
10764
- // @ts-expect-error - antfu plugin types err
10765
- rules: {
10766
- "antfu/no-import-dist": "error"
10767
- }
10768
- },
10769
- {
10770
- files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
10771
- name: "jsse/antfu/bin",
10772
- rules: {
10773
- "antfu/no-import-dist": "off",
10774
- "antfu/no-import-node-modules-by-path": "off"
10723
+ // used to like the following rule, but now find it annoying
10724
+ "antfu/top-level-function": options?.topLevelFunction ?? "off"
10775
10725
  }
10776
10726
  }
10727
+ // {
10728
+ // files: ["**/src/**/*"],
10729
+ // name: "jsse/antfu/src",
10730
+ // rules: {
10731
+ // "antfu/no-import-dist": "error",
10732
+ // },
10733
+ // },
10734
+ // {
10735
+ // files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
10736
+ // name: "jsse/antfu/bin",
10737
+ // rules: {
10738
+ // "antfu/no-import-dist": "off",
10739
+ // "antfu/no-import-node-modules-by-path": "off",
10740
+ // },
10741
+ // },
10777
10742
  ];
10778
10743
  };
10779
10744
 
@@ -10794,6 +10759,81 @@ var comments = async () => [
10794
10759
  }
10795
10760
  ];
10796
10761
 
10762
+ // src/globs.ts
10763
+ var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
10764
+ var GLOB_JS_SRC_EXT = "?([cm])js?(x)";
10765
+ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
10766
+ var GLOB_JS = "**/*.?([cm])js";
10767
+ var GLOB_JSX = "**/*.?([cm])jsx";
10768
+ var GLOB_TS = "**/*.?([cm])ts";
10769
+ var GLOB_TSX = "**/*.?([cm])tsx";
10770
+ var GLOB_STYLE = "**/*.{c,le,sc}ss";
10771
+ var GLOB_CSS = "**/*.css";
10772
+ var GLOB_LESS = "**/*.less";
10773
+ var GLOB_SCSS = "**/*.scss";
10774
+ var GLOB_JSON = "**/*.json";
10775
+ var GLOB_JSON5 = "**/*.json5";
10776
+ var GLOB_JSONC = "**/*.jsonc";
10777
+ var GLOB_TOML = "**/*.toml";
10778
+ var GLOB_MARKDOWN = "**/*.md";
10779
+ var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
10780
+ var GLOB_GRAPHQL = ["**/*.graphql", "**/*.gql"];
10781
+ var GLOB_YAML = "**/*.y?(a)ml";
10782
+ var GLOB_HTML = "**/*.htm?(l)";
10783
+ var GLOB_TSCONFIG = ["**/tsconfig.json", "**/tsconfig.*.json"];
10784
+ var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
10785
+ var GLOB_TESTS = [
10786
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
10787
+ `**/*.spec.${GLOB_SRC_EXT}`,
10788
+ `**/*.test.${GLOB_SRC_EXT}`,
10789
+ `**/*.bench.${GLOB_SRC_EXT}`,
10790
+ `**/*.benchmark.${GLOB_SRC_EXT}`
10791
+ ];
10792
+ var GLOB_ALL_SRC = [
10793
+ GLOB_SRC,
10794
+ GLOB_STYLE,
10795
+ GLOB_JSON,
10796
+ GLOB_JSON5,
10797
+ GLOB_MARKDOWN,
10798
+ GLOB_YAML,
10799
+ GLOB_HTML
10800
+ ];
10801
+ var GLOB_EXCLUDE = [
10802
+ "**/__snapshots__",
10803
+ "**/.cache",
10804
+ "**/.changeset",
10805
+ "**/.history",
10806
+ "**/.idea",
10807
+ "**/.next",
10808
+ "**/.nuxt",
10809
+ "**/.output",
10810
+ "**/.temp",
10811
+ "**/.tmp",
10812
+ "**/.vercel",
10813
+ "**/.vite-inspect",
10814
+ "**/.vitepress/cache",
10815
+ "**/*.bak",
10816
+ "**/*.min.*",
10817
+ "**/.yarn",
10818
+ "**/.pnp.*",
10819
+ "**/auto-import?(s).d.ts",
10820
+ "**/bun.lockb",
10821
+ "**/CHANGELOG*.md",
10822
+ "**/components.d.ts",
10823
+ "**/coverage",
10824
+ "**/dist",
10825
+ "**/LICENSE*",
10826
+ "**/node_modules",
10827
+ "**/out",
10828
+ "**/output",
10829
+ "**/package-lock.json",
10830
+ "**/pnpm-lock.yaml",
10831
+ "**/scratch",
10832
+ "**/temp",
10833
+ "**/tmp",
10834
+ "**/yarn.lock"
10835
+ ];
10836
+
10797
10837
  // src/configs/ignores.ts
10798
10838
  var ignores = async () => {
10799
10839
  return [
@@ -12996,7 +13036,7 @@ var yml = async (options) => {
12996
13036
  ];
12997
13037
  };
12998
13038
 
12999
- // src/factory.ts
13039
+ // src/define-config.ts
13000
13040
  var flatConfigProps = [
13001
13041
  "files",
13002
13042
  "ignores",
@@ -13247,23 +13287,25 @@ async function jsse(options = {}, ...userConfigs) {
13247
13287
  }
13248
13288
  return combinedConfigs;
13249
13289
  }
13290
+ async function defineConfig(options = {}, ...userConfigs) {
13291
+ return jsse(options, ...userConfigs);
13292
+ }
13250
13293
 
13251
13294
  // src/presets.ts
13252
- function jssestd() {
13253
- return jsse({
13254
- typescript: {
13255
- tsconfig: ["./tsconfig.json", "./tsconfig.eslint.json"]
13256
- }
13257
- });
13258
- }
13259
- function jsseReact() {
13260
- return jsse({
13261
- react: true,
13262
- typescript: {
13263
- tsconfig: ["./tsconfig.json", "./tsconfig.eslint.json"]
13264
- }
13265
- });
13266
- }
13295
+ var jsseReact = (options, ...configs) => {
13296
+ return jsse(
13297
+ {
13298
+ react: true,
13299
+ reactRefresh: true,
13300
+ tailwind: true,
13301
+ typescript: {
13302
+ tsconfig: ["./tsconfig.json", "./tsconfig.eslint.json"]
13303
+ },
13304
+ ...options
13305
+ },
13306
+ ...configs
13307
+ );
13308
+ };
13267
13309
  // Annotate the CommonJS export names for ESM import in node:
13268
13310
  0 && (module.exports = {
13269
13311
  GLOB_ALL_SRC,
@@ -13292,8 +13334,11 @@ function jsseReact() {
13292
13334
  GLOB_TSX,
13293
13335
  GLOB_YAML,
13294
13336
  SLOW_RULES,
13337
+ changeRuleEntrySeverity,
13295
13338
  combine,
13296
13339
  combineAsync,
13340
+ defineConfig,
13341
+ error2warn,
13297
13342
  importJsoncLibs,
13298
13343
  importParserJsonc,
13299
13344
  importPluginJsdoc,
@@ -13312,7 +13357,6 @@ function jsseReact() {
13312
13357
  isInEditor,
13313
13358
  jsse,
13314
13359
  jsseReact,
13315
- jssestd,
13316
13360
  parserPlain,
13317
13361
  parserTs,
13318
13362
  pluginAntfu,
@@ -13326,5 +13370,6 @@ function jsseReact() {
13326
13370
  renameRules,
13327
13371
  safeImportPluginTailwind,
13328
13372
  turnOffRules,
13329
- uniqueStrings
13373
+ uniqueStrings,
13374
+ warn2error
13330
13375
  });
package/dist/index.d.cts CHANGED
@@ -14,9 +14,9 @@ import * as eslint_plugin_jsonc_types from 'eslint-plugin-jsonc/types';
14
14
  import * as eslint_plugin_jsonc_meta from 'eslint-plugin-jsonc/meta';
15
15
  import * as jsonc_eslint_parser from 'jsonc-eslint-parser';
16
16
  import * as eslint_plugin_react from 'eslint-plugin-react';
17
+ export { default as pluginEslintComments } from '@eslint-community/eslint-plugin-eslint-comments';
17
18
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
18
19
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
19
- export { default as pluginEslintComments } from 'eslint-plugin-eslint-comments';
20
20
  import * as eslintPluginImportX from 'eslint-plugin-import-x';
21
21
  export { eslintPluginImportX as pluginImport };
22
22
  export { default as pluginN } from 'eslint-plugin-n';
@@ -4242,47 +4242,47 @@ type AntfuIndentUnindent =
4242
4242
  interface EslintCommentsRuleOptions {
4243
4243
  /**
4244
4244
  * require a `eslint-enable` comment for every `eslint-disable` comment
4245
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
4245
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
4246
4246
  */
4247
4247
  "eslint-comments/disable-enable-pair"?: Linter.RuleEntry<EslintCommentsDisableEnablePair>;
4248
4248
  /**
4249
4249
  * disallow a `eslint-enable` comment for multiple `eslint-disable` comments
4250
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
4250
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
4251
4251
  */
4252
4252
  "eslint-comments/no-aggregating-enable"?: Linter.RuleEntry<[]>;
4253
4253
  /**
4254
4254
  * disallow duplicate `eslint-disable` comments
4255
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html
4255
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html
4256
4256
  */
4257
4257
  "eslint-comments/no-duplicate-disable"?: Linter.RuleEntry<[]>;
4258
4258
  /**
4259
4259
  * disallow `eslint-disable` comments about specific rules
4260
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
4260
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
4261
4261
  */
4262
4262
  "eslint-comments/no-restricted-disable"?: Linter.RuleEntry<EslintCommentsNoRestrictedDisable>;
4263
4263
  /**
4264
4264
  * disallow `eslint-disable` comments without rule names
4265
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html
4265
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html
4266
4266
  */
4267
4267
  "eslint-comments/no-unlimited-disable"?: Linter.RuleEntry<[]>;
4268
4268
  /**
4269
4269
  * disallow unused `eslint-disable` comments
4270
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
4270
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
4271
4271
  */
4272
4272
  "eslint-comments/no-unused-disable"?: Linter.RuleEntry<[]>;
4273
4273
  /**
4274
4274
  * disallow unused `eslint-enable` comments
4275
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
4275
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
4276
4276
  */
4277
4277
  "eslint-comments/no-unused-enable"?: Linter.RuleEntry<[]>;
4278
4278
  /**
4279
4279
  * disallow ESLint directive-comments
4280
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-use.html
4280
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html
4281
4281
  */
4282
4282
  "eslint-comments/no-use"?: Linter.RuleEntry<EslintCommentsNoUse>;
4283
4283
  /**
4284
4284
  * require include descriptions in ESLint directive-comments
4285
- * @see https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/require-description.html
4285
+ * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
4286
4286
  */
4287
4287
  "eslint-comments/require-description"?: Linter.RuleEntry<EslintCommentsRequireDescription>;
4288
4288
  }
@@ -21360,7 +21360,7 @@ type RuleOptionsUnion = BuiltinsRuleOptions &
21360
21360
  type Awaitable<T> = T | Promise<T>;
21361
21361
  type Rules = RuleOptionsUnion;
21362
21362
  type LanguageOptions = Linter.Config["languageOptions"];
21363
- type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins" | "rules"> & {
21363
+ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
21364
21364
  /**
21365
21365
  * Custom name of each config item
21366
21366
  */
@@ -21371,12 +21371,6 @@ type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plug
21371
21371
  * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
21372
21372
  */
21373
21373
  plugins?: Record<string, any>;
21374
- /**
21375
- * An object containing a name-value mapping of rules to use.
21376
- */
21377
- rules?: {
21378
- [key: string]: Linter.RuleEntry;
21379
- } & Rules;
21380
21374
  };
21381
21375
  type RuleName = keyof Rules;
21382
21376
  type TypedFlatConfigItemWithId = TypedFlatConfigItem & {
@@ -21625,6 +21619,8 @@ declare const SLOW_RULES: RuleName[];
21625
21619
  * Construct an array of ESLint flat config items.
21626
21620
  */
21627
21621
  declare function jsse(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: (TypedFlatConfigItem | TypedFlatConfigItem[])[]): Promise<TypedFlatConfigItem[]>;
21622
+ declare function defineConfig(options?: OptionsConfig & TypedFlatConfigItem, ...userConfigs: (TypedFlatConfigItem | TypedFlatConfigItem[])[]): Promise<TypedFlatConfigItem[]>;
21623
+ type DefineConfig = typeof defineConfig;
21628
21624
 
21629
21625
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
21630
21626
  declare const GLOB_JS_SRC_EXT = "?([cm])js?(x)";
@@ -22626,8 +22622,7 @@ declare function safeImportPluginTailwind(): Promise<neverthrow.Ok<{
22626
22622
  pluginTailwind: any;
22627
22623
  }, never> | neverthrow.Err<never, Error>>;
22628
22624
 
22629
- declare function jssestd(): Promise<TypedFlatConfigItem[]>;
22630
- declare function jsseReact(): Promise<TypedFlatConfigItem[]>;
22625
+ declare const jsseReact: DefineConfig;
22631
22626
 
22632
22627
  /**
22633
22628
  * Combine array and non-array configs into a single array.
@@ -22675,5 +22670,8 @@ declare const parserPlain: {
22675
22670
  };
22676
22671
  };
22677
22672
  declare function turnOffRules(configs: TypedFlatConfigItem[], off: string[]): TypedFlatConfigItem[];
22673
+ declare function changeRuleEntrySeverity(ruleConfig: Linter.RuleEntry<any>, level: Linter.RuleSeverity): Linter.RuleEntry<any>;
22674
+ declare function error2warn<T extends TypedFlatConfigItem>(configs: T[]): T[];
22675
+ declare function warn2error<T extends TypedFlatConfigItem>(configs: T[]): T[];
22678
22676
 
22679
- export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type PromiseFlatConfigItem, type RenamePefix, type RuleName, type Rules, SLOW_RULES, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, type TypedFlatConfigItemWithId, combine, combineAsync, jsse as default, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, jssestd, parserPlain, renameRules, safeImportPluginTailwind, turnOffRules, uniqueStrings };
22677
+ export { type Awaitable, type EslintConfigFn, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JS_SRC_EXT, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_YAML, type LanguageOptions, type OptionsCommon, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsPrefix, type OptionsReact, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type PromiseFlatConfigItem, type RenamePefix, type RuleName, type Rules, SLOW_RULES, type StylisticConfig, type TailwindEslintSettings, type TailwindOptions, type TypedFlatConfigItem, type TypedFlatConfigItemWithId, changeRuleEntrySeverity, combine, combineAsync, jsse as default, defineConfig, error2warn, importJsoncLibs, importParserJsonc, importPluginJsdoc, importPluginJsonc, importPluginMarkdown, importPluginReact, importPluginReactHooks, importPluginReactRefresh, importPluginStylistic, importPluginTailwind, importPluginTsdoc, importReactPlugins, importYmlLibs, interopDefault, isCI, isInEditor, jsse, jsseReact, parserPlain, renameRules, safeImportPluginTailwind, turnOffRules, uniqueStrings, warn2error };