@ghettoddos/eslint-config 2.0.1 → 3.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.js CHANGED
@@ -1,4 +1,8 @@
1
1
  import { FlatConfigComposer } from "eslint-flat-config-utils";
2
+ import process from "node:process";
3
+ import { fileURLToPath } from "node:url";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
2
6
  import { isPackageExists } from "local-pkg";
3
7
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
4
8
  import pluginAntfu from "eslint-plugin-antfu";
@@ -8,12 +12,29 @@ import pluginPerfectionist from "eslint-plugin-perfectionist";
8
12
  import pluginUnicorn from "eslint-plugin-unicorn";
9
13
  import pluginUnusedImports from "eslint-plugin-unused-imports";
10
14
  import { fixupPluginRules } from "@eslint/compat";
11
- import process from "node:process";
12
- import { fileURLToPath } from "node:url";
13
15
  import globals from "globals";
14
16
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
15
17
  import { configs } from "eslint-plugin-regexp";
16
18
 
19
+ //#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
20
+ const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
21
+ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
22
+ let directory = path.resolve(toPath(cwd) ?? "");
23
+ const { root } = path.parse(directory);
24
+ stopAt = path.resolve(directory, toPath(stopAt) ?? root);
25
+ const isAbsoluteName = path.isAbsolute(name);
26
+ while (directory) {
27
+ const filePath = isAbsoluteName ? name : path.join(directory, name);
28
+ try {
29
+ const stats = fs.statSync(filePath, { throwIfNoEntry: false });
30
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
31
+ } catch {}
32
+ if (directory === stopAt || directory === root) break;
33
+ directory = path.dirname(directory);
34
+ }
35
+ }
36
+
37
+ //#endregion
17
38
  //#region src/configs/comments.ts
