@fabdeh/eslint-config 0.9.0-beta.3 → 0.9.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.
Files changed (4) hide show
  1. package/README.md +2 -1
  2. package/dist/index.d.mts +2158 -2083
  3. package/dist/index.mjs +128 -145
  4. package/package.json +20 -21
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import tseslint from "typescript-eslint";
2
2
  import { statSync } from "node:fs";
3
- import { readFile } from "node:fs/promises";
4
- import { dirname, join, resolve } from "node:path";
3
+ import { dirname, join } from "node:path";
5
4
  import process from "node:process";
6
5
  import { isPackageExists } from "local-pkg";
7
6
  import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
@@ -243,22 +242,6 @@ async function ensurePackages(packages) {
243
242
  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 }));
244
243
  }
245
244
  /**
246
- * Search for the nearest package.json file and return the `name` property value.
247
- *
248
- * @param directoryPath - The folder to start from (default to current working directory).
249
- * @returns The name of the nearest package.json
250
- */
251
- async function findNearestPackageJsonName(directoryPath = resolve()) {
252
- try {
253
- const packageJsonPath = join(directoryPath, "package.json");
254
- return JSON.parse(await readFile(packageJsonPath, "utf8")).name;
255
- } catch {
256
- const parentDir = dirname(directoryPath);
257
- if (directoryPath === parentDir) throw new Error("No package.json file found.");
258
- return findNearestPackageJsonName(parentDir);
259
- }
260
- }
261
- /**
262
245
  * Returns the object representation of the configuration or an empty object if it is a boolean.
263
246
  *
264
247
  * @param options - The {@link CreateConfigOptions} object to extract the sub-options from.
@@ -474,7 +457,7 @@ function mergePrettierOptions(options, overrides = {}) {
474
457
  * @param hasAngularTemplateParser - Optional argument which indicates whether angular rules already registered the template parser or not.
475
458
  * @returns A promise that resolves to a `TypedConfigArray` containing the configured formatters.
476
459
  */
