@moso/eslint-config 3.5.0 → 3.6.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.
Files changed (4) hide show
  1. package/README.md +91 -3
  2. package/dist/index.d.mts +1428 -509
  3. package/dist/index.mjs +410 -222
  4. package/package.json +48 -26
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, ESLintUtils } from "@typescript-eslint
5
5
  import { isIdentifier } from "@typescript-eslint/utils/ast-utils";
6
6
  import globals from "globals";
7
7
  import { FlatConfigComposer } from "eslint-flat-config-utils";
8
- //#region package.json
8
+ // package.json
9
9
  var peerDependenciesMeta = {
10
10
  "@eslint-react/eslint-plugin": { "optional": true },
11
11
  "@next/eslint-plugin-next": { "optional": true },
@@ -17,12 +17,13 @@ var peerDependenciesMeta = {
17
17
  "eslint-plugin-react-hooks": { "optional": true },
18
18
  "eslint-plugin-react-refresh": { "optional": true },
19
19
  "eslint-plugin-react-you-might-not-need-an-effect": { "optional": true },
20
+ "eslint-plugin-svelte": { "optional": true },
20
21
  "eslint-plugin-vue": { "optional": true },
21
22
  "eslint-plugin-vuejs-accessibility": { "optional": true },
23
+ "svelte-eslint-parser": { "optional": true },
22
24
  "typescript": { "optional": true }
23
25
  };
24
- //#endregion
25
- //#region src/utils.ts
26
+ // src/utils.ts
26
27
  /**
27
28
  * Resolve and flatten any mix of (awaitable) config items or arrays
28
29
  * into a single flat array of config items.
@@ -202,8 +203,7 @@ const vueInlineElements = [
202
203
  "var",
203
204
  "video"
204
205
  ];
205
- //#endregion
206
- //#region src/tools.ts
206
+ // src/tools.ts
207
207
  const scopeURL = import.meta.dirname;
208
208
  /**
209
209
  * The optional peer dependencies in a self-maintained list.
@@ -248,8 +248,7 @@ const loadPackages = async (packageIds) => {
248
248
  }
249
249
  return Promise.all(packageIds.map(async (id) => interopDefault(import(id))));
250
250
  };
251
- //#endregion
252
- //#region src/configs/astro.ts
251
+ // src/configs/astro.ts
253
252
  const astro = async (options) => {
254
253
  const { a11y, files, lessOpinionated, overrides, overridesA11y, parserOptions, stylistic, typescript } = options;
255
254
  const stylisticEnabled = stylistic !== false;
@@ -311,8 +310,7 @@ const astro = async (options) => {
311
310
  }
312
311
  }];
313
312
  };
314
- //#endregion
315
- //#region src/configs/baseline.ts
313
+ // src/configs/baseline.ts
316
314
  const defaultIgnoreFeatures = ["functions-caller-arguments"];
317
315
  const baseline = async (options) => {
318
316
  const { baseline = "widely", files, filesTypeAware, hasDOM, ignoreFeatures, ignoreNodeTypes, ignoresTypeAware, overrides, overridesTypeAware, parserOptions, projectRoot, typescript } = options;
@@ -349,8 +347,7 @@ const baseline = async (options) => {
349
347
  }] : []
350
348
  ];
351
349
  };
352
- //#endregion
353
- //#region src/globs.ts
350
+ // src/globs.ts
354
351
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
355
352
  const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
356
353
  const GLOB_JS = "**/*.?([cm])js";
@@ -374,6 +371,8 @@ const GLOB_JSONC = "**/*.jsonc";
374
371
  const GLOB_ASTRO = "**/*.astro";
375
372
  const GLOB_ASTRO_TS = "**/*.astro/*.ts";
376
373
  const GLOB_MARKDOWN = "**/*.md";
374
+ const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
375
+ const GLOB_SVELTE_MODULE = "**/*.svelte.{js,ts}";
377
376
  const GLOB_TOML = "**/*.toml";
378
377
  const GLOB_VUE = "**/*.vue";
379
378
  const GLOB_YAML = "**/*.y?(a)ml";
@@ -416,6 +415,7 @@ const GLOB_EXCLUDE = [
416
415
  "**/.nitro",
417
416
  "**/.nuxt",
418
417
  "**/.output",
418
+ "**/.svelte-kit",
419
419
  "**/.temp",
420
420
  "**/.tmp",
421
421
  "**/.vercel",
@@ -433,8 +433,7 @@ const GLOB_EXCLUDE = [
433
433
  GLOB_CSS_IN_JS,
434
434
  ...GLOB_AI
435
435
  ];
436
- //#endregion
437
- //#region src/configs/disables.ts
436
+ // src/configs/disables.ts
438
437
  const disables = async (functionalEnabled = false) => {
439
438
  const [functionalPlugin] = functionalEnabled ? await loadPackages(["eslint-plugin-functional"]) : [void 0];
440
439
  return [
@@ -508,6 +507,7 @@ const disables = async (functionalEnabled = false) => {
508
507
  GLOB_ASTRO_TS,
509
508
  GLOB_DTS,
510
509
  GLOB_JSX,
510
+ GLOB_SVELTE,
511
511
  GLOB_TS,
512
512
  GLOB_TSX,
513
513
  GLOB_VUE
@@ -615,8 +615,7 @@ const disables = async (functionalEnabled = false) => {
615
615
  }
616
616
  ];
617
617
  };
618
- //#endregion
619
- //#region src/configs/e18e.ts
618
+ // src/configs/e18e.ts
620
619
  const e18e = async (options) => {
621
620
  const { isInEditor, lessOpinionated, mode, modernization, moduleReplacements, overrides, performanceImprovements } = options;
622
621
  const [e18ePlugin] = await loadPackages(["@e18e/eslint-plugin"]);
@@ -643,8 +642,7 @@ const e18e = async (options) => {
643
642
  }
644
643
  }];
645
644
  };
646
- //#endregion
647
- //#region src/configs/eslint-comments.ts
645
+ // src/configs/eslint-comments.ts
648
646
  const comments = async (options) => {
649
647
  const { overrides } = options;
650
648
  const [eslintComments] = await loadPackages(["@eslint-community/eslint-plugin-eslint-comments"]);
@@ -658,8 +656,7 @@ const comments = async (options) => {
658
656
  }
659
657
  }];
660
658
  };
661
- //#endregion
662
- //#region src/configs/functional.ts
659
+ // src/configs/functional.ts
663
660
  const functional = async (options) => {
664
661
  const { filesTypeAware, functionalEnforcement, ignoreNamePattern, mode, overrides, parserOptions, stylistic } = options;
665
662
  const isTypeAware = parserOptions.projectService !== false;
@@ -769,8 +766,7 @@ const functional = async (options) => {
769
766
  }
770
767
  }];
771
768
  };
772
- //#endregion
773
- //#region src/configs/ignores.ts
769
+ // src/configs/ignores.ts
774
770
  const ignores = async (options) => {
775
771
  const { gitignore = true, ignoreTypeScript, userIgnores } = options;
776
772
  const [eslintConfigFlatGitIgnore] = await loadPackages(["eslint-config-flat-gitignore"]);
@@ -785,8 +781,7 @@ const ignores = async (options) => {
785
781
  }));
786
782
  return mut_configs;
787
783
  };
788
- //#endregion
789
- //#region src/rules/utils.ts
784
+ // src/rules/utils.ts
790
785
  /**
791
786
  * Typed rule factory for every rule in this plugin.
792
787
  *
@@ -895,7 +890,7 @@ const functionLikeTypes = /* @__PURE__ */ new Set([
895
890
  /**
896
891
  * Whether `node` is a function declaration, function expression, or arrow function.
897
892
  */
898
- const isFunctionLike = (node) => node ? functionLikeTypes.has(node.type) : false;
893
+ const isFunctionLike = (node) => node !== null && node !== void 0 && functionLikeTypes.has(node.type);
899
894
  /**
900
895
  * Whether `node` is an identifier matching `name` given as an exact string,
901
896
  * a list of accepted names, or a predicate over the identifier's name.
@@ -933,8 +928,7 @@ const makeProgramListener = (pattern, onReport) => ({ Program: (program) => {
933
928
  * Lets a derived value be computed inline where a statement would otherwise be needed.
934
929
  */
935
930
  const wrap = (input, callback) => callback(input);
936
- //#endregion
937
- //#region src/rules/avoid-barrel-files/avoid-barrel-files.ts
931
+ // src/rules/avoid-barrel-files/avoid-barrel-files.ts
938
932
  const declarationTypes = /* @__PURE__ */ new Set([
939
933
  AST_NODE_TYPES.ClassDeclaration,
940
934
  AST_NODE_TYPES.FunctionDeclaration,
@@ -959,9 +953,9 @@ const ruleAvoidBarrelFiles = createRule({
959
953
  } },
960
954
  additionalProperties: false
961
955
  }],
962
- messages: { avoidBarrelFiles: "Barrel file detected." }
956
+ messages: { avoidBarrelFiles: "Barrel file detected." },
957
+ defaultOptions: [{ amountOfExportsToConsiderModuleAsBarrel: 3 }]
963
958
  },
964
- defaultOptions: [{ amountOfExportsToConsiderModuleAsBarrel: 3 }],
965
959
  create: (context, [{ amountOfExportsToConsiderModuleAsBarrel }]) => ({ Program(node) {
966
960
  const { declarationCount, exportCount } = node.body.reduce(({ declarationCount, exportCount }, statement) => {
967
961
  if (statement.type === AST_NODE_TYPES.VariableDeclaration) return {
@@ -1004,8 +998,7 @@ const ruleAvoidBarrelFiles = createRule({
1004
998
  });
1005
999
  } })
1006
1000
  });
1007
- //#endregion
1008
- //#region src/rules/no-bidi/no-bidi.ts
1001
+ // src/rules/no-bidi/no-bidi.ts
1009
1002
  const BIDI_PATTERN = /[\u{61C}\u{202A}-\u{202E}\u{2066}-\u{2069}]/u;
1010
1003
  const BIDI_PATTERN_GLOBAL = new RegExp(BIDI_PATTERN.source, "gu");
1011
1004
  const ruleNoBidi = createRule({
@@ -1033,8 +1026,7 @@ const ruleNoBidi = createRule({
1033
1026
  });
1034
1027
  })
1035
1028
  });
1036
- //#endregion
1037
- //#region src/rules/no-force-cast-via-top-type/no-force-cast-via-top-type.ts
1029
+ // src/rules/no-force-cast-via-top-type/no-force-cast-via-top-type.ts
1038
1030
  const isTopType = (node) => node.type === AST_NODE_TYPES.TSAnyKeyword || node.type === AST_NODE_TYPES.TSUnknownKeyword;
1039
1031
  const isCastToAnotherType = (node) => node?.type === AST_NODE_TYPES.TSAsExpression && !isTopType(node.typeAnnotation);
1040
1032
  const ruleNoForceCastViaTopType = createRule({
@@ -1059,8 +1051,7 @@ const ruleNoForceCastViaTopType = createRule({
1059
1051
  });
1060
1052
  } })
1061
1053
  });
1062
- //#endregion
1063
- //#region src/rules/no-import-duplicates/no-import-duplicates.ts
1054
+ // src/rules/no-import-duplicates/no-import-duplicates.ts
1064
1055
  const ruleNoImportDuplicates = createRule({
1065
1056
  name: "no-import-duplicates",
1066
1057
  meta: {
@@ -1098,8 +1089,7 @@ const ruleNoImportDuplicates = createRule({
1098
1089
  }, /* @__PURE__ */ new Set());
1099
1090
  } })
1100
1091
  });
1101
- //#endregion
1102
- //#region src/rules/no-import-from-dist/no-import-from-dist.ts
1092
+ // src/rules/no-import-from-dist/no-import-from-dist.ts
1103
1093
  const DIST_CHECK = /\/dist(?:\/|$)/u;
1104
1094
  const isDist = (path) => path.startsWith(".") && DIST_CHECK.test(path) || path === "dist";
1105
1095
  const ruleNoImportFromDist = createRule({
@@ -1132,8 +1122,7 @@ const ruleNoImportFromDist = createRule({
1132
1122
  }
1133
1123
  })
1134
1124
  });
1135
- //#endregion
1136
- //#region src/rules/no-import-node-modules-by-path/no-import-node-modules-by-path.ts
1125
+ // src/rules/no-import-node-modules-by-path/no-import-node-modules-by-path.ts
1137
1126
  const ruleNoImportNodeModulesByPath = createRule({
1138
1127
  name: "no-import-node-modules-by-path",
1139
1128
  meta: {
@@ -1162,8 +1151,7 @@ const ruleNoImportNodeModulesByPath = createRule({
1162
1151
  }
1163
1152
  })
1164
1153
  });
1165
- //#endregion
1166
- //#region src/rules/no-invisible-characters/no-invisible-characters.ts
1154
+ // src/rules/no-invisible-characters/no-invisible-characters.ts
1167
1155
  const combinePattern = (...patterns) => {
1168
1156
  const source = patterns.map((pattern) => pattern.source).join("");
1169
1157
  return new RegExp(`[${source}]`, "u");
@@ -1191,9 +1179,8 @@ const ruleNoInvisibleCharacters = createRule({
1191
1179
  });
1192
1180
  })
1193
1181
  });
1194
- //#endregion
1195
- //#region src/rules/no-redundant-variable/no-redundant-variable.ts
1196
- const isRedundantVariable = (node, exit) => node ? node.type === AST_NODE_TYPES.VariableDeclaration && node.declarations.length === 1 && node.declarations[0].init !== null && isSameIdentifier(exit.argument, node.declarations[0].id) : false;
1182
+ // src/rules/no-redundant-variable/no-redundant-variable.ts
1183
+ const isRedundantVariable = (node, exit) => node?.type === AST_NODE_TYPES.VariableDeclaration && node.declarations.length === 1 && node.declarations[0].init !== null && isSameIdentifier(exit.argument, node.declarations[0].id);
1197
1184
  const isRedundantVariableFixer = (source, variable, id, init, exit) => (fixer) => {
1198
1185
  const replaced = getReturnExpression(init);
1199
1186
  const modified = wrap(source.getText(replaced), (input) => {
@@ -1237,8 +1224,7 @@ const ruleNoRedundantVariables = createRule({
1237
1224
  }
1238
1225
  } })
1239
1226
  });
1240
- //#endregion
1241
- //#region src/rules/no-string-interpolation/no-string-interpolation.ts
1227
+ // src/rules/no-string-interpolation/no-string-interpolation.ts
1242
1228
  const isMultiline = ({ loc }) => loc.start.line !== loc.end.line;
1243
1229
  const ruleNoStringInterpolation = createRule({
1244
1230
  name: "no-string-interpolation",
@@ -1259,8 +1245,7 @@ const ruleNoStringInterpolation = createRule({
1259
1245
  });
1260
1246
  } })
1261
1247
  });
1262
- //#endregion
1263
- //#region src/rules/no-top-level-await/no-top-level-await.ts
1248
+ // src/rules/no-top-level-await/no-top-level-await.ts
1264
1249
  const ruleNoTopLevelAwait = createRule({
1265
1250
  name: "no-top-level-await",
1266
1251
  meta: {
@@ -1309,8 +1294,7 @@ const ruleNoTopLevelAwait = createRule({
1309
1294
  };
1310
1295
  }
1311
1296
  });
1312
- //#endregion
1313
- //#region src/rules/no-unneeded-array-flat-map/no-unneeded-array-flat-map.ts
1297
+ // src/rules/no-unneeded-array-flat-map/no-unneeded-array-flat-map.ts
1314
1298
  const ruleNoUnneededArrayFlatMap = createRule({
1315
1299
  name: "no-unneeded-array-flat-map",
1316
1300
  meta: {
@@ -1335,11 +1319,9 @@ const ruleNoUnneededArrayFlatMap = createRule({
1335
1319
  });
1336
1320
  } })
1337
1321
  });
1338
- //#endregion
1339
- //#region src/rules/package.json
1340
- var version = "3.5.0";
1341
- //#endregion
1342
- //#region src/rules/prefer-early-return/prefer-early-return.ts
1322
+ // src/rules/package.json
1323
+ var version = "3.6.1";
1324
+ // src/rules/prefer-early-return/prefer-early-return.ts
1343
1325
  const isTriggering = (node, maximumStatements) => {
1344
1326
  if (node.type !== AST_NODE_TYPES.IfStatement || node.alternate !== null) return false;
1345
1327
  const { consequent } = node;
@@ -1373,9 +1355,9 @@ const rulePreferEarlyReturns = createRule({
1373
1355
  } },
1374
1356
  additionalProperties: false
1375
1357
  }],
1376
- messages: { preferEarlyReturn: "Prefer an early return to a conditionally-wrapped function body." }
1358
+ messages: { preferEarlyReturn: "Prefer an early return to a conditionally-wrapped function body." },
1359
+ defaultOptions: [{ maximumStatements: 1 }]
1377
1360
  },
1378
- defaultOptions: [{ maximumStatements: 1 }],
1379
1361
  create: (context, [{ maximumStatements }]) => ({ BlockStatement: ({ body, parent }) => {
1380
1362
  if (!isFunctionLike(parent)) return;
1381
1363
  const statement = body.at(0);
@@ -1387,8 +1369,7 @@ const rulePreferEarlyReturns = createRule({
1387
1369
  });
1388
1370
  } })
1389
1371
  });
1390
- //#endregion
1391
- //#region src/rules/prefer-fetch/prefer-fetch.ts
1372
+ // src/rules/prefer-fetch/prefer-fetch.ts
1392
1373
  const ACTIVEX_OBJECT = /xmlhttp/iu;
1393
1374
  const HTTP_SYMBOL = "$http";
1394
1375
  const JQUERY_SYMBOLS = ["$", "jQuery"];
@@ -1444,8 +1425,7 @@ const rulePreferFetch = createRule({
1444
1425
  }
1445
1426
  })
1446
1427
  });
1447
- //#endregion
1448
- //#region src/rules/prefer-reduce-over-chaining/prefer-reduce-over-chaining.ts
1428
+ // src/rules/prefer-reduce-over-chaining/prefer-reduce-over-chaining.ts
1449
1429
  const arrayHighOrderFunctions = /* @__PURE__ */ new Set([
1450
1430
  "filter",
1451
1431
  "flatMap",
@@ -1478,8 +1458,7 @@ const rulePreferReduceOverChaining = createRule({
1478
1458
  });
1479
1459
  } })
1480
1460
  });
1481
- //#endregion
1482
- //#region src/rules/prefer-strict-number-guards/prefer-strict-number-guards.ts
1461
+ // src/rules/prefer-strict-number-guards/prefer-strict-number-guards.ts
1483
1462
  const allGuards = [
1484
1463
  "check-parse-result",
1485
1464
  "encode-input-rule",
@@ -1582,9 +1561,9 @@ const rulePreferStrictNumberGuards = createRule({
1582
1561
  guardDerivedValue: "Dividing by a calculation hides whether that calculation can be zero. Name it in a `const`, check that name for zero, then divide.",
1583
1562
  useDirectOperands: "A nested division introduces a ratio that can round to zero. Use the direct operands instead - `a / (b / c)` is `(a * c) / b`.",
1584
1563
  writeExplicitCondition: "`0` is falsy, so a `||` fallback silently replaces a legitimate zero. Write `value === 0 ? fallback : value` instead."
1585
- }
1564
+ },
1565
+ defaultOptions: [{ guards: [...defaultGuards] }]
1586
1566
  },
1587
- defaultOptions: [{ guards: [...defaultGuards] }],
1588
1567
  create: (context, [{ guards }]) => {
1589
1568
  const enabled = new Set(guards);
1590
1569
  const mut_scopes = [];
@@ -1662,8 +1641,7 @@ const rulePreferStrictNumberGuards = createRule({
1662
1641
  };
1663
1642
  }
1664
1643
  });
1665
- //#endregion
1666
- //#region src/rules/index.ts
1644
+ // src/rules/index.ts
1667
1645
  const plugin = {
1668
1646
  meta: {
1669
1647
  name: "@moso/eslint-plugin",
@@ -1705,8 +1683,7 @@ var rules_default = {
1705
1683
  ...plugin,
1706
1684
  configs
1707
1685
  };
1708
- //#endregion
1709
- //#region src/configs/imports.ts
1686
+ // src/configs/imports.ts
1710
1687
  const imports = async (options) => {
1711
1688
  const { files, overrides, stylistic, typescript } = options;
1712
1689
  const [importLite] = await loadPackages(["eslint-plugin-import-lite"]);
@@ -1742,8 +1719,7 @@ const imports = async (options) => {
1742
1719
  }
1743
1720
  }] : []];
1744
1721
  };
1745
- //#endregion
1746
- //#region src/configs/javascript.ts
1722
+ // src/configs/javascript.ts
1747
1723
  const useNumberIsFinite = "Please use `Number.isFinite` instead.";
1748
1724
  const useNumberIsNan = "Please use `Number.isNaN` instead.";
1749
1725
  const useObjectDefineProperty = "Please use `Object.defineProperty` instead.";
@@ -2059,8 +2035,7 @@ const javascript = async (options) => {
2059
2035
  }
2060
2036
  }]];
2061
2037
  };
2062
- //#endregion
2063
- //#region src/configs/jsdoc.ts
2038
+ // src/configs/jsdoc.ts
2064
2039
  const jsdoc = async (options) => {
2065
2040
  const { files, lessOpinionated, overrides, stylistic, typescript } = options;
2066
2041
  const [jsdocPlugin] = await loadPackages(["eslint-plugin-jsdoc"]);
@@ -2142,8 +2117,7 @@ const jsdoc = async (options) => {
2142
2117
  }
2143
2118
  }];
2144
2119
  };
2145
- //#endregion
2146
- //#region src/configs/jsonc.ts
2120
+ // src/configs/jsonc.ts
2147
2121
  const jsonc = async (options) => {
2148
2122
  const { files, overrides, stylistic } = options;
2149
2123
  const { indent = 4 } = typeof stylistic === "boolean" ? {} : stylistic;
@@ -2203,8 +2177,7 @@ const jsonc = async (options) => {
2203
2177
  }
2204
2178
  }];
2205
2179
  };
2206
- //#endregion
2207
- //#region src/configs/jsx.ts
2180
+ // src/configs/jsx.ts
2208
2181
  const jsx = async (options) => {
2209
2182
  const { a11y, files, lessOpinionated, overrides, overridesA11y, stylistic } = options;
2210
2183
  const [jsxA11yPlugin] = a11y ? await loadPackages(["eslint-plugin-jsx-a11y"]) : [void 0];
@@ -2267,8 +2240,7 @@ const jsx = async (options) => {
2267
2240
  }
2268
2241
  }];
2269
2242
  };
2270
- //#endregion
2271
- //#region src/configs/nextjs.ts
2243
+ // src/configs/nextjs.ts
2272
2244
  const nextjs = async (options) => {
2273
2245
  const { files, mode, overrides, rootDir } = options;
2274
2246
  const [nextjsPlugin] = await loadPackages(["@next/eslint-plugin-next"]);
@@ -2294,8 +2266,7 @@ const nextjs = async (options) => {
2294
2266
  }
2295
2267
  }];
2296
2268
  };
2297
- //#endregion
2298
- //#region src/configs/node.ts
2269
+ // src/configs/node.ts
2299
2270
  const npmx = (packageName) => `https://npmx.dev/package/${packageName}`;
2300
2271
  const restricedImports = [
2301
2272
  {
@@ -2425,8 +2396,7 @@ const node = async (options) => {
2425
2396
  }] : []
2426
2397
  ];
2427
2398
  };
2428
- //#endregion
2429
- //#region src/configs/perfectionist.ts
2399
+ // src/configs/perfectionist.ts
2430
2400
  const commonOptions = {
2431
2401
  fallbackSort: {
2432
2402
  order: "asc",
@@ -2670,8 +2640,127 @@ const perfectionist = async (options) => {
2670
2640
  }
2671
2641
  }];
2672
2642
  };
2673
- //#endregion
2674
- //#region src/configs/promise.ts
2643
+ // src/configs/preact.ts
2644
+ const preact = async (options) => {
2645
+ const { a11y, files, filesTypeAware, ignoresTypeAware, lessOpinionated, overrides, overridesA11y, overridesTypeAware, parserOptions, projectRoot, stylistic, typescript } = options;
2646
+ const [reactPlugin, reactHooksPlugin, reactRefreshPlugin] = await loadPackages([
2647
+ "@eslint-react/eslint-plugin",
2648
+ "eslint-plugin-react-hooks",
2649
+ "eslint-plugin-react-refresh"
2650
+ ]);
2651
+ const isTypeAware = typescript && typeof projectRoot === "string" && parserOptions?.projectService !== false;
2652
+ const [jsxA11yPlugin] = a11y ? await loadPackages(["eslint-plugin-jsx-a11y"]) : [void 0];
2653
+ const stylisticEnabled = stylistic !== false;
2654
+ const [typescriptParser] = typescript ? await loadPackages(["@typescript-eslint/parser"]) : [void 0];
2655
+ return [
2656
+ {
2657
+ name: "moso/preact/setup",
2658
+ plugins: {
2659
+ "@eslint-react": memoize(reactPlugin, "@eslint-react"),
2660
+ "react-hooks": memoize(reactHooksPlugin, "eslint-plugin-react-hooks"),
2661
+ "react-refresh": memoize(reactRefreshPlugin, "eslint-plugin-react-refresh"),
2662
+ ...jsxA11yPlugin && { "jsx-a11y": memoize(jsxA11yPlugin, "eslint-plugin-jsx-a11y") }
2663
+ }
2664
+ },
2665
+ {
2666
+ name: "moso/preact/rules",
2667
+ files,
2668
+ languageOptions: {
2669
+ parser: typescript ? typescriptParser : void 0,
2670
+ parserOptions: {
2671
+ ecmaFeatures: { jsx: true },
2672
+ ...typescript && parserOptions
2673
+ },
2674
+ sourceType: "module"
2675
+ },
2676
+ rules: {
2677
+ ...lessOpinionated ? { ...(assert.ok(!Array.isArray(reactPlugin.configs.recommended)), reactPlugin.configs.recommended.rules) } : {
2678
+ ...(assert.ok(!Array.isArray(reactPlugin.configs.strict)), reactPlugin.configs.strict.rules),
2679
+ ...stylisticEnabled && {
2680
+ "@stylistic/jsx-closing-bracket-location": ["error", "line-aligned"],
2681
+ "@stylistic/jsx-curly-brace-presence": ["error", {
2682
+ props: "never",
2683
+ children: "never"
2684
+ }],
2685
+ "@stylistic/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
2686
+ "@stylistic/jsx-pascal-case": ["error", {
2687
+ allowAllCaps: true,
2688
+ ignore: []
2689
+ }],
2690
+ "@stylistic/jsx-self-closing-comp": "error",
2691
+ "@stylistic/jsx-tag-spacing": ["error", {
2692
+ afterOpening: "never",
2693
+ closingSlash: "never",
2694
+ beforeClosing: "never",
2695
+ beforeSelfClosing: "always"
2696
+ }],
2697
+ "@stylistic/jsx-wrap-multilines": ["error", {
2698
+ arrow: "parens-new-line",
2699
+ assignment: "parens-new-line",
2700
+ condition: "ignore",
2701
+ declaration: "parens-new-line",
2702
+ logical: "ignore",
2703
+ prop: "ignore",
2704
+ return: "parens-new-line"
2705
+ }],
2706
+ "@stylistic/no-multi-spaces": "error"
2707
+ }
2708
+ },
2709
+ ...(assert.ok(!Array.isArray(reactHooksPlugin.configs?.["recommended-latest"])), reactHooksPlugin.configs?.["recommended-latest"].rules),
2710
+ "react-refresh/only-export-components": ["error", {
2711
+ allowCompoundComponents: true,
2712
+ allowConstantExport: true
2713
+ }],
2714
+ ...jsxA11yPlugin && {
2715
+ "jsx-a11y/alt-text": ["warn", {
2716
+ elements: ["img"],
2717
+ img: ["Image"]
2718
+ }],
2719
+ "jsx-a11y/aria-props": "warn",
2720
+ "jsx-a11y/aria-proptypes": "warn",
2721
+ "jsx-a11y/aria-role": "warn",
2722
+ "jsx-a11y/aria-unsupported-elements": "warn",
2723
+ "jsx-a11y/iframe-has-title": "warn",
2724
+ "jsx-a11y/no-access-key": "warn",
2725
+ "jsx-a11y/no-static-element-interactions": "warn",
2726
+ "jsx-a11y/role-has-required-aria-props": "warn",
2727
+ "jsx-a11y/role-supports-aria-props": "warn",
2728
+ "jsx-a11y/tabindex-no-positive": "warn",
2729
+ "jsx-a11y/anchor-ambiguous-text": "off",
2730
+ "jsx-a11y/interactive-supports-focus": ["error", { tabbable: [
2731
+ "button",
2732
+ "checkbox",
2733
+ "link",
2734
+ "progressbar",
2735
+ "searchbox",
2736
+ "slider",
2737
+ "spinbutton",
2738
+ "switch",
2739
+ "textbox"
2740
+ ] }],
2741
+ "jsx-a11y/label-has-for": "off",
2742
+ "jsx-a11y/no-noninteractive-element-interactions": ["error", {
2743
+ body: ["onError", "onLoad"],
2744
+ iframe: ["onError", "onLoad"],
2745
+ img: ["onError", "onLoad"]
2746
+ }],
2747
+ ...overridesA11y
2748
+ },
2749
+ ...overrides
2750
+ }
2751
+ },
2752
+ ...isTypeAware ? [{
2753
+ name: "moso/preact/typescript/type-aware-rules",
2754
+ files: filesTypeAware,
2755
+ ignores: ignoresTypeAware,
2756
+ rules: {
2757
+ ...lessOpinionated ? { ...(assert.ok(!Array.isArray(reactPlugin.configs["recommended-type-checked"])), reactPlugin.configs["recommended-type-checked"].rules) } : { ...(assert.ok(!Array.isArray(reactPlugin.configs["strict-type-checked"])), reactPlugin.configs["strict-type-checked"].rules) },
2758
+ ...overridesTypeAware
2759
+ }
2760
+ }] : []
2761
+ ];
2762
+ };
2763
+ // src/configs/promise.ts
2675
2764
  const promise = async (options) => {
2676
2765
  const { lessOpinionated, overrides, typescript } = options;
2677
2766
  const [promisePlugin] = await loadPackages(["eslint-plugin-promise"]);
@@ -2704,8 +2793,7 @@ const promise = async (options) => {
2704
2793
  }
2705
2794
  }];
2706
2795
  };
2707
- //#endregion
2708
- //#region src/configs/react.ts
2796
+ // src/configs/react.ts
2709
2797
  const ReactRefreshAllowConstantExportPackages = ["vite"];
2710
2798
  const ReactRouterPackages = [
2711
2799
  "@react-router/dev",
@@ -2758,7 +2846,6 @@ const react = async (options) => {
2758
2846
  },
2759
2847
  sourceType: "module"
2760
2848
  },
2761
- settings: { "@eslint-react": { version: "detect" } },
2762
2849
  rules: {
2763
2850
  ...lessOpinionated ? {
2764
2851
  ...(assert.ok(!Array.isArray(reactPlugin.configs.recommended)), reactPlugin.configs.recommended.rules),
@@ -2922,8 +3009,7 @@ const react = async (options) => {
2922
3009
  }] : []
2923
3010
  ];
2924
3011
  };
2925
- //#endregion
2926
- //#region src/configs/regexp.ts
3012
+ // src/configs/regexp.ts
2927
3013
  const regexp = async (options) => {
2928
3014
  const { overrides } = options;
2929
3015
  const [regexpPlugin] = await loadPackages(["eslint-plugin-regexp"]);
@@ -2941,8 +3027,7 @@ const regexp = async (options) => {
2941
3027
  }
2942
3028
  }];
2943
3029
  };
2944
- //#endregion
2945
- //#region src/configs/security.ts
3030
+ // src/configs/security.ts
2946
3031
  const security = async (options) => {
2947
3032
  const { overrides, severity } = options;
2948
3033
  const [securityPlugin] = await loadPackages(["eslint-plugin-security"]);
@@ -2963,8 +3048,7 @@ const security = async (options) => {
2963
3048
  }
2964
3049
  }];
2965
3050
  };
2966
- //#endregion
2967
- //#region src/configs/sort.ts
3051
+ // src/configs/sort.ts
2968
3052
  /**
2969
3053
  * Sort package.json
2970
3054
  *
@@ -3201,8 +3285,7 @@ const sortTsconfig = (options = {}) => {
3201
3285
  }
3202
3286
  }];
3203
3287
  };
3204
- //#endregion
3205
- //#region src/configs/stylistic.ts
3288
+ // src/configs/stylistic.ts
3206
3289
  const StylisticConfigDefaults = {
3207
3290
  braceStyle: "1tbs",
3208
3291
  experimental: false,
@@ -3453,8 +3536,85 @@ const stylistic = async (options) => {
3453
3536
  }
3454
3537
  }];
3455
3538
  };
3456
- //#endregion
3457
- //#region src/configs/tailwind.ts
3539
+ // src/configs/svelte.ts
3540
+ const svelte = async (options) => {
3541
+ const { files, lessOpinionated, parserOptions, overrides, stylistic, typescript } = options;
3542
+ const { indent = 4 } = typeof stylistic === "boolean" ? {} : stylistic;
3543
+ const stylisticEnabled = stylistic !== false;
3544
+ const [svelteParser, sveltePlugin] = await loadPackages(["svelte-eslint-parser", "eslint-plugin-svelte"]);
3545
+ const [typescriptParser] = typescript ? await loadPackages(["@typescript-eslint/parser"]) : [void 0];
3546
+ return [
3547
+ {
3548
+ name: "moso/svelte/setup",
3549
+ plugins: { "svelte": memoize(sveltePlugin, "eslint-plugin-svelte") }
3550
+ },
3551
+ {
3552
+ name: "moso/svelte/rules",
3553
+ files,
3554
+ languageOptions: {
3555
+ parser: memoize(svelteParser, "svelte-eslint-parser"),
3556
+ parserOptions: {
3557
+ extraFileExtensions: [".svelte"],
3558
+ parser: typescript ? typescriptParser : void 0,
3559
+ ...typescript && parserOptions
3560
+ }
3561
+ },
3562
+ processor: sveltePlugin.processors[".svelte"],
3563
+ rules: {
3564
+ "functional/no-let": "off",
3565
+ "import-lite/no-mutable-exports": "off",
3566
+ "no-undef": "off",
3567
+ "no-unused-vars": typescript ? "off" : ["error", {
3568
+ args: "none",
3569
+ caughtErrors: "none",
3570
+ ignoreRestSiblings: true,
3571
+ vars: "all",
3572
+ varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
3573
+ }],
3574
+ "unused-imports/no-unused-vars": ["error", {
3575
+ args: "after-used",
3576
+ argsIgnorePattern: "^_",
3577
+ ignoreRestSiblings: true,
3578
+ vars: "all",
3579
+ varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
3580
+ }],
3581
+ "prefer-const": "off",
3582
+ "svelte/prefer-const": ["error", {
3583
+ destructuring: "all",
3584
+ ignoreReadBeforeAssign: true
3585
+ }],
3586
+ ...flattenRules(sveltePlugin.configs.recommended),
3587
+ ...stylisticEnabled && {
3588
+ "@stylistic/indent": "off",
3589
+ "@stylistic/no-trailing-spaces": "off",
3590
+ "svelte/derived-has-same-inputs-outputs": "error",
3591
+ "svelte/html-closing-bracket-spacing": "error",
3592
+ "svelte/html-quotes": ["error", { prefer: "double" }],
3593
+ "svelte/indent": ["error", {
3594
+ alignAttributesVertically: true,
3595
+ indent
3596
+ }],
3597
+ "svelte/mustache-spacing": "error",
3598
+ "svelte/no-spaces-around-equal-signs-in-attribute": "error",
3599
+ "svelte/no-trailing-spaces": "error",
3600
+ "svelte/spaced-html-comment": "error"
3601
+ },
3602
+ ...!lessOpinionated && {
3603
+ "svelte/block-lang": ["error", { script: typescript ? "ts" : null }],
3604
+ "svelte/button-has-type": "error",
3605
+ "svelte/no-at-const-tags": "error",
3606
+ "svelte/no-ignored-unsubscribe": "error"
3607
+ },
3608
+ ...overrides
3609
+ }
3610
+ },
3611
+ {
3612
+ name: "moso/svelte/ignores",
3613
+ ignores: ["!**/src/lib"]
3614
+ }
3615
+ ];
3616
+ };
3617
+ // src/configs/tailwind.ts
3458
3618
  const tailwind = async (options) => {
3459
3619
  const { config, entryPoint, overrides, stylistic, version } = options;
3460
3620
  const [tailwindPlugin] = await loadPackages(["eslint-plugin-better-tailwindcss"]);
@@ -3496,8 +3656,7 @@ const tailwind = async (options) => {
3496
3656
  }
3497
3657
  }];