18
39
  async function comments() {
19
40
  return [{
@@ -52,6 +73,13 @@ const GLOB_XML = "**/*.xml";
52
73
  const GLOB_SVG = "**/*.svg";
53
74
  const GLOB_HTML = "**/*.htm?(l)";
54
75
  const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
76
+ const GLOB_TESTS = [
77
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
78
+ `**/*.spec.${GLOB_SRC_EXT}`,
79
+ `**/*.test.${GLOB_SRC_EXT}`,
80
+ `**/*.bench.${GLOB_SRC_EXT}`,
81
+ `**/*.benchmark.${GLOB_SRC_EXT}`
82
+ ];
55
83
  const GLOB_ALL_SRC = [
56
84
  GLOB_SRC,
57
85
  GLOB_STYLE,
@@ -128,8 +156,13 @@ async function disables() {
128
156
 
129
157
  //#endregion
130
158
  //#region src/constants.ts
131
- const ReactPackages = ["react", "nest"];
132
159
  const ReactRefreshAllowConstantExportPackages = ["vite"];
160
+ const RemixPackages = [
161
+ "@remix-run/node",
162
+ "@remix-run/react",
163
+ "@remix-run/serve",
164
+ "@remix-run/dev"
165
+ ];
133
166
  const ReactRouterPackages = [
134
167
  "@react-router/node",
135
168
  "@react-router/react",
@@ -137,13 +170,20 @@ const ReactRouterPackages = [
137
170
  "@react-router/dev"
138
171
  ];
139
172
  const NextJsPackages = ["next"];
173
+ const ReactNativePackages = ["react-native", "expo"];
174
+ const ReactPackages = [
175
+ ...RemixPackages,
176
+ ...ReactRouterPackages,
177
+ ...NextJsPackages,
178
+ ...ReactNativePackages,
179
+ "react"
180
+ ];
140
181
  const VuePackages = [
141
182
  "vue",
142
183
  "nuxt",
143
184
  "vitepress",
144
185
  "@slidev/cli"
145
186
  ];
146
- const ReactNativePackages = ["react-native", "expo"];
147
187
 
148
188
  //#endregion
149
189
  //#region src/utils.ts
@@ -172,8 +212,7 @@ const parserPlain = {
172
212
  * Combine array and non-array configs into a single array.
173
213
  */
174
214
  async function combine(...configs$1) {
175
- const resolved = await Promise.all(configs$1);
176
- return resolved.flat();
215
+ return (await Promise.all(configs$1)).flat();
177
216
  }
178
217
  /**
179
218
  * Rename plugin prefixes in a rule object.
@@ -210,9 +249,7 @@ async function ensurePackages(packages) {
210
249
  if (process.env.CI || process.stdout.isTTY === false || isCwdInScope === false) return;
211
250
  const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
212
251
  if (nonExistingPackages.length === 0) return;
213
- const p = await import("@clack/prompts");
214
- const result = await p.confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` });
215
- if (result) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
252
+ if (await (await import("@clack/prompts")).confirm({ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?` })) await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
216
253
  }
217
254
  function isInEditorEnv() {
218
255
  if (process.env.CI) return false;
@@ -279,18 +316,20 @@ async function effector(options = {}) {
279
316
  //#endregion
280
317
  //#region src/configs/stylistic.ts
281
318
  const StylisticConfigDefaults = {
319
+ experimental: false,
282
320
  indent: 2,
283
321
  jsx: true,
284
322
  quotes: "single",
285
323
  semi: false
286
324
  };
287
325
  async function stylistic(options = {}) {
288
- const { indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
326
+ const { experimental, indent, jsx: jsx$1, overrides = {}, quotes, semi } = {
289
327
  ...StylisticConfigDefaults,
290
328
  ...options
291
329
  };
292
330
  const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
293
331
  const config$1 = pluginStylistic.configs.customize({
332
+ experimental,
294
333
  indent,
295
334
  jsx: jsx$1,
296
335
  pluginName: "style",
@@ -305,8 +344,8 @@ async function stylistic(options = {}) {
305
344
  },
306
345
  rules: {
307
346
  ...config$1.rules,
347
+ ...experimental ? {} : { "antfu/consistent-list-newline": "error" },
308
348
  "antfu/consistent-chaining": "error",
309
- "antfu/consistent-list-newline": "error",
310
349
  "antfu/curly": "error",
311
350
  "antfu/if-newline": "error",
312
351
  "antfu/top-level-function": "error",
@@ -363,10 +402,9 @@ async function formatters(options = {}, stylistic$1 = {}) {
363
402
  xmlSortAttributesByKey: false,
364
403
  xmlWhitespaceSensitivity: "ignore"
365
404
  };
366
- const pluginFormat = await interopDefault(import("eslint-plugin-format"));
367
405
  const configs$1 = [{
368
406
  name: "formatter/setup",
369
- plugins: { format: pluginFormat }
407
+ plugins: { format: await interopDefault(import("eslint-plugin-format")) }
370
408
  }];
371
409
  if (options.css) configs$1.push({
372
410
  files: [GLOB_CSS, GLOB_POSTCSS],
@@ -424,8 +462,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
424
462
  //#endregion
425
463
  //#region src/configs/ignores.ts
426
464
  async function ignores(userIgnores = []) {
465
+ let ignores$1 = [...GLOB_EXCLUDE];
466
+ if (typeof userIgnores === "function") ignores$1 = userIgnores(ignores$1);
467
+ else ignores$1 = [...ignores$1, ...userIgnores];
427
468
  return [{
428
- ignores: [...GLOB_EXCLUDE, ...userIgnores],
469
+ ignores: ignores$1,
429
470
  name: "ignores"
430
471
  }];
431
472
  }
@@ -461,7 +502,7 @@ async function javascript(options = {}) {
461
502
  const { isInEditor = false, overrides = {} } = options;
462
503
  return [{
463
504
  languageOptions: {
464
- ecmaVersion: 2022,
505
+ ecmaVersion: "latest",
465
506
  globals: {
466
507
  ...globals.browser,
467
508
  ...globals.es2021,
@@ -472,7 +513,7 @@ async function javascript(options = {}) {
472
513
  },
473
514
  parserOptions: {
474
515
  ecmaFeatures: { jsx: true },
475
- ecmaVersion: 2022,
516
+ ecmaVersion: "latest",
476
517
  sourceType: "module"
477
518
  },
478
519
  sourceType: "module"
@@ -680,6 +721,37 @@ async function javascript(options = {}) {
680
721
  }];
681
722
  }
682
723
 
724
+ //#endregion
725
+ //#region src/configs/jsdoc.ts
726
+ async function jsdoc(options = {}) {
727
+ const { stylistic: stylistic$1 = true } = options;
728
+ return [{
729
+ name: "jsdoc/rules",
730
+ plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) },
731
+ rules: {
732
+ "jsdoc/check-access": "warn",
733
+ "jsdoc/check-param-names": "warn",
734
+ "jsdoc/check-property-names": "warn",
735
+ "jsdoc/check-types": "warn",
736
+ "jsdoc/empty-tags": "warn",
737
+ "jsdoc/implements-on-classes": "warn",
738
+ "jsdoc/no-defaults": "warn",
739
+ "jsdoc/no-multi-asterisks": "warn",
740
+ "jsdoc/require-param-name": "warn",
741
+ "jsdoc/require-property": "warn",
742
+ "jsdoc/require-property-description": "warn",
743
+ "jsdoc/require-property-name": "warn",
744
+ "jsdoc/require-returns-check": "warn",
745
+ "jsdoc/require-returns-description": "warn",
746
+ "jsdoc/require-yields-check": "warn",
747
+ ...stylistic$1 ? {
748
+ "jsdoc/check-alignment": "warn",
749
+ "jsdoc/multiline-blocks": "warn"
750
+ } : {}
751
+ }
752
+ }];
753
+ }
754
+
683
755
  //#endregion
684
756
  //#region src/configs/jsonc.ts
685
757
  async function jsonc(options = {}) {
@@ -849,14 +921,13 @@ async function markdown(options = {}) {
849
921
  }
850
922
 
851
923
  //#endregion
852
- //#region src/configs/next.ts
853
- async function next(options = {}) {
924
+ //#region src/configs/nextjs.ts
925
+ async function nextjs(options = {}) {
854
926
  const { files = [GLOB_SRC], overrides = {} } = options;
855
927
  await ensurePackages(["@next/eslint-plugin-next"]);
856
- const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
857
928
  return [{
858
929
  name: "next/setup",
859
- plugins: { next: pluginNextJS }
930
+ plugins: { next: await interopDefault(import("@next/eslint-plugin-next")) }
860
931
  }, {
861
932
  files,
862
933
  languageOptions: {
@@ -966,38 +1037,128 @@ async function perfectionist() {
966
1037
 
967
1038
  //#endregion
968
1039
  //#region src/configs/pnpm.ts
969
- async function pnpm() {
1040
+ async function pnpm(options) {
970
1041
  const [pluginPnpm, yamlParser, jsoncParser] = await Promise.all([
971
1042
  interopDefault(import("eslint-plugin-pnpm")),
972
1043
  interopDefault(import("yaml-eslint-parser")),
973
1044
  interopDefault(import("jsonc-eslint-parser"))
974
1045
  ]);
975
- return [{
976
- files: ["package.json", "**/package.json"],
977
- languageOptions: { parser: jsoncParser },
978
- name: "pnpm/package-json",
979
- plugins: { pnpm: pluginPnpm },
980
- rules: {
981
- "pnpm/json-enforce-catalog": "error",
982
- "pnpm/json-prefer-workspace-settings": "error",
983
- "pnpm/json-valid-catalog": "error"
984
- }
985
- }, {
986
- files: ["pnpm-workspace.yaml"],
987
- languageOptions: { parser: yamlParser },
988
- name: "pnpm/pnpm-workspace-yaml",
989
- plugins: { pnpm: pluginPnpm },
990
- rules: {
991
- "pnpm/yaml-no-duplicate-catalog-item": "error",
992
- "pnpm/yaml-no-unused-catalog-item": "error"
1046
+ return [
1047
+ {
1048
+ files: ["package.json", "**/package.json"],
1049
+ languageOptions: { parser: jsoncParser },
1050
+ name: "pnpm/package-json",
1051
+ plugins: { pnpm: pluginPnpm },
1052
+ rules: {
1053
+ "pnpm/json-enforce-catalog": ["error", { autofix: !options.isInEditor }],
1054
+ "pnpm/json-prefer-workspace-settings": ["error", { autofix: !options.isInEditor }],
1055
+ "pnpm/json-valid-catalog": ["error", { autofix: !options.isInEditor }]
1056
+ }
1057
+ },
1058
+ {
1059
+ files: ["pnpm-workspace.yaml"],
1060
+ languageOptions: { parser: yamlParser },
1061
+ name: "pnpm/pnpm-workspace-yaml",
1062
+ plugins: { pnpm: pluginPnpm },
1063
+ rules: {
1064
+ "pnpm/yaml-enforce-settings": ["error", { settings: {
1065
+ catalogMode: "prefer",
1066
+ cleanupUnusedCatalogs: true,
1067
+ shellEmulator: true,
1068
+ trustPolicy: "no-downgrade"
1069
+ } }],
1070
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
1071
+ "pnpm/yaml-no-unused-catalog-item": "error"
1072
+ }
1073
+ },
1074
+ {
1075
+ files: ["pnpm-workspace.yaml"],
1076
+ name: "pnpm/pnpm-workspace-yaml-sort",
1077
+ rules: { "yaml/sort-keys": [
1078
+ "error",
1079
+ {
1080
+ order: [
1081
+ ...[
1082
+ "cacheDir",
1083
+ "catalogMode",
1084
+ "cleanupUnusedCatalogs",
1085
+ "dedupeDirectDeps",
1086
+ "deployAllFiles",
1087
+ "enablePrePostScripts",
1088
+ "engineStrict",
1089
+ "extendNodePath",
1090
+ "hoist",
1091
+ "hoistPattern",
1092
+ "hoistWorkspacePackages",
1093
+ "ignoreCompatibilityDb",
1094
+ "ignoreDepScripts",
1095
+ "ignoreScripts",
1096
+ "ignoreWorkspaceRootCheck",
1097
+ "managePackageManagerVersions",
1098
+ "minimumReleaseAge",
1099
+ "minimumReleaseAgeExclude",
1100
+ "modulesDir",
1101
+ "nodeLinker",
1102
+ "nodeVersion",
1103
+ "optimisticRepeatInstall",
1104
+ "packageManagerStrict",
1105
+ "packageManagerStrictVersion",
1106
+ "preferSymlinkedExecutables",
1107
+ "preferWorkspacePackages",
1108
+ "publicHoistPattern",
1109
+ "registrySupportsTimeField",
1110
+ "requiredScrpts",
1111
+ "resolutionMode",
1112
+ "savePrefix",
1113
+ "scriptShell",
1114
+ "shamefullyHoist",
1115
+ "shellEmulator",
1116
+ "stateDir",
1117
+ "supportedArchitectures",
1118
+ "symlink",
1119
+ "tag",
1120
+ "trustPolicy",
1121
+ "trustPolicyExclude",
1122
+ "updateNotifier"
1123
+ ],
1124
+ "packages",
1125
+ "overrides",
1126
+ "patchedDependencies",
1127
+ "catalog",
1128
+ "catalogs",
1129
+ ...[
1130
+ "allowedDeprecatedVersions",
1131
+ "allowNonAppliedPatches",
1132
+ "configDependencies",
1133
+ "ignoredBuiltDependencies",
1134
+ "ignoredOptionalDependencies",
1135
+ "neverBuiltDependencies",
1136
+ "onlyBuiltDependencies",
1137
+ "onlyBuiltDependenciesFile",
1138
+ "packageExtensions",
1139
+ "peerDependencyRules"
1140
+ ]
1141
+ ],
1142
+ pathPattern: "^$"
1143
+ },
1144
+ {
1145
+ order: { type: "asc" },
1146
+ pathPattern: ".*"
1147
+ }
1148
+ ] }
993
1149
  }
994
- }];
1150
+ ];
995
1151
  }
996
1152
 
997
1153
  //#endregion
998
1154
  //#region src/configs/react.ts
999
1155
  async function react(options = {}) {
1000
1156
  const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
1157
+ await ensurePackages([
1158
+ "@eslint-react/eslint-plugin",
1159
+ "eslint-plugin-react-hooks",
1160
+ "eslint-plugin-react-refresh"
1161
+ ]);
1001
1162
  const isTypeAware = !!tsconfigPath;
1002
1163
  const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
1003
1164
  const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
@@ -1006,6 +1167,7 @@ async function react(options = {}) {
1006
1167
  interopDefault(import("eslint-plugin-react-refresh"))
1007
1168
  ]);
1008
1169
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
1170
+ const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
1009
1171
  const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
1010
1172
  const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
1011
1173
  const plugins = pluginReact.configs.all.plugins;
@@ -1030,6 +1192,7 @@ async function react(options = {}) {
1030
1192
  },
1031
1193
  name: "react/rules",
1032
1194
  rules: {
1195
+ "react/jsx-no-comment-textnodes": "warn",
1033
1196
  "react/jsx-no-duplicate-props": "warn",
1034
1197
  "react/jsx-uses-vars": "warn",
1035
1198
  "react/no-access-state-in-setstate": "error",
@@ -1040,7 +1203,6 @@ async function react(options = {}) {
1040
1203
  "react/no-children-only": "warn",
1041
1204
  "react/no-children-to-array": "warn",
1042
1205
  "react/no-clone-element": "warn",
1043
- "react/no-comment-textnodes": "warn",
1044
1206
  "react/no-component-will-mount": "error",
1045
1207
  "react/no-component-will-receive-props": "error",
1046
1208
  "react/no-component-will-update": "error",
@@ -1059,6 +1221,7 @@ async function react(options = {}) {
1059
1221
  "react/no-set-state-in-component-did-update": "warn",
1060
1222
  "react/no-set-state-in-component-will-update": "warn",
1061
1223
  "react/no-string-refs": "error",
1224
+ "react/no-unnecessary-use-prefix": "warn",
1062
1225
  "react/no-unsafe-component-will-mount": "warn",
1063
1226
  "react/no-unsafe-component-will-receive-props": "warn",
1064
1227
  "react/no-unsafe-component-will-update": "warn",
@@ -1068,6 +1231,7 @@ async function react(options = {}) {
1068
1231
  "react/no-unused-state": "warn",
1069
1232
  "react/no-use-context": "warn",
1070
1233
  "react/no-useless-forward-ref": "warn",
1234
+ "react/prefer-use-state-lazy-initialization": "warn",
1071
1235
  "react/prefer-shorthand-boolean": "warn",
1072
1236
  "react/prefer-destructuring-assignment": "warn",
1073
1237
  "react/no-missing-context-display-name": "warn",
@@ -1087,11 +1251,8 @@ async function react(options = {}) {
1087
1251
  "react-dom/no-unsafe-target-blank": "warn",
1088
1252
  "react-dom/no-use-form-state": "error",
1089
1253
  "react-dom/no-void-elements-with-children": "error",
1090
- "react-hooks/exhaustive-deps": "warn",
1091
- "react-hooks/rules-of-hooks": "error",
1254
+ ...pluginReactHooks.configs.recommended.rules,
1092
1255
  "react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
1093
- "react-hooks-extra/no-unnecessary-use-prefix": "warn",
1094
- "react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
1095
1256
  "react-web-api/no-leaked-event-listener": "warn",
1096
1257
  "react-web-api/no-leaked-interval": "warn",
1097
1258
  "react-web-api/no-leaked-resize-observer": "warn",
@@ -1114,7 +1275,7 @@ async function react(options = {}) {
1114
1275
  "generateMetadata",
1115
1276
  "viewport",
1116
1277
  "generateViewport"
1117
- ] : [], ...isUsingReactRouter ? [
1278
+ ] : [], ...isUsingRemix || isUsingReactRouter ? [
1118
1279
  "meta",
1119
1280
  "links",
1120
1281
  "headers",
@@ -1299,6 +1460,14 @@ async function sortPackageJson() {
1299
1460
  order: { type: "asc" },
1300
1461
  pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
1301
1462
  },
1463
+ {
1464
+ order: { type: "asc" },
1465
+ pathPattern: "^workspaces\\.catalog$"
1466
+ },
1467
+ {
1468
+ order: { type: "asc" },
1469
+ pathPattern: "^workspaces\\.catalogs\\.[^.]+$"
1470
+ },
1302
1471
  {
1303
1472
  order: [
1304
1473
  "types",
@@ -1449,6 +1618,44 @@ function sortTsconfig() {
1449
1618
  }];
1450
1619
  }
1451
1620
 
1621
+ //#endregion
1622
+ //#region src/configs/test.ts
1623
+ let _pluginTest;
1624
+ async function test(options = {}) {
1625
+ const { files = GLOB_TESTS, isInEditor = false, overrides = {} } = options;
1626
+ const [pluginVitest, pluginNoOnlyTests] = await Promise.all([interopDefault(import("@vitest/eslint-plugin")), interopDefault(import("eslint-plugin-no-only-tests"))]);
1627
+ _pluginTest = _pluginTest || {
1628
+ ...pluginVitest,
1629
+ rules: {
1630
+ ...pluginVitest.rules,
1631
+ ...pluginNoOnlyTests.rules
1632
+ }
1633
+ };
1634
+ return [{
1635
+ name: "test/setup",
1636
+ plugins: { test: _pluginTest }
1637
+ }, {
1638
+ files,
1639
+ name: "test/rules",
1640
+ rules: {
1641
+ "test/consistent-test-it": ["error", {
1642
+ fn: "it",
1643
+ withinDescribe: "it"
1644
+ }],
1645
+ "test/no-identical-title": "error",
1646
+ "test/no-import-node-test": "error",
1647
+ "test/no-only-tests": isInEditor ? "warn" : "error",
1648
+ "test/prefer-hooks-in-order": "error",
1649
+ "test/prefer-lowercase-title": "error",
1650
+ "antfu/no-top-level-await": "off",
1651
+ "no-unused-expressions": "off",
1652
+ "node/prefer-global/process": "off",
1653
+ "ts/explicit-function-return-type": "off",
1654
+ ...overrides
1655
+ }
1656
+ }];
1657
+ }
1658
+
1452
1659
  //#endregion
1453
1660
  //#region src/configs/toml.ts
1454
1661
  async function toml(options = {}) {
@@ -1493,7 +1700,7 @@ async function toml(options = {}) {
1493
1700
  //#endregion
1494
1701
  //#region src/configs/typescript.ts
1495
1702
  async function typescript(options = {}) {
1496
- const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1703
+ const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
1497
1704
  const files = options.files ?? [
1498
1705
  GLOB_TS,
1499
1706
  GLOB_TSX,
@@ -1620,6 +1827,16 @@ async function typescript(options = {}) {
1620
1827
  ...typeAwareRules,
1621
1828
  ...overridesTypeAware
1622
1829
  }
1830
+ }] : [],
1831
+ ...erasableOnly ? [{
1832
+ name: "antfu/typescript/erasable-syntax-only",
1833
+ plugins: { "erasable-syntax-only": await interopDefault(import("./lib-CEKTiw7V.js")) },
1834
+ rules: {
1835
+ "erasable-syntax-only/enums": "error",
1836
+ "erasable-syntax-only/import-aliases": "error",
1837
+ "erasable-syntax-only/namespaces": "error",
1838
+ "erasable-syntax-only/parameter-properties": "error"
1839
+ }
1623
1840
  }] : []
1624
1841
  ];
1625
1842
  }
@@ -1883,77 +2100,41 @@ async function yaml(options = {}) {
1883
2100
  const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
1884
2101
  const { indent = 2, quotes = "single" } = typeof stylistic$1 === "boolean" ? {} : stylistic$1;
1885
2102
  const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
1886
- return [
1887
- {
1888
- name: "yaml/setup",
1889
- plugins: { yaml: pluginYaml }
1890
- },
1891
- {
1892
- files,
1893
- languageOptions: { parser: parserYaml },
1894
- name: "yaml/rules",
1895
- rules: {
1896
- "style/spaced-comment": "off",
1897
- "yaml/block-mapping": "error",
1898
- "yaml/block-sequence": "error",
1899
- "yaml/no-empty-key": "error",
1900
- "yaml/no-empty-sequence-entry": "error",
1901
- "yaml/no-irregular-whitespace": "error",
1902
- "yaml/plain-scalar": "error",
1903
- "yaml/vue-custom-block/no-parsing-error": "error",
1904
- ...stylistic$1 ? {
1905
- "yaml/block-mapping-question-indicator-newline": "error",
1906
- "yaml/block-sequence-hyphen-indicator-newline": "error",
1907
- "yaml/flow-mapping-curly-newline": "error",
1908
- "yaml/flow-mapping-curly-spacing": "error",
1909
- "yaml/flow-sequence-bracket-newline": "error",
1910
- "yaml/flow-sequence-bracket-spacing": "error",
1911
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
1912
- "yaml/key-spacing": "error",
1913
- "yaml/no-tab-indent": "error",
1914
- "yaml/quotes": ["error", {
1915
- avoidEscape: true,
1916
- prefer: quotes === "backtick" ? "single" : quotes
1917
- }],
1918
- "yaml/spaced-comment": "error"
1919
- } : {},
1920
- ...overrides
1921
- }
1922
- },
1923
- {
1924
- files: ["pnpm-workspace.yaml"],
1925
- name: "yaml/pnpm-workspace",
1926
- rules: { "yaml/sort-keys": [
1927
- "error",
1928
- {
1929
- order: [
1930
- "packages",
1931
- "overrides",
1932
- "patchedDependencies",
1933
- "hoistPattern",
1934
- "catalog",
1935
- "catalogs",
1936
- "allowedDeprecatedVersions",
1937
- "allowNonAppliedPatches",
1938
- "configDependencies",
1939
- "ignoredBuiltDependencies",
1940
- "ignoredOptionalDependencies",
1941
- "neverBuiltDependencies",
1942
- "onlyBuiltDependencies",
1943
- "onlyBuiltDependenciesFile",
1944
- "packageExtensions",
1945
- "peerDependencyRules",
1946
- "supportedArchitectures"
1947
- ],
1948
- pathPattern: "^$"
1949
- },
1950
- {
1951
- order: { type: "asc" },
1952
- pathPattern: ".*"
1953
- }
1954
- ] }
2103
+ return [{
2104
+ name: "yaml/setup",
2105
+ plugins: { yaml: pluginYaml }
2106
+ }, {
2107
+ files,
2108
+ languageOptions: { parser: parserYaml },
2109
+ name: "yaml/rules",
2110
+ rules: {
2111
+ "style/spaced-comment": "off",
2112
+ "yaml/block-mapping": "error",
2113
+ "yaml/block-sequence": "error",
2114
+ "yaml/no-empty-key": "error",
2115
+ "yaml/no-empty-sequence-entry": "error",
2116
+ "yaml/no-irregular-whitespace": "error",
2117
+ "yaml/plain-scalar": "error",
2118
+ "yaml/vue-custom-block/no-parsing-error": "error",
2119
+ ...stylistic$1 ? {
2120
+ "yaml/block-mapping-question-indicator-newline": "error",
2121
+ "yaml/block-sequence-hyphen-indicator-newline": "error",
2122
+ "yaml/flow-mapping-curly-newline": "error",
2123
+ "yaml/flow-mapping-curly-spacing": "error",
2124
+ "yaml/flow-sequence-bracket-newline": "error",
2125
+ "yaml/flow-sequence-bracket-spacing": "error",
2126
+ "yaml/indent": ["error", indent === "tab" ? 2 : indent],
2127
+ "yaml/key-spacing": "error",
2128
+ "yaml/no-tab-indent": "error",
2129
+ "yaml/quotes": ["error", {
2130
+ avoidEscape: true,
2131
+ prefer: quotes === "backtick" ? "single" : quotes
2132
+ }],
2133
+ "yaml/spaced-comment": "error"
2134
+ } : {},
2135
+ ...overrides
1955
2136
  }
1956
- ];
2137
+ }];
1957
2138
  }
1958
2139
 
1959
2140
  //#endregion
@@ -1977,6 +2158,7 @@ const defaultPluginRenaming = {
1977
2158
  "@typescript-eslint": "ts",
1978
2159
  "import-lite": "import",
1979
2160
  "n": "node",
2161
+ "vitest": "test",
1980
2162
  "yml": "yaml"
1981
2163
  };
1982
2164
  /**
@@ -1990,8 +2172,7 @@ const defaultPluginRenaming = {
1990
2172
  * The merged ESLint configurations.
1991
2173
  */
1992
2174
  function config(options = {}, ...userConfigs) {
1993
- const isUsingReact = ReactPackages.some((i) => isPackageExists(i));
1994
- const { autoRenamePlugins = true, componentExts = [], effector: enableEffector = isPackageExists("effector"), gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, next: enableNext = NextJsPackages.some((i) => isPackageExists(i)), pnpm: enableCatalogs = false, react: enableReact = isUsingReact, reactNative: enableReactNative = ReactNativePackages.some((i) => isPackageExists(i)), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2175
+ const { autoRenamePlugins = true, componentExts = [], effector: enableEffector = isPackageExists("effector"), gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsx: enableJsx = true, nextjs: enableNext = NextJsPackages.some((i) => isPackageExists(i)), pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = ReactPackages.some((i) => isPackageExists(i)), reactNative: enableReactNative = ReactNativePackages.some((i) => isPackageExists(i)), regexp: enableRegexp = true, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = isPackageExists("unocss"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
1995
2176
  let isInEditor = options.isInEditor;
1996
2177
  if (isInEditor == null) {
1997
2178
  isInEditor = isInEditorEnv();
@@ -2010,10 +2191,10 @@ function config(options = {}, ...userConfigs) {
2010
2191
  })]));
2011
2192
  const typescriptOptions = resolveSubOptions(options, "typescript");
2012
2193
  const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2013
- configs$1.push(ignores(options.ignores), javascript({
2194
+ configs$1.push(ignores(userIgnores), javascript({
2014
2195
  isInEditor,
2015
2196
  overrides: getOverrides(options, "javascript")
2016
- }), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
2197
+ }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), perfectionist());
2017
2198
  if (enableImports) configs$1.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
2018
2199
  stylistic: stylisticOptions,
2019
2200
  ...enableImports
@@ -2032,6 +2213,10 @@ function config(options = {}, ...userConfigs) {
2032
2213
  overrides: getOverrides(options, "stylistic")
2033
2214
  }));
2034
2215
  if (enableRegexp) configs$1.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
2216
+ if (options.test ?? true) configs$1.push(test({
2217
+ isInEditor,
2218
+ overrides: getOverrides(options, "test")
2219
+ }));
2035
2220
  if (enableVue) configs$1.push(vue({
2036
2221
  ...resolveSubOptions(options, "vue"),
2037
2222
  overrides: getOverrides(options, "vue"),
@@ -2047,7 +2232,7 @@ function config(options = {}, ...userConfigs) {
2047
2232
  ...resolveSubOptions(options, "reactNative"),
2048
2233
  overrides: getOverrides(options, "reactNative")
2049
2234
  }));
2050
- if (enableNext) configs$1.push(next({ overrides: getOverrides(options, "next") }));
2235
+ if (enableNext) configs$1.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
2051
2236
  if (enableEffector) configs$1.push(effector({
2052
2237
  ...resolveSubOptions(options, "effector"),
2053
2238
  overrides: getOverrides(options, "effector")
@@ -2060,7 +2245,7 @@ function config(options = {}, ...userConfigs) {
2060
2245
  overrides: getOverrides(options, "jsonc"),
2061
2246
  stylistic: stylisticOptions
2062
2247
  }), sortPackageJson(), sortTsconfig());
2063
- if (enableCatalogs) configs$1.push(pnpm());
2248
+ if (enableCatalogs) configs$1.push(pnpm({ isInEditor }));
2064
2249
  if (options.yaml ?? true) configs$1.push(yaml({
2065
2250
  overrides: getOverrides(options, "yaml"),
2066
2251
  stylistic: stylisticOptions
@@ -2084,7 +2269,11 @@ function config(options = {}, ...userConfigs) {
2084
2269
  let composer = new FlatConfigComposer();
2085
2270
  composer = composer.append(...configs$1, ...userConfigs);
2086
2271
  if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
2087
- if (isInEditor) composer = composer.disableRulesFix(["unused-imports/no-unused-imports", "prefer-const"], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
2272
+ if (isInEditor) composer = composer.disableRulesFix([
2273
+ "unused-imports/no-unused-imports",
2274
+ "test/no-only-tests",
2275
+ "prefer-const"
2276
+ ], { builtinRules: () => import(["eslint", "use-at-your-own-risk"].join("/")).then((r) => r.builtinRules) });
2088
2277
  return composer;
2089
2278
  }
2090
2279
 
@@ -2093,4 +2282,4 @@ function config(options = {}, ...userConfigs) {
2093
2282
  var src_default = config;
2094
2283
 
2095
2284
  //#endregion
2096
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, config, src_default as default, defaultPluginRenaming, disables, effector, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsonc, jsx, markdown, next, node, parserPlain, perfectionist, pnpm, react, reactNative, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, toml, typescript, unicorn, unocss, vue, yaml };
2285
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, config, src_default as default, defaultPluginRenaming, disables, effector, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, reactNative, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toml, typescript, unicorn, unocss, vue, yaml };