477
- async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplateParser = false) {
460
+ async function formatters(options = {}, stylistic = {}, hasAngularTemplateParser = false) {
478
461
  if (options === true) {
479
462
  const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
480
463
  options = {
@@ -494,7 +477,7 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
494
477
  ]);
495
478
  const { indent, quotes, semi } = {
496
479
  ...STYLISTIC_CONFIG_DEFAULT,
497
- ...stylistic$1
480
+ ...stylistic
498
481
  };
499
482
  const prettierOptions = {
500
483
  endOfLine: "auto",
@@ -513,11 +496,11 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
513
496
  xmlWhitespaceSensitivity: "ignore"
514
497
  };
515
498
  const formatPlugin = await interopDefault(import("eslint-plugin-format"));
516
- const configs$1 = [{
499
+ const configs = [{
517
500
  name: "fabdeh/formatter/setup",
518
501
  plugins: { format: formatPlugin }
519
502
  }];
520
- if (options.css) configs$1.push({
503
+ if (options.css) configs.push({
521
504
  name: "fabdeh/formatter/css",
522
505
  languageOptions: { parser: formatPlugin.parserPlain },
523
506
  files: [GLOB_CSS, GLOB_POSTCSS],
@@ -533,13 +516,13 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
533
516
  files: [GLOB_LESS],
534
517
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
535
518
  });
536
- if (options.html) configs$1.push({
519
+ if (options.html) configs.push({
537
520
  name: "fabdeh/formatter/html",
538
521
  ...hasAngularTemplateParser ? {} : { languageOptions: { parser: formatPlugin.parserPlain } },
539
522
  files: [GLOB_HTML],
540
523
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
541
524
  });
542
- if (options.xml) configs$1.push({
525
+ if (options.xml) configs.push({
543
526
  name: "fabdeh/formatter/xml",
544
527
  languageOptions: { parser: formatPlugin.parserPlain },
545
528
  files: [GLOB_XML],
@@ -551,7 +534,7 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
551
534
  plugins: ["@prettier/plugin-xml"]
552
535
  })] }
553
536
  });
554
- if (options.svg) configs$1.push({
537
+ if (options.svg) configs.push({
555
538
  name: "fabdeh/formatter/svg",
556
539
  languageOptions: { parser: formatPlugin.parserPlain },
557
540
  files: [GLOB_SVG],
@@ -565,7 +548,7 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
565
548
  });
566
549
  if (options.markdown) {
567
550
  const GLOB_SLIDEV = options.slidev ? options.slidev === true ? ["**/.slides.md"] : options.slidev.files : [];
568
- configs$1.push({
551
+ configs.push({
569
552
  name: "fabdeh/formatter/markdown",
570
553
  languageOptions: { parser: formatPlugin.parserPlain },
571
554
  files: [GLOB_MARKDOWN],
@@ -575,7 +558,7 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
575
558
  embeddedLanguageFormatting: "off"
576
559
  })] }
577
560
  });
578
- if (options.slidev) configs$1.push({
561
+ if (options.slidev) configs.push({
579
562
  name: "fabdeh/formatter/slidev",
580
563
  languageOptions: { parser: formatPlugin.parserPlain },
581
564
  files: GLOB_SLIDEV,
@@ -586,13 +569,13 @@ async function formatters(options = {}, stylistic$1 = {}, hasAngularTemplatePars
586
569
  })] }
587
570
  });
588
571
  }
589
- if (options.graphql) configs$1.push({
572
+ if (options.graphql) configs.push({
590
573
  name: "fabdeh/formatter/graphql",
591
574
  languageOptions: { parser: formatPlugin.parserPlain },
592
575
  files: [GLOB_GRAPHQL],
593
576
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
594
577
  });
595
- return tseslint.config(configs$1);
578
+ return tseslint.config(configs);
596
579
  }
597
580
 
598
581
  //#endregion
@@ -621,7 +604,7 @@ function ignores(userIgnores = [], fromFactory) {
621
604
  * @returns A TypedConfigArray object with the specified import rules.
622
605
  */
623
606
  function imports(options = {}) {
624
- const { stylistic: stylistic$1 = true } = options;
607
+ const { stylistic = true } = options;
625
608
  return tseslint.config({
626
609
  name: "fabdeh/imports/rules",
627
610
  files: [GLOB_SRC],
@@ -644,7 +627,7 @@ function imports(options = {}) {
644
627
  "import-x/no-self-import": "error",
645
628
  "import-x/no-useless-path-segments": "error",
646
629
  "import-x/no-webpack-loader-syntax": "error",
647
- ...stylistic$1 ? { "import-x/newline-after-import": ["error", {
630
+ ...stylistic ? { "import-x/newline-after-import": ["error", {
648
631
  considerComments: true,
649
632
  count: 1
650
633
  }] } : {}
@@ -831,7 +814,7 @@ function javascript(options = {}) {
831
814
  * @param mode - To get on JS or TS rules or both.
832
815
  * @returns The JSDoc eslint rules configured with the requested level.
833
816
  */
834
- function getJsDocRules(level, stylistic$1, mode) {
817
+ function getJsDocRules(level, stylistic, mode) {
835
818
  return {
836
819
  ...mode === "both" || mode === "jsOnly" ? {
837
820
  "jsdoc/check-access": level,
@@ -860,7 +843,7 @@ function getJsDocRules(level, stylistic$1, mode) {
860
843
  "jsdoc/require-yields": level,
861
844
  "jsdoc/require-yields-check": level,
862
845
  "jsdoc/valid-types": level,
863
- ...stylistic$1 ? {
846
+ ...stylistic ? {
864
847
  "jsdoc/check-alignment": level,
865
848
  "jsdoc/multiline-blocks": level,
866
849
  "jsdoc/no-multi-asterisks": level,
@@ -894,16 +877,16 @@ function getJsDocRules(level, stylistic$1, mode) {
894
877
  * @returns A configuration array for JSDoc rules.
895
878
  */
896
879
  function jsdoc(options = {}) {
897
- const { stylistic: stylistic$1 = true } = options;
880
+ const { stylistic = true } = options;
898
881
  return tseslint.config({
899
882
  name: "fabdeh/jsdoc/rules",
900
883
  files: [GLOB_SRC],
901
884
  plugins: { jsdoc: jsdocPlugin },
902
- rules: getJsDocRules("warn", !!stylistic$1, "jsOnly")
885
+ rules: getJsDocRules("warn", !!stylistic, "jsOnly")
903
886
  }, {
904
887
  name: "fabdeh/jsdoc/ts-only/rules",
905
888
  files: [GLOB_TS],
906
- rules: getJsDocRules("warn", !!stylistic$1, "tsOnly")
889
+ rules: getJsDocRules("warn", !!stylistic, "tsOnly")
907
890
  });
908
891
  }
909
892
 
@@ -932,8 +915,8 @@ async function jsonc(options = {}) {
932
915
  GLOB_JSON,
933
916
  GLOB_JSON5,
934
917
  GLOB_JSONC
935
- ], overrides = {}, stylistic: stylistic$1 = true } = options;
936
- const { indent = 2 } = typeof stylistic$1 === "object" ? stylistic$1 : {};
918
+ ], overrides = {}, stylistic = true } = options;
919
+ const { indent = 2 } = typeof stylistic === "object" ? stylistic : {};
937
920
  const [jsoncPlugin, jsoncParser] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
938
921
  return tseslint.config({
939
922
  name: "fabdeh/jsonc/setup",
@@ -969,7 +952,7 @@ async function jsonc(options = {}) {
969
952
  "jsonc/space-unary-ops": "error",
970
953
  "jsonc/valid-json-number": "error",
971
954
  "jsonc/vue-custom-block/no-parsing-error": "error",
972
- ...stylistic$1 ? {
955
+ ...stylistic ? {
973
956
  "jsonc/array-bracket-spacing": ["error", "never"],
974
957
  "jsonc/comma-dangle": ["error", "never"],
975
958
  "jsonc/comma-style": ["error", "last"],
@@ -1196,14 +1179,14 @@ const DEFAULT_SIGNALS_GLOB = [`**/*.store.${GLOB_TS_EXT}`];
1196
1179
  async function ngrx(options = {}) {
1197
1180
  const ngrxPlugin = await interopDefault(import("@ngrx/eslint-plugin/v9"));
1198
1181
  const { store = isPackageExists("@ngrx/store"), effects = isPackageExists("@ngrx/effects"), signals = isPackageExists("@ngrx/signals"), useRelaxedNamingConventionForCamelAndPascalCases = false } = options;
1199
- const configs$1 = [];
1182
+ const configs = [];
1200
1183
  let addOperatorsRules = false;
1201
1184
  const ngrxOperatorsFiles = [];
1202
1185
  if (store) {
1203
1186
  const { files = DEFAULT_STORE_GLOB, enforceOperatorsRules = isPackageExists("@ngrx/operators"), overrides = {} } = typeof store === "object" ? store : {};
1204
1187
  addOperatorsRules ||= enforceOperatorsRules;
1205
1188
  ngrxOperatorsFiles.push(files);
1206
- configs$1.push({
1189
+ configs.push({
1207
1190
  name: "fabdeh/ngrx-store/rules",
1208
1191
  files,
1209
1192
  plugins: { "@ngrx": ngrxPlugin },
@@ -1240,7 +1223,7 @@ async function ngrx(options = {}) {
1240
1223
  const { files = DEFAULT_EFFECTS_GLOB, enforceOperatorsRules = isPackageExists("@ngrx/operators"), overrides = {} } = typeof effects === "object" ? effects : {};
1241
1224
  addOperatorsRules ||= enforceOperatorsRules;
1242
1225
  ngrxOperatorsFiles.push(files);
1243
- configs$1.push({
1226
+ configs.push({
1244
1227
  name: "fabdeh/ngrx-effects/rules",
1245
1228
  files,
1246
1229
  plugins: { "@ngrx": ngrxPlugin },
@@ -1270,7 +1253,7 @@ async function ngrx(options = {}) {
1270
1253
  const { files = DEFAULT_SIGNALS_GLOB, enforceOperatorsRules = isPackageExists("@ngrx/operators"), overrides = {} } = typeof signals === "object" ? signals : {};
1271
1254
  addOperatorsRules ||= enforceOperatorsRules;
1272
1255
  ngrxOperatorsFiles.push(files);
1273
- configs$1.push({
1256
+ configs.push({
1274
1257
  name: "fabdeh/ngrx-signals/rules",
1275
1258
  files,
1276
1259
  plugins: { "@ngrx": ngrxPlugin },
@@ -1301,13 +1284,13 @@ async function ngrx(options = {}) {
1301
1284
  }
1302
1285
  });
1303
1286
  }
1304
- if (addOperatorsRules) configs$1.push({
1287
+ if (addOperatorsRules) configs.push({
1305
1288
  name: "fabdeh/ngrx-operators/rules",
1306
1289
  files: [...ngrxOperatorsFiles],
1307
1290
  plugins: { "@ngrx": ngrxPlugin },
1308
1291
  rules: { ...ngrxPlugin.configs.operators.find((c) => c.name === "ngrx/operators")?.rules }
1309
1292
  });
1310
- return tseslint.config(configs$1);
1293
+ return tseslint.config(configs);
1311
1294
  }
1312
1295
 
1313
1296
  //#endregion
@@ -1341,36 +1324,31 @@ function node() {
1341
1324
  //#endregion
1342
1325
  //#region src/configs/rules-configs/perfectionist-groups.ts
1343
1326
  const SORT_IMPORT_GROUPS = [
1344
- "type",
1345
- { newlinesBetween: "never" },
1346
- "builtin-type",
1347
- { newlinesBetween: "never" },
1348
- "external-type",
1349
- { newlinesBetween: "never" },
1350
- "internal-type",
1351
- { newlinesBetween: "never" },
1352
- "parent-type",
1353
- { newlinesBetween: "never" },
1354
- "sibling-type",
1355
- { newlinesBetween: "never" },
1356
- "index-type",
1357
- { newlinesBetween: "always" },
1358
- "builtin",
1359
- { newlinesBetween: "always" },
1360
- "external",
1361
- { newlinesBetween: "always" },
1362
- "internal",
1363
- { newlinesBetween: "always" },
1364
- "parent",
1365
- { newlinesBetween: "never" },
1366
- "sibling",
1367
- { newlinesBetween: "never" },
1368
- "index",
1369
- { newlinesBetween: "always" },
1327
+ "type-builtin",
1328
+ "type-external",
1329
+ "type-internal",
1330
+ "type-tsconfig-path",
1331
+ "type-parent",
1332
+ "type-sibling",
1333
+ "type-index",
1334
+ { newlinesBetween: 1 },
1335
+ "value-builtin",
1336
+ { newlinesBetween: 1 },
1337
+ "value-external",
1338
+ { newlinesBetween: 1 },
1339
+ "value-internal",
1340
+ { newlinesBetween: 1 },
1341
+ "value-tsconfig-path",
1342
+ { newlinesBetween: 1 },
1343
+ "value-parent",
1344
+ "value-sibling",
1345
+ "value-index",
1346
+ { newlinesBetween: 1 },
1347
+ "value-style",
1348
+ { newlinesBetween: 1 },
1349
+ "side-effect-style",
1370
1350
  "side-effect",
1371
- { newlinesBetween: "always" },
1372
- "object",
1373
- { newlinesBetween: "always" },
1351
+ { newlinesBetween: 1 },
1374
1352
  "unknown"
1375
1353
  ];
1376
1354
  const SORT_UNION_OR_INTERSECTION_GROUPS = [
@@ -1402,8 +1380,8 @@ const SORT_UNION_OR_INTERSECTION_GROUPS = [
1402
1380
  * @returns The configuration array for the "perfectionist" plugin.
1403
1381
  * @see https://github.com/azat-io/eslint-plugin-perfectionist
1404
1382
  */
1405
- async function perfectionist() {
1406
- const rootDir = await findNearestPackageJsonName() === "@fabdeh/eslint-config" ? void 0 : getWorkspaceRoot(process.cwd(), process.cwd());
1383
+ function perfectionist() {
1384
+ const rootDir = getWorkspaceRoot(process.cwd(), process.cwd());
1407
1385
  return tseslint.config({
1408
1386
  name: "fabdeh/perfectionist/rules",
1409
1387
  files: [GLOB_SRC],
@@ -1415,13 +1393,13 @@ async function perfectionist() {
1415
1393
  }],
1416
1394
  "perfectionist/sort-imports": ["error", {
1417
1395
  groups: SORT_IMPORT_GROUPS,
1418
- tsconfig: rootDir ? {
1396
+ tsconfig: {
1419
1397
  rootDir,
1420
1398
  filename: getTsConfigFileName(rootDir)
1421
- } : void 0,
1399
+ },
1422
1400
  order: "asc",
1423
1401
  type: "natural",
1424
- newlinesBetween: "never"
1402
+ newlinesBetween: 0
1425
1403
  }],
1426
1404
  "perfectionist/sort-intersection-types": ["error", {
1427
1405
  groups: SORT_UNION_OR_INTERSECTION_GROUPS,
@@ -1762,7 +1740,7 @@ function sortTsConfig() {
1762
1740
  async function tailwindcss(options = {}) {
1763
1741
  await ensurePackages(["eslint-plugin-better-tailwindcss"]);
1764
1742
  const betterTailwindcssPlugin = await interopDefault(import("eslint-plugin-better-tailwindcss"));
1765
- const { files: filesGlob, overrides, enableAllRules, parsers, ...settings } = options;
1743
+ const { files: filesGlob, overrides, enableAllRules, parsers, stylistic = true, ...settings } = options;
1766
1744
  let files;
1767
1745
  let parserConfigs;
1768
1746
  if (parsers) {
@@ -1782,7 +1760,8 @@ async function tailwindcss(options = {}) {
1782
1760
  plugins: { "better-tailwindcss": betterTailwindcssPlugin },
1783
1761
  settings: { "better-tailwindcss": settings },
1784
1762
  rules: {
1785
- ...betterTailwindcssPlugin.configs.recommended?.rules,
1763
+ ...betterTailwindcssPlugin.configs.correctness.rules,
1764
+ ...stylistic || enableAllRules ? betterTailwindcssPlugin.configs.stylistic.rules : {},
1786
1765
  ...enableAllRules ? {
1787
1766
  "better-tailwindcss/enforce-consistent-variable-syntax": "warn",
1788
1767
  "better-tailwindcss/no-conflicting-classes": "error",
@@ -1805,16 +1784,16 @@ async function tailwindcss(options = {}) {
1805
1784
  * @returns A promise that resolves to the ESLint configuration array.
1806
1785
  */
1807
1786
  async function toml(options = {}) {
1808
- const { files = [GLOB_TOML], overrides = {}, stylistic: stylistic$1 = true } = options;
1809
- const { indent = 2 } = typeof stylistic$1 === "object" ? stylistic$1 : {};
1810
- const [tomlPlugin, tomlParser] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
1787
+ const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
1788
+ const { indent = 2 } = typeof stylistic === "object" ? stylistic : {};
1789
+ const tomlPlugin = await interopDefault(import("eslint-plugin-toml"));
1811
1790
  return tseslint.config({
1812
1791
  name: "fabdeh/toml/setup",
1813
1792
  plugins: { toml: tomlPlugin }
1814
1793
  }, {
1815
1794
  name: "fabdeh/toml/rules",
1816
- languageOptions: { parser: tomlParser },
1817
1795
  files,
1796
+ language: "toml/toml",
1818
1797
  rules: {
1819
1798
  "@stylistic/spaced-comment": "off",
1820
1799
  "toml/comma-style": "error",
@@ -1825,11 +1804,11 @@ async function toml(options = {}) {
1825
1804
  "toml/precision-of-integer": "error",
1826
1805
  "toml/tables-order": "error",
1827
1806
  "toml/vue-custom-block/no-parsing-error": "error",
1828
- ...stylistic$1 ? {
1807
+ ...stylistic ? {
1829
1808
  "toml/array-bracket-newline": "error",
1830
1809
  "toml/array-bracket-spacing": "error",
1831
1810
  "toml/array-element-newline": "error",
1832
- "toml/indent": ["error", indent === "tab" ? 2 : indent],
1811
+ "toml/indent": ["error", indent],
1833
1812
  "toml/inline-table-curly-spacing": "error",
1834
1813
  "toml/key-spacing": "error",
1835
1814
  "toml/padding-line-between-pairs": "error",
@@ -1893,7 +1872,7 @@ const MEMBER_ORDERING_OPTIONS = { default: [
1893
1872
  * @returns A TypedConfigArray containing the TypeScript ESLint configuration.
1894
1873
  */
1895
1874
  async function typescript(options = {}, isWorkspaceProject = false) {
1896
- const { enableErasableSyntaxOnly = false, overrides = {}, parserOptions = {}, stylistic: stylistic$1 = true, type = "app", useRelaxedNamingConventionForCamelAndPascalCases = false } = options;
1875
+ const { enableErasableSyntaxOnly = false, overrides = {}, parserOptions = {}, stylistic = true, type = "app", useRelaxedNamingConventionForCamelAndPascalCases = false } = options;
1897
1876
  let erasableSyntaxOnlyPlugin;
1898
1877
  let erasableSyntaxOnlyRules;
1899
1878
  if (enableErasableSyntaxOnly) {
@@ -1945,7 +1924,7 @@ async function typescript(options = {}, isWorkspaceProject = false) {
1945
1924
  rules: {
1946
1925
  ...tseslint.configs.strictTypeChecked.find((c) => c.name === "typescript-eslint/eslint-recommended")?.rules,
1947
1926
  ...tseslint.configs.strictTypeChecked.find((c) => c.name === "typescript-eslint/strict-type-checked")?.rules,
1948
- ...stylistic$1 ? tseslint.configs.stylisticTypeChecked.find((c) => c.name === "typescript-eslint/stylistic-type-checked")?.rules : {},
1927
+ ...stylistic ? tseslint.configs.stylisticTypeChecked.find((c) => c.name === "typescript-eslint/stylistic-type-checked")?.rules : {},
1949
1928
  "@typescript-eslint/array-type": ["error", { default: "array" }],
1950
1929
  "@typescript-eslint/consistent-indexed-object-style": "error",
1951
1930
  "@typescript-eslint/consistent-type-assertions": ["error", {
@@ -2212,15 +2191,15 @@ async function vitest(options = {}) {
2212
2191
  * @returns A promise that resolves to a `TypedConfigArray` containing the ESLint configuration.
2213
2192
  */
2214
2193
  async function yaml(options = {}) {
2215
- const { files = [GLOB_YAML], overrides = {}, stylistic: stylistic$1 = true } = options;
2216
- const { indent = 2, quotes = "single" } = typeof stylistic$1 === "object" ? stylistic$1 : {};
2217
- const [yamlPlugin, yamlParser] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
2194
+ const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
2195
+ const { indent = 2, quotes = "single" } = typeof stylistic === "object" ? stylistic : {};
2196
+ const yamlPlugin = await interopDefault(import("eslint-plugin-yml"));
2218
2197
  return tseslint.config({
2219
2198
  name: "fabdeh/yaml/setup",
2220
2199
  plugins: { yaml: yamlPlugin }
2221
2200
  }, {
2222
2201
  name: "fabdeh/yaml/rules",
2223
- languageOptions: { parser: yamlParser },
2202
+ language: "yaml/yaml",
2224
2203
  files,
2225
2204
  rules: {
2226
2205
  "@stylistic/spaced-comment": "off",
@@ -2231,14 +2210,14 @@ async function yaml(options = {}) {
2231
2210
  "yaml/no-irregular-whitespace": "error",
2232
2211
  "yaml/plain-scalar": "error",
2233
2212
  "yaml/vue-custom-block/no-parsing-error": "error",
2234
- ...stylistic$1 ? {
2213
+ ...stylistic ? {
2235
2214
  "yaml/block-mapping-question-indicator-newline": "error",
2236
2215
  "yaml/block-sequence-hyphen-indicator-newline": "error",
2237
2216
  "yaml/flow-mapping-curly-newline": "error",
2238
2217
  "yaml/flow-mapping-curly-spacing": "error",
2239
2218
  "yaml/flow-sequence-bracket-newline": "error",
2240
2219
  "yaml/flow-sequence-bracket-spacing": "error",
2241
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
2220
+ "yaml/indent": ["error", indent],
2242
2221
  "yaml/key-spacing": "error",
2243
2222
  "yaml/no-tab-indent": "error",
2244
2223
  "yaml/quotes": ["error", {
@@ -2285,22 +2264,20 @@ async function defineProjectConfig(baseConfig, options = {}, ...userConfigs) {
2285
2264
  const workspaceOptions = resolvedBaseConfig[OPTIONS_SYMBOL];
2286
2265
  const { angular: enableAngular = isPackageExists("@angular/core"), jsdoc: enableJsdoc = options.type === "lib", ngrx: enableNgrx = NGRX_PACKAGES.some((p) => isPackageExists(p)), tailwindcss: enableTailwind = false, typescript: typescriptOptions, vitest: enableVitest = isPackageExists("vitest") } = options;
2287
2266
  if (enableNgrx && !enableAngular) throw new Error("NgRx rules can only be enabled if Angular rules are also enabled.");
2288
- const configs$1 = [];
2289
- if (options.ignores && options.ignores.length > 0) configs$1.push(ignores(options.ignores, "project"));
2290
- if (enableJsdoc) {
2291
- const stylisticOptions = workspaceOptions.stylistic === false ? false : typeof workspaceOptions.stylistic === "object" ? workspaceOptions.stylistic : {};
2292
- configs$1.push(jsdoc({ stylistic: stylisticOptions }));
2293
- }
2267
+ const configs = [];
2268
+ const stylisticOptions = workspaceOptions.stylistic === false ? false : typeof workspaceOptions.stylistic === "object" ? workspaceOptions.stylistic : {};
2269
+ if (options.ignores && options.ignores.length > 0) configs.push(ignores(options.ignores, "project"));
2270
+ if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
2294
2271
  if (typescriptOptions) {
2295
2272
  if (!workspaceOptions.typescript) throw new Error("Project-specific TypeScript configuration requires a base configuration with TypeScript support.");
2296
- configs$1.push(typescript({
2273
+ configs.push(typescript({
2297
2274
  ...typescriptOptions,
2298
2275
  type: options.type
2299
2276
  }, true));
2300
2277
  }
2301
2278
  if (enableAngular) {
2302
2279
  const angularOptions = resolveSubOptions(options, "angular");
2303
- configs$1.push(angular(angularOptions));
2280
+ configs.push(angular(angularOptions));
2304
2281
  if (workspaceOptions.formatters) {
2305
2282
  const htmlFormatters = resolvedBaseConfig.find((c) => c.name === "fabdeh/formatter/html");
2306
2283
  if (htmlFormatters) delete htmlFormatters.languageOptions;
@@ -2308,21 +2285,24 @@ async function defineProjectConfig(baseConfig, options = {}, ...userConfigs) {
2308
2285
  }
2309
2286
  if (enableNgrx) {
2310
2287
  const ngrxOptions = resolveSubOptions(options, "ngrx");
2311
- const typescriptOptions$1 = resolveSubOptions(workspaceOptions, "typescript");
2312
- configs$1.push(ngrx({
2288
+ const typescriptOptions = resolveSubOptions(workspaceOptions, "typescript");
2289
+ configs.push(ngrx({
2313
2290
  ...ngrxOptions,
2314
- useRelaxedNamingConventionForCamelAndPascalCases: typescriptOptions$1.useRelaxedNamingConventionForCamelAndPascalCases
2291
+ useRelaxedNamingConventionForCamelAndPascalCases: typescriptOptions.useRelaxedNamingConventionForCamelAndPascalCases
2315
2292
  }));
2316
2293
  }
2317
2294
  if (enableVitest) {
2318
2295
  const vitestOptions = resolveSubOptions(options, "vitest");
2319
- configs$1.push(vitest(vitestOptions));
2296
+ configs.push(vitest(vitestOptions));
2320
2297
  }
2321
2298
  if (enableTailwind) {
2322
2299
  const tailwindcssOptions = resolveSubOptions(options, "tailwindcss");
2323
- configs$1.push(tailwindcss(tailwindcssOptions));
2300
+ configs.push(tailwindcss({
2301
+ ...tailwindcssOptions,
2302
+ stylistic: stylisticOptions
2303
+ }));
2324
2304
  }
2325
- return tseslint.config(...resolvedBaseConfig, ...await Promise.all(configs$1), ...await Promise.all(userConfigs));
2305
+ return tseslint.config(...resolvedBaseConfig, ...await Promise.all(configs), ...await Promise.all(userConfigs));
2326
2306
  }
2327
2307
 
2328
2308
  //#endregion
@@ -2343,82 +2323,85 @@ async function defineConfig(options = {}, ...userConfigs) {
2343
2323
  const { angular: enableAngular = isPackageExists("@angular/core"), gitignore: enableGitignore = true, jsdoc: enableJsdoc = options.type === "lib", ngrx: enableNgrx = NGRX_PACKAGES.some((p) => isPackageExists(p)), pnpm: enableCatalogs = false, regexp: enableRegexp = true, tailwindcss: enableTailwind = false, typescript: enableTypescript = isPackageExists("typescript"), unicorn: enableUnicorn = true, vitest: enableVitest = isPackageExists("vitest") } = options;
2344
2324
  if (enableNgrx && !enableAngular) throw new Error("NgRx rules can only be enabled if Angular rules are also enabled.");
2345
2325
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2346
- const configs$1 = [];
2347
- if (enableGitignore) if (typeof enableGitignore === "object") configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2326
+ const configs = [];
2327
+ if (enableGitignore) if (typeof enableGitignore === "object") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2348
2328
  name: "fabdeh/gitignore",
2349
2329
  ...enableGitignore
2350
2330
  }))));
2351
- else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2331
+ else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2352
2332
  name: "fabdeh/gitignore",
2353
2333
  strict: true
2354
2334
  }))));
2355
- configs$1.push(ignores(options.ignores), javascript({ overrides: options.javascript?.overrides }), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
2356
- if (enableJsdoc) configs$1.push(jsdoc({ stylistic: stylisticOptions }));
2335
+ configs.push(ignores(options.ignores), javascript({ overrides: options.javascript?.overrides }), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
2336
+ if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
2357
2337
  if (enableUnicorn) {
2358
2338
  const unicornOptions = resolveSubOptions(options, "unicorn");
2359
- configs$1.push(unicorn(unicornOptions));
2339
+ configs.push(unicorn(unicornOptions));
2360
2340
  }
2361
2341
  if (enableTypescript) {
2362
2342
  const typescriptOptions = resolveSubOptions(options, "typescript");
2363
- configs$1.push(typescript({
2343
+ configs.push(typescript({
2364
2344
  ...typescriptOptions,
2365
2345
  stylistic: stylisticOptions,
2366
2346
  type: options.type
2367
2347
  }));
2368
2348
  }
2369
- if (stylisticOptions) configs$1.push(stylistic({ stylistic: stylisticOptions }));
2349
+ if (stylisticOptions) configs.push(stylistic({ stylistic: stylisticOptions }));
2370
2350
  if (enableRegexp) {
2371
2351
  const regexpOptions = resolveSubOptions(options, "regexp");
2372
- configs$1.push(regexp(regexpOptions));
2352
+ configs.push(regexp(regexpOptions));
2373
2353
  }
2374
2354
  if (enableAngular) {
2375
2355
  const angularOptions = resolveSubOptions(options, "angular");
2376
- configs$1.push(angular(angularOptions));
2356
+ configs.push(angular(angularOptions));
2377
2357
  }
2378
2358
  if (enableNgrx) {
2379
2359
  const typescriptOptions = resolveSubOptions(options, "typescript");
2380
2360
  const ngrxOptions = resolveSubOptions(options, "ngrx");
2381
- configs$1.push(ngrx({
2361
+ configs.push(ngrx({
2382
2362
  ...ngrxOptions,
2383
2363
  useRelaxedNamingConventionForCamelAndPascalCases: typescriptOptions.useRelaxedNamingConventionForCamelAndPascalCases
2384
2364
  }));
2385
2365
  }
2386
2366
  if (enableVitest) {
2387
2367
  const vitestOptions = resolveSubOptions(options, "vitest");
2388
- configs$1.push(vitest(vitestOptions));
2368
+ configs.push(vitest(vitestOptions));
2389
2369
  }
2390
2370
  if (enableTailwind) {
2391
2371
  const tailwindcssOptions = resolveSubOptions(options, "tailwindcss");
2392
- configs$1.push(tailwindcss(tailwindcssOptions));
2372
+ configs.push(tailwindcss({
2373
+ ...tailwindcssOptions,
2374
+ stylistic: stylisticOptions
2375
+ }));
2393
2376
  }
2394
2377
  if (options.jsonc ?? true) {
2395
2378
  const jsoncOptions = resolveSubOptions(options, "jsonc");
2396
- configs$1.push(jsonc({
2379
+ configs.push(jsonc({
2397
2380
  ...jsoncOptions,
2398
2381
  stylistic: stylisticOptions
2399
2382
  }), sortPackageJson(), sortTsConfig());
2400
2383
  }
2401
- if (enableCatalogs) configs$1.push(pnpm());
2384
+ if (enableCatalogs) configs.push(pnpm());
2402
2385
  if (options.yaml ?? true) {
2403
2386
  const yamlOptions = resolveSubOptions(options, "yaml");
2404
- configs$1.push(yaml({
2387
+ configs.push(yaml({
2405
2388
  ...yamlOptions,
2406
2389
  stylistic: stylisticOptions
2407
2390
  }));
2408
2391
  }
2409
2392
  if (options.toml ?? true) {
2410
2393
  const tomlOptions = resolveSubOptions(options, "toml");
2411
- configs$1.push(toml({
2394
+ configs.push(toml({
2412
2395
  ...tomlOptions,
2413
2396
  stylistic: stylisticOptions
2414
2397
  }));
2415
2398
  }
2416
2399
  if (options.markdown ?? true) {
2417
2400
  const markdownOptions = resolveSubOptions(options, "markdown");
2418
- configs$1.push(markdown(markdownOptions));
2401
+ configs.push(markdown(markdownOptions));
2419
2402
  }
2420
- if (options.formatters) configs$1.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions, Boolean(enableAngular)));
2421
- return tseslint.config(...await Promise.all(configs$1), ...await Promise.all(userConfigs));
2403
+ if (options.formatters) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions, Boolean(enableAngular)));
2404
+ return tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
2422
2405
  }
2423
2406
 
2424
2407
  //#endregion
@@ -2439,64 +2422,64 @@ async function defineConfig(options = {}, ...userConfigs) {
2439
2422
  async function defineWorkspaceConfig(options = {}, ...userConfigs) {
2440
2423
  const { gitignore: enableGitignore = true, pnpm: enableCatalogs = false, regexp: enableRegexp = true, typescript: enableTypescript = isPackageExists("typescript"), unicorn: enableUnicorn = true } = options;
2441
2424
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2442
- const configs$1 = [];
2443
- if (enableGitignore) if (typeof enableGitignore === "object") configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2425
+ const configs = [];
2426
+ if (enableGitignore) if (typeof enableGitignore === "object") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2444
2427
  name: "fabdeh/gitignore",
2445
2428
  ...enableGitignore
2446
2429
  }))));
2447
- else configs$1.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2430
+ else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => tseslint.config(r({
2448
2431
  name: "fabdeh/gitignore",
2449
2432
  strict: true
2450
2433
  }))));
2451
- configs$1.push(ignores(options.ignores, "workspace"), javascript({ overrides: options.javascript?.overrides }), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
2434
+ configs.push(ignores(options.ignores, "workspace"), javascript({ overrides: options.javascript?.overrides }), comments(), node(), imports({ stylistic: stylisticOptions }), perfectionist());
2452
2435
  if (enableUnicorn) {
2453
2436
  const unicornOptions = resolveSubOptions(options, "unicorn");
2454
- configs$1.push(unicorn(unicornOptions));
2437
+ configs.push(unicorn(unicornOptions));
2455
2438
  }
2456
2439
  if (enableTypescript) {
2457
2440
  const typescriptOptions = resolveSubOptions(options, "typescript");
2458
- configs$1.push(typescript({
2441
+ configs.push(typescript({
2459
2442
  ...typescriptOptions,
2460
2443
  stylistic: stylisticOptions,
2461
2444
  type: "workspace"
2462
2445
  }));
2463
2446
  }
2464
- if (stylisticOptions) configs$1.push(stylistic({ stylistic: stylisticOptions }));
2447
+ if (stylisticOptions) configs.push(stylistic({ stylistic: stylisticOptions }));
2465
2448
  if (enableRegexp) {
2466
2449
  const regexpOptions = resolveSubOptions(options, "regexp");
2467
- configs$1.push(regexp(regexpOptions));
2450
+ configs.push(regexp(regexpOptions));
2468
2451
  }
2469
2452
  if (options.jsonc ?? true) {
2470
2453
  const jsoncOptions = resolveSubOptions(options, "jsonc");
2471
- configs$1.push(jsonc({
2454
+ configs.push(jsonc({
2472
2455
  ...jsoncOptions,
2473
2456
  stylistic: stylisticOptions
2474
2457
  }), sortPackageJson(), sortTsConfig());
2475
2458
  }
2476
- if (enableCatalogs) configs$1.push(pnpm());
2459
+ if (enableCatalogs) configs.push(pnpm());
2477
2460
  if (options.yaml ?? true) {
2478
2461
  const yamlOptions = resolveSubOptions(options, "yaml");
2479
- configs$1.push(yaml({
2462
+ configs.push(yaml({
2480
2463
  ...yamlOptions,
2481
2464
  stylistic: stylisticOptions
2482
2465
  }));
2483
2466
  }
2484
2467
  if (options.toml ?? true) {
2485
2468
  const tomlOptions = resolveSubOptions(options, "toml");
2486
- configs$1.push(toml({
2469
+ configs.push(toml({
2487
2470
  ...tomlOptions,
2488
2471
  stylistic: stylisticOptions
2489
2472
  }));
2490
2473
  }
2491
2474
  if (options.markdown ?? true) {
2492
2475
  const markdownOptions = resolveSubOptions(options, "markdown");
2493
- configs$1.push(markdown(markdownOptions));
2476
+ configs.push(markdown(markdownOptions));
2494
2477
  }
2495
- if (options.formatters) configs$1.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions, false));
2496
- const eslintConfigWithOptions = tseslint.config(...await Promise.all(configs$1), ...await Promise.all(userConfigs));
2478
+ if (options.formatters) configs.push(formatters(options.formatters, typeof stylisticOptions === "boolean" ? {} : stylisticOptions, false));
2479
+ const eslintConfigWithOptions = tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
2497
2480
  eslintConfigWithOptions[OPTIONS_SYMBOL] = options;
2498
2481
  return eslintConfigWithOptions;
2499
2482
  }
2500
2483
 
2501
2484
  //#endregion
2502
- export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, defineConfig, defineProjectConfig, defineWorkspaceConfig, ensurePackages, findNearestPackageJsonName, formatters, getTsConfigFileName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, node, perfectionist, pnpm, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
2485
+ export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, defineConfig, defineProjectConfig, defineWorkspaceConfig, ensurePackages, formatters, getTsConfigFileName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, node, perfectionist, pnpm, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };