@zayne-labs/eslint-config 0.11.6 → 0.11.8

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,14 +1,16 @@
1
- import { assert, defineEnum, isFunction, isObject as isObject$1, isObjectAndNotArray } from "@zayne-labs/toolkit-type-helpers";
2
- import { isPackageExists } from "local-pkg";
1
+ import { d as resolveOptions, i as isObject$1, l as renamePlugins, n as ensurePackages, o as overrideConfigs, r as interopDefault, s as parserPlain, u as renameRules } from "./utils-DPFNmhr6.js";
2
+ import { a as getDefaultTailwindcssBetterSettings, i as getDefaultPluginRenameMap, n as getDefaultAllowedNextJsExportNames, r as getDefaultAllowedReactRouterExportNames, t as getDefaultAllowedDependencies } from "./defaults-B3n8wABC.js";
3
+ import { assert, defineEnum, isFunction, isObject } from "@zayne-labs/toolkit-type-helpers";
3
4
  import { fileURLToPath } from "node:url";
5
+ import { isPackageExists } from "local-pkg";
4
6
  import { globalIgnores } from "eslint/config";
5
7
  import globals from "globals";
6
8
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
9
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
7
10
  import process$1 from "node:process";
8
11
  import fsp from "node:fs/promises";
9
12
  import fs from "node:fs";
10
13
  import path from "node:path";
11
- import { FlatConfigComposer } from "eslint-flat-config-utils";
12
14
 
13
15
  //#region src/globs.ts
14
16
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -92,180 +94,6 @@ const GLOB_EXCLUDE = defineEnum([
92
94
  "**/components.d.ts"
93
95
  ]);
94
96
 