3498
3658
  };
3499
- //#endregion
3500
- //#region src/configs/test.ts
3659
+ // src/configs/test.ts
3501
3660
  const test = async (options) => {
3502
3661
  const { functionalEnforcement, isInEditor, files, overrides } = options;
3503
3662
  const [functionalPlugin] = functionalEnforcement === "none" ? [void 0] : await loadPackages(["eslint-plugin-functional"]);
@@ -3530,8 +3689,7 @@ const test = async (options) => {
3530
3689
  }
3531
3690
  }];
3532
3691
  };
3533
- //#endregion
3534
- //#region src/configs/toml.ts
3692
+ // src/configs/toml.ts
3535
3693
  const toml = async (options) => {
3536
3694
  const { files, overrides, stylistic } = options;
3537
3695
  const { indent = 2 } = typeof stylistic === "boolean" ? {} : stylistic;
@@ -3577,14 +3735,115 @@ const toml = async (options) => {
3577
3735
  }
3578
3736
  }];
3579
3737
  };
3580
- //#endregion
3581
- //#region src/configs/typescript.ts
3738
+ // src/configs/typescript.ts
3582
3739
  const typescript = async (options) => {
3583
- const { componentExts, disableTypeAwareRules, erasableOnly, files, filesTypeAware, functionalEnforcement, lessOpinionated, mode, overrides, overridesTypeAware, parserOptions, projectRoot, stylistic, unsafe } = options;
3740
+ const { componentExts, disableTypeAwareRules, erasableOnly, files, filesTypeAware, functionalEnforcement, hasSvelte, lessOpinionated, mode, overrides, overridesTypeAware, parserOptions, projectRoot, stylistic, unsafe } = options;
3584
3741
  const [tsEslintPlugin, tsEslintParser] = await loadPackages(["@typescript-eslint/eslint-plugin", "@typescript-eslint/parser"]);
3585
- const [erasableSyntaxPlugin] = erasableOnly !== false && !lessOpinionated ? await loadPackages(["eslint-plugin-erasable-syntax-only"]) : [void 0];
3742
+ const [erasableSyntaxPlugin] = erasableOnly === false || lessOpinionated ? [void 0] : await loadPackages(["eslint-plugin-erasable-syntax-only"]);
3586
3743
  const isTypeAware = typeof projectRoot === "string" && parserOptions.projectService !== false;
3587
3744
  const stylisticEnabled = stylistic !== false;
3745
+ const namingConventionRules = { "@typescript-eslint/naming-convention": [
3746
+ "error",
3747
+ {
3748
+ selector: "default",
3749
+ format: ["camelCase", "PascalCase"],
3750
+ leadingUnderscore: "allow",
3751
+ trailingUnderscore: "forbid"
3752
+ },
3753
+ {
3754
+ selector: "variableLike",
3755
+ format: ["camelCase", "PascalCase"],
3756
+ leadingUnderscore: "allow",
3757
+ trailingUnderscore: "forbid"
3758
+ },
3759
+ {
3760
+ selector: "variable",
3761
+ filter: {
3762
+ regex: "^[A-Z0-9_]+$",
3763
+ match: true
3764
+ },
3765
+ format: ["UPPER_CASE"],
3766
+ modifiers: ["const"],
3767
+ leadingUnderscore: "forbid",
3768
+ trailingUnderscore: "forbid"
3769
+ },
3770
+ {
3771
+ selector: "variable",
3772
+ format: [
3773
+ "camelCase",
3774
+ "PascalCase",
3775
+ "UPPER_CASE"
3776
+ ],
3777
+ modifiers: ["const"],
3778
+ leadingUnderscore: "allow",
3779
+ trailingUnderscore: "forbid"
3780
+ },
3781
+ {
3782
+ selector: "variable",
3783
+ format: null,
3784
+ modifiers: ["destructured"]
3785
+ },
3786
+ {
3787
+ selector: [
3788
+ "autoAccessor",
3789
+ "parameterProperty",
3790
+ "property"
3791
+ ],
3792
+ filter: {
3793
+ regex: "^[A-Z0-9_]+$",
3794
+ match: true
3795
+ },
3796
+ format: ["UPPER_CASE"],
3797
+ leadingUnderscore: "forbid",
3798
+ trailingUnderscore: "forbid"
3799
+ },
3800
+ {
3801
+ selector: [
3802
+ "autoAccessor",
3803
+ "parameterProperty",
3804
+ "property"
3805
+ ],
3806
+ format: [
3807
+ "camelCase",
3808
+ "PascalCase",
3809
+ "UPPER_CASE"
3810
+ ],
3811
+ modifiers: ["readonly"],
3812
+ leadingUnderscore: "allow",
3813
+ trailingUnderscore: "forbid"
3814
+ },
3815
+ {
3816
+ selector: [
3817
+ "accessor",
3818
+ "classMethod",
3819
+ "typeMethod",
3820
+ "typeProperty"
3821
+ ],
3822
+ format: [
3823
+ "camelCase",
3824
+ "PascalCase",
3825
+ "UPPER_CASE"
3826
+ ],
3827
+ leadingUnderscore: "allow",
3828
+ trailingUnderscore: "forbid"
3829
+ },
3830
+ {
3831
+ selector: "enumMember",
3832
+ format: ["PascalCase", "UPPER_CASE"],
3833
+ leadingUnderscore: "allow",
3834
+ trailingUnderscore: "forbid"
3835
+ },
3836
+ {
3837
+ selector: "typeLike",
3838
+ format: ["PascalCase"],
3839
+ leadingUnderscore: "allow",
3840
+ trailingUnderscore: "forbid"
3841
+ },
3842
+ {
3843
+ selector: ["objectLiteralProperty", "objectLiteralMethod"],
3844
+ format: null
3845
+ }
3846
+ ] };
3588
3847
  return [
3589
3848
  {
3590
3849
  name: "moso/typescript/setup",
@@ -3911,108 +4170,7 @@ const typescript = async (options) => {
3911
4170
  "require-await": "off",
3912
4171
  "@typescript-eslint/consistent-return": "error",
3913
4172
  "@typescript-eslint/consistent-type-exports": "error",
3914
- ...functionalEnforcement === "none" && { "@typescript-eslint/naming-convention": [
3915
- "error",
3916
- {
3917
- selector: "default",
3918
- format: ["camelCase", "PascalCase"],
3919
- leadingUnderscore: "allow",
3920
- trailingUnderscore: "forbid"
3921
- },
3922
- {
3923
- selector: "variableLike",
3924
- format: ["camelCase", "PascalCase"],
3925
- leadingUnderscore: "allow",
3926
- trailingUnderscore: "forbid"
3927
- },
3928
- {
3929
- selector: "variable",
3930
- filter: {
3931
- regex: "^[A-Z0-9_]+$",
3932
- match: true
3933
- },
3934
- format: ["UPPER_CASE"],
3935
- modifiers: ["const"],
3936
- leadingUnderscore: "forbid",
3937
- trailingUnderscore: "forbid"
3938
- },
3939
- {
3940
- selector: "variable",
3941
- format: [
3942
- "camelCase",
3943
- "PascalCase",
3944
- "UPPER_CASE"
3945
- ],
3946
- modifiers: ["const"],
3947
- leadingUnderscore: "allow",
3948
- trailingUnderscore: "forbid"
3949
- },
3950
- {
3951
- selector: "variable",
3952
- format: null,
3953
- modifiers: ["destructured"]
3954
- },
3955
- {
3956
- selector: [
3957
- "autoAccessor",
3958
- "parameterProperty",
3959
- "property"
3960
- ],
3961
- filter: {
3962
- regex: "^[A-Z0-9_]+$",
3963
- match: true
3964
- },
3965
- format: ["UPPER_CASE"],
3966
- leadingUnderscore: "forbid",
3967
- trailingUnderscore: "forbid"
3968
- },
3969
- {
3970
- selector: [
3971
- "autoAccessor",
3972
- "parameterProperty",
3973
- "property"
3974
- ],
3975
- format: [
3976
- "camelCase",
3977
- "PascalCase",
3978
- "UPPER_CASE"
3979
- ],
3980
- modifiers: ["readonly"],
3981
- leadingUnderscore: "allow",
3982
- trailingUnderscore: "forbid"
3983
- },
3984
- {
3985
- selector: [
3986
- "accessor",
3987
- "classMethod",
3988
- "typeMethod",
3989
- "typeProperty"
3990
- ],
3991
- format: [
3992
- "camelCase",
3993
- "PascalCase",
3994
- "UPPER_CASE"
3995
- ],
3996
- leadingUnderscore: "allow",
3997
- trailingUnderscore: "forbid"
3998
- },
3999
- {
4000
- selector: "enumMember",
4001
- format: ["PascalCase", "UPPER_CASE"],
4002
- leadingUnderscore: "allow",
4003
- trailingUnderscore: "forbid"
4004
- },
4005
- {
4006
- selector: "typeLike",
4007
- format: ["PascalCase"],
4008
- leadingUnderscore: "allow",
4009
- trailingUnderscore: "forbid"
4010
- },
4011
- {
4012
- selector: ["objectLiteralProperty", "objectLiteralMethod"],
4013
- format: null
4014
- }
4015
- ] },
4173
+ ...functionalEnforcement === "none" && { ...namingConventionRules },
4016
4174
  "@typescript-eslint/no-unnecessary-qualifier": "error",
4017
4175
  "@typescript-eslint/no-unnecessary-type-conversion": "error",
4018
4176
  "@typescript-eslint/prefer-promise-reject-errors": "error",
@@ -4105,6 +4263,11 @@ const typescript = async (options) => {
4105
4263
  name: "moso/typescript/application-mode",
4106
4264
  rules: { "@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }] }
4107
4265
  }] : [],
4266
+ ...hasSvelte && functionalEnforcement !== "none" && mode !== "library" ? [{
4267
+ name: "moso/typescript/svelte-overrides",
4268
+ files: [GLOB_SVELTE_MODULE],
4269
+ rules: { ...namingConventionRules }
4270
+ }] : [],
4108
4271
  {
4109
4272
  name: "moso/typescript/dts-overrides",
4110
4273
  files: [GLOB_DTS],
@@ -4136,8 +4299,7 @@ const typescript = async (options) => {
4136
4299
  }
4137
4300
  ];
4138
4301
  };
4139
- //#endregion
4140
- //#region src/configs/unicorn.ts
4302
+ // src/configs/unicorn.ts
4141
4303
  const DOMRules = [
4142
4304
  "unicorn/better-dom-traversing",
4143
4305
  "unicorn/dom-node-dataset",
@@ -4275,8 +4437,7 @@ const unicorn = async (options) => {
4275
4437
  }
4276
4438
  }];
4277
4439
  };
4278
- //#endregion
4279
- //#region src/configs/vue.ts
4440
+ // src/configs/vue.ts
4280
4441
  const NuxtPackages = ["nuxt"];
4281
4442
  const vue = async (options) => {
4282
4443
  const { a11y, files, overrides, overridesA11y, parserOptions, stylistic, typescript } = options;
@@ -4507,8 +4668,7 @@ const vue = async (options) => {
4507
4668
  ] : []
4508
4669
  ];
4509
4670
  };
4510
- //#endregion
4511
- //#region src/configs/yaml.ts
4671
+ // src/configs/yaml.ts
4512
4672
  const yaml = async (options) => {
4513
4673
  const { files, overrides, stylistic } = options;
4514
4674
  const { quotes = "single" } = typeof stylistic === "boolean" ? {} : stylistic;
@@ -4550,8 +4710,7 @@ const yaml = async (options) => {
4550
4710
  }
4551
4711
  }];
4552
4712
  };
4553
- //#endregion
4554
- //#region src/factory.ts
4713
+ // src/factory.ts
4555
4714
  const AstroPackages = [
4556
4715
  "astro",
4557
4716
  "@astrojs/preact",
@@ -4559,6 +4718,7 @@ const AstroPackages = [
4559
4718
  "@astrojs/vue"
4560
4719
  ];
4561
4720
  const NextJSPackages = ["next"];
4721
+ const PreactPackages = ["@astrojs/preact", "preact"];
4562
4722
  const ReactPackages = [
4563
4723
  "@astrojs/react",
4564
4724
  "gatsby",
@@ -4567,6 +4727,7 @@ const ReactPackages = [
4567
4727
  "react",
4568
4728
  "remix"
4569
4729
  ];
4730
+ const SveltePackages = ["@sveltejs/kit", "svelte"];
4570
4731
  const VuePackages = [
4571
4732
  "@astrojs/vue",
4572
4733
  "nuxt",
@@ -4603,7 +4764,9 @@ async function moso(options = {}, ...userConfigs) {
4603
4764
  const typescriptOptions = !typescriptUnsupported && typescriptRequested;
4604
4765
  const astroOptions = options.astro ?? anyPackageExists(AstroPackages);
4605
4766
  const nextjsOptions = options.nextjs ?? anyPackageExists(NextJSPackages);
4767
+ const preactOptions = options.preact ?? anyPackageExists(PreactPackages);
4606
4768
  const reactOptions = options.react ?? anyPackageExists(ReactPackages);
4769
+ const svelteOptions = options.svelte ?? anyPackageExists(SveltePackages);
4607
4770
  const tailwindOptions = options.tailwind ?? packageExists("tailwindcss");
4608
4771
  const vueOptions = options.vue ?? anyPackageExists(VuePackages);
4609
4772
  const componentExts = vueOptions === false ? [...componentExtsOption] : [.../* @__PURE__ */ new Set([...componentExtsOption, "vue"])];
@@ -4611,7 +4774,7 @@ async function moso(options = {}, ...userConfigs) {
4611
4774
  const e18eOptions = options.e18e !== false && (typeof options.e18e === "object" ? options.e18e : (options.e18e === true || options.lessOpinionated !== true) && {});
4612
4775
  const functionalEnforcement = typeof options.functional === "string" ? options.functional : typeof options.functional === "object" ? options.functional.functionalEnforcement ?? "lite" : options.functional ? "recommended" : options.functional === false || options.lessOpinionated === true ? "none" : "lite";
4613
4776
  const hasTypeScript = Boolean(typescriptOptions);
4614
- const hasDOM = options.mode !== "library" || Boolean(astroOptions) || Boolean(nextjsOptions) || Boolean(reactOptions) || Boolean(vueOptions);
4777
+ const hasDOM = options.mode !== "library" || Boolean(astroOptions) || Boolean(nextjsOptions) || Boolean(preactOptions) || Boolean(reactOptions) || Boolean(svelteOptions) || Boolean(vueOptions);
4615
4778
  const ignoreOptions = typeof options.ignores === "object" ? options.ignores : {};
4616
4779
  const modeOptions = typeof options.mode === "string" ? options.mode : "none";
4617
4780
  const perfectionistOptions = typeof options.perfectionist === "boolean" ? options.perfectionist : options.lessOpinionated !== true;
@@ -4684,7 +4847,7 @@ async function moso(options = {}, ...userConfigs) {
4684
4847
  }));
4685
4848
  if (options.node !== false) mut_configs.push(node({
4686
4849
  files: [GLOB_SRC],
4687
- hasReact: Boolean(reactOptions),
4850
+ hasReact: Boolean(reactOptions) || Boolean(preactOptions),
4688
4851
  lessOpinionated: options.lessOpinionated,
4689
4852
  overrides: getOverrides(options, "node"),
4690
4853
  typescript: hasTypeScript,
@@ -4776,6 +4939,18 @@ async function moso(options = {}, ...userConfigs) {
4776
4939
  ...resolveSubOptions(options, "nextjs")
4777
4940
  }));
4778
4941
  if (perfectionistOptions) mut_configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
4942
+ if (preactOptions !== false) mut_configs.push(preact({
4943
+ ...typescriptConfigOptions,
4944
+ files: [GLOB_SRC],
4945
+ filesTypeAware: defaultFilesTypesAware,
4946
+ ignoresTypeAware: [GLOB_ASTRO_TS, `${GLOB_MARKDOWN}/**`],
4947
+ lessOpinionated: options.lessOpinionated,
4948
+ projectRoot: projectRootOptions,
4949
+ overrides: getOverrides(options, "preact"),
4950
+ stylistic: stylisticOptions,
4951
+ typescript: hasTypeScript,
4952
+ ...resolveSubOptions(options, "preact")
4953
+ }));
4779
4954
  if (reactOptions !== false) mut_configs.push(react({
4780
4955
  ...typescriptConfigOptions,
4781
4956
  files: [GLOB_SRC],
@@ -4805,6 +4980,7 @@ async function moso(options = {}, ...userConfigs) {
4805
4980
  ...typescriptConfigOptions,
4806
4981
  componentExts,
4807
4982
  files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
4983
+ hasSvelte: Boolean(svelteOptions),
4808
4984
  lessOpinionated: options.lessOpinionated,
4809
4985
  mode: modeOptions,
4810
4986
  overrides: getOverrides(options, "typescript"),
@@ -4812,6 +4988,15 @@ async function moso(options = {}, ...userConfigs) {
4812
4988
  stylistic: stylisticOptions,
4813
4989
  unsafe: typescriptUnsafe
4814
4990
  }));
4991
+ if (svelteOptions !== false) mut_configs.push(svelte({
4992
+ ...typescriptConfigOptions,
4993
+ files: [GLOB_SVELTE],
4994
+ lessOpinionated: options.lessOpinionated,
4995
+ overrides: getOverrides(options, "svelte"),
4996
+ stylistic: stylisticOptions,
4997
+ typescript: hasTypeScript,
4998
+ ...resolveSubOptions(options, "svelte")
4999
+ }));
4815
5000
  if (vueOptions !== false) mut_configs.push(vue({
4816
5001
  ...typescriptConfigOptions,
4817
5002
  files: [GLOB_VUE],
@@ -4848,12 +5033,12 @@ async function moso(options = {}, ...userConfigs) {
4848
5033
  if (isInEditor) mut_composer = mut_composer.disableRulesFix([
4849
5034
  "unused-imports/no-unused-imports",
4850
5035
  "no-only-tests/no-only-tests",
4851
- "prefer-const"
5036
+ "prefer-const",
5037
+ "svelte/prefer-const"
4852
5038
  ], { builtinRules: async () => import("eslint/use-at-your-own-risk").then((r) => r.builtinRules) });
4853
5039
  return mut_composer.toConfigs();
4854
5040
  }
4855
- //#endregion
4856
- //#region src/presets.ts
5041
+ // src/presets.ts
4857
5042
  const full = {
4858
5043
  astro: { a11y: true },
4859
5044
  baseline: true,
@@ -4868,6 +5053,7 @@ const full = {
4868
5053
  nextjs: true,
4869
5054
  node: true,
4870
5055
  perfectionist: true,
5056
+ preact: { a11y: true },
4871
5057
  promise: true,
4872
5058
  react: {
4873
5059
  a11y: true,
@@ -4876,6 +5062,7 @@ const full = {
4876
5062
  regexp: true,
4877
5063
  security: true,
4878
5064
  stylistic: true,
5065
+ svelte: true,
4879
5066
  tailwind: {
4880
5067
  entryPoint: "src/styles/app.css",
4881
5068
  version: 4
@@ -4905,11 +5092,13 @@ const off = {
4905
5092
  nextjs: false,
4906
5093
  node: false,
4907
5094
  perfectionist: false,
5095
+ preact: false,
4908
5096
  promise: false,
4909
5097
  react: false,
4910
5098
  regexp: false,
4911
5099
  security: false,
4912
5100
  stylistic: false,
5101
+ svelte: false,
4913
5102
  tailwind: false,
4914
5103
  test: false,
4915
5104
  toml: false,
@@ -4918,5 +5107,4 @@ const off = {
4918
5107
  vue: false,
4919
5108
  yaml: false
4920
5109
  };
4921
- //#endregion
4922
- export { GLOB_AI, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CJS, GLOB_CSS_IN_JS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MJS, GLOB_NODE_MODULES, GLOB_ROOT_DTS, GLOB_ROOT_JS, GLOB_ROOT_JSX, GLOB_ROOT_TS, GLOB_ROOT_TSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPINGS, GLOB_VUE, GLOB_YAML, StylisticConfigDefaults, astro, baseline, checkFilePath, combine, comments, moso as default, moso, disables, e18e, flattenRules, full, functional, getOverrides, globalIgnores, ignores, imports, interopDefault, isInEditorEnv, javascript, jsdoc, jsonc, jsx, memoize, nextjs, node, off, perfectionist, promise, react, regexp, resolveSubOptions, security, sortPackageJson, sortTsconfig, stylistic, tailwind, test, toml, typescript, unicorn, vue, vueInlineElements, yaml };
5110
+ export { GLOB_AI, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CJS, GLOB_CSS_IN_JS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MJS, GLOB_NODE_MODULES, GLOB_ROOT_DTS, GLOB_ROOT_JS, GLOB_ROOT_JSX, GLOB_ROOT_TS, GLOB_ROOT_TSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVELTE_MODULE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_TYPINGS, GLOB_VUE, GLOB_YAML, StylisticConfigDefaults, astro, baseline, checkFilePath, combine, comments, moso as default, moso, disables, e18e, flattenRules, full, functional, getOverrides, globalIgnores, ignores, imports, interopDefault, isInEditorEnv, javascript, jsdoc, jsonc, jsx, memoize, nextjs, node, off, perfectionist, preact, promise, react, regexp, resolveSubOptions, security, sortPackageJson, sortTsconfig, stylistic, svelte, tailwind, test, toml, typescript, unicorn, vue, vueInlineElements, yaml };