95
- //#endregion
96
- //#region src/utils.ts
97
- const isObject = (value) => {
98
- return isObjectAndNotArray(value);
99
- };
100
- /**
101
- * @description - Combine array and non-array configs into a single array.
102
- */
103
- const combine = async (...configs) => {
104
- return (await Promise.all(configs)).flat();
105
- };
106
- const interopDefault = async (module) => {
107
- const resolved = await module;
108
- return resolved.default ?? resolved;
109
- };
110
- /**
111
- * @description - Rename plugin prefixes in a rule object.
112
- * Accepts a map of prefixes to rename.
113
- *
114
- * @example
115
- * ```ts
116
- * import { renameRules } from '@zayne-labs/eslint-config'
117
- *
118
- * export default [{
119
- * rules: renameRules(
120
- * {
121
- * '@typescript-eslint/indent': 'error'
122
- * },
123
- * { '@typescript-eslint': 'ts' }
124
- * )
125
- * }]
126
- * ```
127
- */
128
- const renameRules = (rules, renameMap) => {
129
- if (!rules) return;
130
- const renamedRulesEntries = Object.entries(rules).map(([ruleKey, ruleValue]) => {
131
- for (const [oldRuleName, newRuleName] of Object.entries(renameMap)) if (ruleKey.startsWith(`${oldRuleName}/`)) return [`${newRuleName}${ruleKey.slice(oldRuleName.length)}`, ruleValue];
132
- return [ruleKey, ruleValue];
133
- });
134
- return Object.fromEntries(renamedRulesEntries);
135
- };
136
- const renamePlugins = (plugins, renameMap) => {
137
- if (!plugins) return;
138
- const renamedPluginEntries = Object.entries(plugins).map(([pluginKey, pluginValue]) => {
139
- if (pluginKey in renameMap) return [renameMap[pluginKey], pluginValue];
140
- return [pluginKey, pluginValue];
141
- });
142
- return Object.fromEntries(renamedPluginEntries);
143
- };
144
- const getResolvedOverrides = (options) => {
145
- const { configItem, overrides } = options;
146
- return isFunction(overrides) ? overrides(configItem) : overrides;
147
- };
148
- /**
149
- * @description - Override configurations in a flat configs array with either a static config object or a function that returns a config object
150
- * @param options - Configuration options
151
- * @param options.configs - Array of flat config items to override
152
- * @param options.overrides - Either a config object to merge or a function that takes a config and returns overrides
153
- * @returns Array of merged config items with overrides applied
154
- *
155
- * @example
156
- * ```ts
157
- * import { overrideConfigs } from '@zayne-labs/eslint-config'
158
- *
159
- * // Override with static config
160
- * overrideConfigs({
161
- * configArray: existingConfigs,
162
- * overrides: {
163
- * rules: {
164
- * 'no-console': 'error'
165
- * }
166
- * }
167
- * })
168
- *
169
- * // Override with function
170
- * overrideConfigs({
171
- * configArray: existingConfigs,
172
- * overrides: (config) => ({
173
- * ...config,
174
- * rules: {
175
- * ...config.rules,
176
- * 'no-console': 'error'
177
- * }
178
- * })
179
- * })
180
- * ```
181
- */
182
- const overrideConfigs = (options) => {
183
- const { configArray, overrides } = options;
184
- return configArray.map((configItem) => ({
185
- ...configItem,
186
- ...getResolvedOverrides({
187
- configItem,
188
- overrides
189
- })
190
- }));
191
- };
192
- /**
193
- * @description - Rename plugin names and rules in a flat configs array
194
- *
195
- * @param options - Configuration options
196
- * @param options.configArray - Array of flat config items to process
197
- * @param options.overrides - Optional config overrides to apply
198
- * @param options.renameMap - Map of old plugin names to new names
199
- *
200
- * @example
201
- * ```ts
202
- * import { renamePluginInConfigs } from '@zayne-labs/eslint-config'
203
- * import someConfigs from './some-configs'
204
- *
205
- * renamePluginInConfigs({
206
- * configArray: someConfigs,
207
- * renameMap: {
208
- * '@typescript-eslint': 'ts',
209
- * 'import-x': 'import',
210
- * }
211
- * })
212
- * ```
213
- */
214
- const renamePluginInConfigs = (options) => {
215
- const { configArray, overrides, renameMap } = options;
216
- return overrideConfigs({
217
- configArray,
218
- overrides: (configItem) => ({
219
- ...getResolvedOverrides({
220
- configItem,
221
- overrides
222
- }),
223
- ...isObject(configItem.plugins) && { plugins: renamePlugins(configItem.plugins, renameMap) },
224
- ...isObject(configItem.rules) && { rules: renameRules(configItem.rules, renameMap) }
225
- })
226
- });
227
- };
228
- const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
229
- const isCwdInScope = isPackageExists("@zayne-labs/eslint-config");
230
- const isPackageInScope = (name) => isPackageExists(name, { paths: [scopeUrl] });
231
- /**
232
- * @description
233
- * - Ensures that packages are installed in the current scope.
234
- * - If they are not installed, and the user is in a TTY, and the user is not in a CI environment,
235
- * and the user is in the same scope as this package, then prompt the user to
236
- * install the packages.
237
- *
238
- * @param packages - The packages to ensure are installed.
239
- */
240
- const ensurePackages = async (packages) => {
241
- if (process.env.CI || !process.stdout.isTTY || !isCwdInScope) return;
242
- const nonExistingPackages = packages.filter((pkg) => pkg && !isPackageInScope(pkg));
243
- if (nonExistingPackages.length === 0) return;
244
- 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 (await import("@antfu/install-pkg")).installPackage(nonExistingPackages, { dev: true });
245
- };
246
- const resolveOptions = (option) => {
247
- return isObject(option) ? option : {};
248
- };
249
- const parserPlain = {
250
- meta: { name: "parser-plain" },
251
- parseForESLint: (code) => ({
252
- ast: {
253
- body: [],
254
- comments: [],
255
- loc: {
256
- end: code.length,
257
- start: 0
258
- },
259
- range: [0, code.length],
260
- tokens: [],
261
- type: "Program"
262
- },
263
- scopeManager: null,
264
- services: { isPlain: true },
265
- visitorKeys: { Program: [] }
266
- })
267
- };
268
-
269
97
  //#endregion
270
98
  //#region src/configs/astro.ts
271
99
  const astro = async (options = {}) => {
@@ -338,6 +166,7 @@ const depend = async (options = {}) => {
338
166
  const { files = [GLOB_SRC], overrides } = options;
339
167
  await ensurePackages(["eslint-plugin-depend"]);
340
168
  const [eslintPluginDepend, jsoncParser] = await Promise.all([interopDefault(import("eslint-plugin-depend")), interopDefault(import("jsonc-eslint-parser"))]);
169
+ const dependRules = { "depend/ban-dependencies": ["error", { allowed: getDefaultAllowedDependencies() }] };
341
170
  return [
342
171
  {
343
172
  name: "zayne/depend/setup",
@@ -345,9 +174,9 @@ const depend = async (options = {}) => {
345
174
  },
346
175
  {
347
176
  files,
348
- name: "zayne/depend/recommended",
177
+ name: "zayne/depend/rules",
349
178
  rules: {
350
- ...eslintPluginDepend.configs["flat/recommended"]?.rules,
179
+ ...dependRules,
351
180
  ...overrides
352
181
  }
353
182
  },
@@ -357,7 +186,7 @@ const depend = async (options = {}) => {
357
186
  name: "zayne/depend/recommended/package-json",
358
187
  plugins: { depend: eslintPluginDepend },
359
188
  rules: {
360
- ...eslintPluginDepend.configs["flat/recommended"]?.rules,
189
+ ...dependRules,
361
190
  ...overrides
362
191
  }
363
192
  }
@@ -796,8 +625,13 @@ const jsonc = async (options = {}) => {
796
625
  GLOB_JSON,
797
626
  GLOB_JSON5,
798
627
  GLOB_JSONC
799
- ], overrides, stylistic: stylistic$1 = true } = options;
628
+ ], overrides } = options;
800
629
  const [eslintPluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
630
+ const recommendedRules = eslintPluginJsonc.configs["flat/recommended-with-jsonc"].map((config) => config.rules).reduce((accumulator, rules) => ({
631
+ ...accumulator,
632
+ ...rules
633
+ }), {});
634
+ const disablePrettierRules = eslintPluginJsonc.configs["flat/prettier"].at(-1)?.rules;
801
635
  return [
802
636
  {
803
637
  name: "zayne/jsonc/setup",
@@ -808,55 +642,20 @@ const jsonc = async (options = {}) => {
808
642
  languageOptions: { parser: parserJsonc },
809
643
  name: "zayne/jsonc/parser"
810
644
  },
645
+ {
646
+ files,
647
+ name: "zayne/jsonc/recommended",
648
+ rules: recommendedRules
649
+ },
811
650
  {
812
651
  files,
813
652
  name: "zayne/jsonc/rules",
814
- rules: {
815
- "jsonc/no-bigint-literals": "error",
816
- "jsonc/no-binary-expression": "error",
817
- "jsonc/no-binary-numeric-literals": "error",
818
- "jsonc/no-dupe-keys": "error",
819
- "jsonc/no-escape-sequence-in-identifier": "error",
820
- "jsonc/no-floating-decimal": "error",
821
- "jsonc/no-hexadecimal-numeric-literals": "error",
822
- "jsonc/no-infinity": "error",
823
- "jsonc/no-multi-str": "error",
824
- "jsonc/no-nan": "error",
825
- "jsonc/no-number-props": "error",
826
- "jsonc/no-numeric-separators": "error",
827
- "jsonc/no-octal": "error",
828
- "jsonc/no-octal-escape": "error",
829
- "jsonc/no-octal-numeric-literals": "error",
830
- "jsonc/no-parenthesized": "error",
831
- "jsonc/no-plus-sign": "error",
832
- "jsonc/no-regexp-literals": "error",
833
- "jsonc/no-sparse-arrays": "error",
834
- "jsonc/no-template-literals": "error",
835
- "jsonc/no-undefined-value": "error",
836
- "jsonc/no-unicode-codepoint-escapes": "error",
837
- "jsonc/no-useless-escape": "error",
838
- "jsonc/space-unary-ops": "error",
839
- "jsonc/valid-json-number": "error",
840
- "jsonc/vue-custom-block/no-parsing-error": "error",
841
- ...stylistic$1 && {
842
- "jsonc/array-bracket-spacing": ["error", "never"],
843
- "jsonc/comma-dangle": ["error", "never"],
844
- "jsonc/comma-style": ["error", "last"],
845
- "jsonc/key-spacing": ["error", {
846
- afterColon: true,
847
- beforeColon: false
848
- }],
849
- "jsonc/object-curly-newline": ["error", {
850
- consistent: true,
851
- multiline: true
852
- }],
853
- "jsonc/object-curly-spacing": ["error", "always"],
854
- "jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
855
- "jsonc/quote-props": "error",
856
- "jsonc/quotes": "error"
857
- },
858
- ...overrides
859
- }
653
+ rules: { ...overrides }
654
+ },
655
+ {
656
+ files,
657
+ name: "zayne/jsonc/disables-prettier",
658
+ rules: disablePrettierRules
860
659
  }
861
660
  ];
862
661
  };
@@ -886,7 +685,7 @@ const jsx = async (options = {}) => {
886
685
  name: "zayne/jsx/a11y/rules",
887
686
  rules: {
888
687
  ...overrides,
889
- ...isObject(a11y) && a11y.overrides
688
+ ...isObject$1(a11y) && a11y.overrides
890
689
  }
891
690
  });
892
691
  return config;
@@ -997,7 +796,7 @@ const node = async (options = {}) => {
997
796
  rules: {
998
797
  ...eslintPluginSecurity.configs.recommended.rules,
999
798
  ...overrides,
1000
- ...isObject(security) && security.overrides
799
+ ...isObject$1(security) && security.overrides
1001
800
  }
1002
801
  });
1003
802
  return config;
@@ -1084,35 +883,10 @@ const perfectionist = async (options = {}) => {
1084
883
  }];
1085
884
  };
1086
885
 
1087
- //#endregion
1088
- //#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
1089
- const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
1090
- async function findUp(name, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
1091
- let directory = path.resolve(toPath(cwd) ?? "");
1092
- const { root } = path.parse(directory);
1093
- stopAt = path.resolve(directory, toPath(stopAt ?? root));
1094
- const isAbsoluteName = path.isAbsolute(name);
1095
- while (directory) {
1096
- const filePath = isAbsoluteName ? name : path.join(directory, name);
1097
- try {
1098
- const stats = await fsp.stat(filePath);
1099
- if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
1100
- } catch {}
1101
- if (directory === stopAt || directory === root) break;
1102
- directory = path.dirname(directory);
1103
- }
1104
- }
1105
-
1106
886
  //#endregion
1107
887
  //#region src/configs/pnpm.ts
1108
- const detectCatalogUsage = async () => {
1109
- const workspaceFile = await findUp("pnpm-workspace.yaml");
1110
- if (!workspaceFile) return false;
1111
- const yaml$1 = await fsp.readFile(workspaceFile, "utf8");
1112
- return yaml$1.includes("catalog:") || yaml$1.includes("catalogs:");
1113
- };
1114
888
  async function pnpm(options = {}) {
1115
- const { catalogs = detectCatalogUsage(), json = true, overrides, sort = true, yaml: yaml$1 = true } = options;
889
+ const { catalogs = false, json = true, overrides, sort = true, yaml: yaml$1 = true } = options;
1116
890
  await ensurePackages(["eslint-plugin-pnpm"]);
1117
891
  const [eslintPluginPnpm, yamlParser, eslintPluginYaml, jsoncParser] = await Promise.all([
1118
892
  interopDefault(import("eslint-plugin-pnpm")),
@@ -1139,10 +913,6 @@ async function pnpm(options = {}) {
1139
913
  name: "zayne/pnpm/pnpm-workspace-yaml/rules",
1140
914
  plugins: { pnpm: eslintPluginPnpm },
1141
915
  rules: {
1142
- "pnpm/yaml-enforce-settings": ["error", { settings: {
1143
- shellEmulator: true,
1144
- trustPolicy: "no-downgrade"
1145
- } }],
1146
916
  "pnpm/yaml-no-duplicate-catalog-item": "error",
1147
917
  "pnpm/yaml-no-unused-catalog-item": "error",
1148
918
  ...overrides?.yaml
@@ -1225,51 +995,6 @@ async function pnpm(options = {}) {
1225
995
  return configs;
1226
996
  }
1227
997
 
1228
- //#endregion
1229
- //#region src/constants.ts
1230
- const defaultPluginRenameMap = defineEnum({
1231
- "@eslint-react/debug": "react-debug",
1232
- "@eslint-react/dom": "react-dom",
1233
- "@eslint-react/hooks-extra": "react-hooks-extra",
1234
- "@eslint-react/naming-convention": "react-naming-convention",
1235
- "@eslint-react/web-api": "react-web-api",
1236
- "@eslint-react": "react-x",
1237
- "@next/next": "nextjs",
1238
- "@stylistic": "stylistic",
1239
- "@tanstack/query": "tanstack-query",
1240
- "@tanstack/router": "tanstack-router",
1241
- "@typescript-eslint": "ts-eslint",
1242
- "better-tailwindcss": "tailwindcss-better",
1243
- "import-x": "import",
1244
- n: "node"
1245
- });
1246
- const allowedNextJsExportNames = [
1247
- "dynamic",
1248
- "dynamicParams",
1249
- "revalidate",
1250
- "fetchCache",
1251
- "runtime",
1252
- "preferredRegion",
1253
- "maxDuration",
1254
- "config",
1255
- "generateStaticParams",
1256
- "metadata",
1257
- "generateMetadata",
1258
- "viewport",
1259
- "generateViewport"
1260
- ];
1261
- const allowedReactRouterExportNames = [
1262
- "meta",
1263
- "links",
1264
- "headers",
1265
- "loader",
1266
- "action",
1267
- "clientLoader",
1268
- "clientAction",
1269
- "handle",
1270
- "shouldRevalidate"
1271
- ];
1272
-
1273
998
  //#endregion
1274
999
  //#region src/configs/react.ts
1275
1000
  const ReactRefreshAllowConstantExportPackages = ["vite"];
@@ -1296,7 +1021,7 @@ const react = async (options = {}) => {
1296
1021
  enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
1297
1022
  enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
1298
1023
  refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
1299
- youMightNotNeedAnEffect ? interopDefault(import("./src-BncWNtPe.js")) : void 0,
1024
+ youMightNotNeedAnEffect ? interopDefault(import("./src-BqZFkya2.js")) : void 0,
1300
1025
  nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
1301
1026
  ]);
1302
1027
  const strictConfigKey = typescript$1 ? "strict-type-checked" : "strict";
@@ -1309,7 +1034,7 @@ const react = async (options = {}) => {
1309
1034
  } },
1310
1035
  name: "zayne/react/setup",
1311
1036
  plugins: {
1312
- ...renamePlugins(strictReactConfig.plugins, defaultPluginRenameMap),
1037
+ ...renamePlugins(strictReactConfig.plugins, getDefaultPluginRenameMap()),
1313
1038
  "react-hooks": eslintReactHooks,
1314
1039
  "react-you-might-not-need-an-effect": eslintPluginReactYouMightNotNeedAnEffect
1315
1040
  },
@@ -1325,7 +1050,7 @@ const react = async (options = {}) => {
1325
1050
  files: typescript$1 ? filesTypeAware : files,
1326
1051
  ...typescript$1 && { ignores: ignoresTypeAware },
1327
1052
  name: `zayne/react/unofficial/${strictConfigKey}`,
1328
- rules: renameRules(strictReactConfig.rules, defaultPluginRenameMap)
1053
+ rules: renameRules(strictReactConfig.rules, getDefaultPluginRenameMap())
1329
1054
  }, {
1330
1055
  files,
1331
1056
  name: "zayne/react/unofficial/rules",
@@ -1341,7 +1066,7 @@ const react = async (options = {}) => {
1341
1066
  "react-x/no-missing-component-display-name": "warn",
1342
1067
  "react-x/prefer-read-only-props": "off",
1343
1068
  ...overrides,
1344
- ...isObject$1(enableReact) && enableReact.overrides
1069
+ ...isObject(enableReact) && enableReact.overrides
1345
1070
  }
1346
1071
  });
1347
1072
  if (compiler && eslintPluginReact) config.push({
@@ -1363,7 +1088,7 @@ const react = async (options = {}) => {
1363
1088
  "react-hooks/unsupported-syntax": "error",
1364
1089
  "react-hooks/use-memo": "warn",
1365
1090
  ...overrides,
1366
- ...isObject$1(compiler) && compiler.overrides
1091
+ ...isObject(compiler) && compiler.overrides
1367
1092
  }
1368
1093
  });
1369
1094
  if (refresh && eslintPluginReactRefresh) config.push({
@@ -1373,10 +1098,10 @@ const react = async (options = {}) => {
1373
1098
  rules: {
1374
1099
  "react-refresh/only-export-components": ["warn", {
1375
1100
  allowConstantExport: isAllowConstantExport,
1376
- allowExportNames: [...nextjs ? allowedNextJsExportNames : [], ...isUsingReactRouter ? allowedReactRouterExportNames : []]
1101
+ allowExportNames: [...nextjs ? getDefaultAllowedNextJsExportNames() : [], ...isUsingReactRouter ? getDefaultAllowedReactRouterExportNames() : []]
1377
1102
  }],
1378
1103
  ...overrides,
1379
- ...isObject$1(refresh) && refresh.overrides
1104
+ ...isObject(refresh) && refresh.overrides
1380
1105
  }
1381
1106
  });
1382
1107
  if (youMightNotNeedAnEffect && eslintPluginReactYouMightNotNeedAnEffect) config.push({
@@ -1389,7 +1114,7 @@ const react = async (options = {}) => {
1389
1114
  name: "zayne/react/you-might-not-need-an-effect/rules",
1390
1115
  rules: {
1391
1116
  ...overrides,
1392
- ...isObject$1(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides
1117
+ ...isObject(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides
1393
1118
  }
1394
1119
  });
1395
1120
  if (nextjs && eslintPluginNextjs) config.push({
@@ -1399,13 +1124,13 @@ const react = async (options = {}) => {
1399
1124
  rules: renameRules({
1400
1125
  ...eslintPluginNextjs.configs?.recommended?.rules,
1401
1126
  ...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
1402
- }, defaultPluginRenameMap)
1127
+ }, getDefaultPluginRenameMap())
1403
1128
  }, {
1404
1129
  files,
1405
1130
  name: "zayne/react/nextjs/rules",
1406
1131
  rules: {
1407
1132
  ...overrides,
1408
- ...isObject$1(nextjs) && nextjs.overrides
1133
+ ...isObject(nextjs) && nextjs.overrides
1409
1134
  }
1410
1135
  });
1411
1136
  return config;
@@ -1706,6 +1431,7 @@ const tailwindcssBetter = async (options = {}) => {
1706
1431
  const { overrides, settings: tailwindCssBetterSettings } = options;
1707
1432
  await ensurePackages(["eslint-plugin-better-tailwindcss"]);
1708
1433
  const [eslintPluginBetterTailwindCss, defaults] = await Promise.all([interopDefault(import("eslint-plugin-better-tailwindcss")), interopDefault(import("eslint-plugin-better-tailwindcss/api/defaults"))]);
1434
+ const zayneDefaultSettings = getDefaultTailwindcssBetterSettings();
1709
1435
  return [
1710
1436
  {
1711
1437
  name: "zayne/tailwindcss-better/setup",
@@ -1714,21 +1440,20 @@ const tailwindcssBetter = async (options = {}) => {
1714
1440
  ...tailwindCssBetterSettings,
1715
1441
  attributes: [
1716
1442
  ...defaults.getDefaultAttributes(),
1717
- "^class(Name|Names)?$",
1718
- tailwindCssBetterSettings?.attributes
1443
+ ...zayneDefaultSettings.attributes,
1444
+ ...tailwindCssBetterSettings?.attributes ?? []
1719
1445
  ],
1720
1446
  callees: [
1721
1447
  ...defaults.getDefaultCallees(),
1722
- "cnMerge",
1723
- "cnJoin",
1724
- tailwindCssBetterSettings?.callees
1448
+ ...zayneDefaultSettings.callees,
1449
+ ...tailwindCssBetterSettings?.callees ?? []
1725
1450
  ],
1726
1451
  entryPoint: tailwindCssBetterSettings?.entryPoint ?? `${process.cwd()}/tailwind.css`
1727
1452
  } }
1728
1453
  },
1729
1454
  {
1730
1455
  name: "zayne/tailwindcss-better/recommended",
1731
- rules: renameRules(eslintPluginBetterTailwindCss.configs.recommended?.rules, defaultPluginRenameMap)
1456
+ rules: renameRules(eslintPluginBetterTailwindCss.configs.recommended?.rules, getDefaultPluginRenameMap())
1732
1457
  },
1733
1458
  {
1734
1459
  name: "zayne/tailwindcss-better/rules",
@@ -1761,23 +1486,23 @@ const tanstack = async (options = {}) => {
1761
1486
  if (query && eslintPluginTanstackQuery) config.push({
1762
1487
  name: "zayne/tanstack-query/recommended",
1763
1488
  plugins: { "tanstack-query": eslintPluginTanstackQuery },
1764
- rules: renameRules(eslintPluginTanstackQuery.configs["flat/recommended"][0]?.rules, defaultPluginRenameMap)
1489
+ rules: renameRules(eslintPluginTanstackQuery.configs["flat/recommended"][0]?.rules, getDefaultPluginRenameMap())
1765
1490
  }, {
1766
1491
  name: "zayne/tanstack-query/rules",
1767
1492
  rules: {
1768
1493
  ...overrides,
1769
- ...isObject(query) && query.overrides
1494
+ ...isObject$1(query) && query.overrides
1770
1495
  }
1771
1496
  });
1772
1497
  if (router && eslintPluginTanstackRouter) config.push({
1773
1498
  name: "zayne/tanstack-router/recommended",
1774
1499
  plugins: { "tanstack-router": eslintPluginTanstackRouter },
1775
- rules: renameRules(eslintPluginTanstackRouter.configs["flat/recommended"][0]?.rules, defaultPluginRenameMap)
1500
+ rules: renameRules(eslintPluginTanstackRouter.configs["flat/recommended"][0]?.rules, getDefaultPluginRenameMap())
1776
1501
  }, {
1777
1502
  name: "zayne/tanstack-router/rules",
1778
1503
  rules: {
1779
1504
  ...overrides,
1780
- ...isObject(router) && router.overrides
1505
+ ...isObject$1(router) && router.overrides
1781
1506
  }
1782
1507
  });
1783
1508
  return config;
@@ -1865,7 +1590,7 @@ const typescript = async (options = {}) => {
1865
1590
  ...parserOptions
1866
1591
  }
1867
1592
  },
1868
- name: `zayne/typescript/${typeAware ? "parser-type-aware" : "parser"}`
1593
+ name: `zayne/ts-eslint/${typeAware ? "parser-type-aware" : "parser"}`
1869
1594
  };
1870
1595
  };
1871
1596
  const recommendedRules = tsEslint.configs[isTypeAware ? "strictTypeChecked" : "strict"].map((config) => config.rules).reduce((accumulator, rules) => ({
@@ -1886,23 +1611,18 @@ const typescript = async (options = {}) => {
1886
1611
  files: isTypeAware ? filesTypeAware : files,
1887
1612
  ignores: isTypeAware ? ignoresTypeAware : [],
1888
1613
  name: `zayne/ts-eslint/recommended-${isTypeAware ? "strict-type-checked" : "strict"}`,
1889
- rules: renameRules(recommendedRules, defaultPluginRenameMap)
1614
+ rules: renameRules(recommendedRules, getDefaultPluginRenameMap())
1890
1615
  },
1891
1616
  ...stylistic$1 ? [{
1892
1617
  files: isTypeAware ? filesTypeAware : files,
1893
1618
  ignores: isTypeAware ? ignoresTypeAware : [],
1894
1619
  name: `zayne/ts-eslint/recommended-${isTypeAware ? "stylistic-type-checked" : "stylistic"}`,
1895
- rules: renameRules(recommendedStylisticRules, defaultPluginRenameMap)
1896
- }] : [],
1897
- ...erasableOnly ? [{
1898
- name: "zayne/typescript/erasable-syntax-only/recommended",
1899
- plugins: { "erasable-syntax-only": eslintPluginErasableOnly },
1900
- rules: eslintPluginErasableOnly?.configs.recommended.rules
1620
+ rules: renameRules(recommendedStylisticRules, getDefaultPluginRenameMap())
1901
1621
  }] : [],
1902
1622
  {
1903
1623
  files: isTypeAware ? filesTypeAware : files,
1904
1624
  ignores: isTypeAware ? ignoresTypeAware : [],
1905
- name: `zayne/ts-eslint/${isTypeAware ? "rules-type-checked" : "rules"}`,
1625
+ name: `zayne/ts-eslint/rules${isTypeAware ? "-type-checked" : ""}`,
1906
1626
  rules: {
1907
1627
  "ts-eslint/array-type": ["error", { default: "array-simple" }],
1908
1628
  "ts-eslint/consistent-type-definitions": ["error", "type"],
@@ -1947,7 +1667,12 @@ const typescript = async (options = {}) => {
1947
1667
  },
1948
1668
  ...overrides
1949
1669
  }
1950
- }
1670
+ },
1671
+ ...erasableOnly ? [{
1672
+ name: "zayne/ts-eslint/erasable-syntax-only/recommended",
1673
+ plugins: { "erasable-syntax-only": eslintPluginErasableOnly },
1674
+ rules: eslintPluginErasableOnly?.configs.recommended.rules
1675
+ }] : []
1951
1676
  ];
1952
1677
  };
1953
1678
 
@@ -2214,6 +1939,25 @@ const yaml = async (options = {}) => {
2214
1939
  ];
2215
1940
  };
2216
1941
 
1942
+ //#endregion
1943
+ //#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
1944
+ const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
1945
+ function findUpSync(name, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
1946
+ let directory = path.resolve(toPath(cwd) ?? "");
1947
+ const { root } = path.parse(directory);
1948
+ stopAt = path.resolve(directory, toPath(stopAt) ?? root);
1949
+ const isAbsoluteName = path.isAbsolute(name);
1950
+ while (directory) {
1951
+ const filePath = isAbsoluteName ? name : path.join(directory, name);
1952
+ try {
1953
+ const stats = fs.statSync(filePath, { throwIfNoEntry: false });
1954
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
1955
+ } catch {}
1956
+ if (directory === stopAt || directory === root) break;
1957
+ directory = path.dirname(directory);
1958
+ }
1959
+ }
1960
+
2217
1961
  //#endregion
2218
1962
  //#region src/factory.ts
2219
1963
  const ReactPackages = ["react", "react-dom"];
@@ -2233,7 +1977,6 @@ const zayne = (options = {}, ...userConfigs) => {
2233
1977
  const enableComments = restOfOptions.comments ?? withDefaults;
2234
1978
  const enableImports = restOfOptions.imports ?? withDefaults;
2235
1979
  const enableJsdoc = restOfOptions.jsdoc ?? withDefaults;
2236
- const enablePnpmCatalogs = restOfOptions.pnpm;
2237
1980
  const enableJsonc = restOfOptions.jsonc ?? withDefaults;
2238
1981
  const enableNode = restOfOptions.node ?? withDefaults;
2239
1982
  const enablePerfectionist = restOfOptions.perfectionist ?? withDefaults;
@@ -2244,8 +1987,9 @@ const zayne = (options = {}, ...userConfigs) => {
2244
1987
  const enableUnicorn = restOfOptions.unicorn ?? withDefaults;
2245
1988
  const enableYaml = restOfOptions.yaml ?? withDefaults;
2246
1989
  const enableMarkdown = restOfOptions.markdown ?? withDefaults;
1990
+ const enablePnpmCatalogs = restOfOptions.pnpm ?? (withDefaults && Boolean(findUpSync("pnpm-workspace.yaml")));
2247
1991
  const isStylistic = Boolean(enableStylistic);
2248
- const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : enableTypeScript === true ? enableTypeScript : null;
1992
+ const tsconfigPath = isObject$1(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : enableTypeScript === true ? enableTypeScript : null;
2249
1993
  const isTypeAware = Boolean(tsconfigPath);
2250
1994
  const configs = [ignores(userIgnores), javascript(restOfOptions.javascript)];
2251
1995
  if (enableGitignore) configs.push(gitIgnores(resolveOptions(enableGitignore)));
@@ -2289,10 +2033,7 @@ const zayne = (options = {}, ...userConfigs) => {
2289
2033
  type,
2290
2034
  ...resolveOptions(enableUnicorn)
2291
2035
  }));
2292
- if (enableJsonc) configs.push(jsonc({
2293
- stylistic: isStylistic,
2294
- ...resolveOptions(enableJsonc)
2295
- }), sortPackageJson(), sortTsconfig());
2036
+ if (enableJsonc) configs.push(jsonc(resolveOptions(enableJsonc)), sortPackageJson(), sortTsconfig());
2296
2037
  if (enableJsdoc) configs.push(jsdoc({
2297
2038
  stylistic: isStylistic,
2298
2039
  ...resolveOptions(enableJsdoc)
@@ -2331,9 +2072,9 @@ const zayne = (options = {}, ...userConfigs) => {
2331
2072
  if (restOfOptions.tanstack) configs.push(tanstack(resolveOptions(restOfOptions.tanstack)));
2332
2073
  if (restOfOptions.depend) configs.push(depend(resolveOptions(restOfOptions.depend)));
2333
2074
  assert(!("files" in restOfOptions), `[@zayne-labs/eslint-config]: The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second config array instead.`);
2334
- return new FlatConfigComposer().append(...configs, ...userConfigs).renamePlugins(autoRenamePlugins ? defaultPluginRenameMap : {});
2075
+ return new FlatConfigComposer().append(...configs, ...userConfigs).renamePlugins(autoRenamePlugins ? getDefaultPluginRenameMap() : {});
2335
2076
  };
2336
2077
 
2337
2078
  //#endregion
2338
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_MARKDOWN_JSON, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, allowedNextJsExportNames, allowedReactRouterExportNames, astro, combine, comments, defaultPluginRenameMap, depend, ensurePackages, expo, gitIgnores, ignores, imports, interopDefault, isObject, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, node, overrideConfigs, parserPlain, perfectionist, pnpm, react, renamePluginInConfigs, renamePlugins, renameRules, resolveOptions, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcssBetter, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
2079
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_MARKDOWN_JSON, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLES, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, astro, comments, depend, expo, gitIgnores, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, node, perfectionist, pnpm, react, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcssBetter, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
2339
2080
  //# sourceMappingURL=index.js.map