@zayne-labs/eslint-config 0.13.13 → 0.13.15

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
@@ -5,7 +5,7 @@ import { isPackageExists } from "local-pkg";
5
5
  import { globalIgnores } from "eslint/config";
6
6
  import globals from "globals";
7
7
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
8
- import { pickKeys } from "@zayne-labs/toolkit-core";
8
+ import { deepCompare, omitKeys, pickKeys } from "@zayne-labs/toolkit-core";
9
9
  import { FlatConfigComposer } from "eslint-flat-config-utils";
10
10
  import { findUpSync } from "find-up-simple";
11
11
  //#region src/globs.ts
@@ -139,6 +139,50 @@ const astro = async (options = {}) => {
139
139
  ];
140
140
  };
141
141
  //#endregion
142
+ //#region src/configs/baseline.ts
143
+ const baseline = async (options = {}) => {
144
+ const { available = "widely", env, files = [GLOB_JS, GLOB_JSX], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], level = "warn", overrides, overridesTypeAware, typescript = false } = options;
145
+ const eslintPluginBaseline = await interopDefault(import("eslint-plugin-baseline-js"));
146
+ const recommendedRules = eslintPluginBaseline.configs.recommended({
147
+ available,
148
+ env,
149
+ level
150
+ }).rules;
151
+ const recommendedTypeAwareRules = typescript ? eslintPluginBaseline.configs["recommended-ts"]({
152
+ available,
153
+ env,
154
+ level
155
+ }).rules : void 0;
156
+ return [
157
+ {
158
+ name: "zayne/baseline/setup",
159
+ plugins: { "baseline-js": eslintPluginBaseline }
160
+ },
161
+ {
162
+ files: typescript ? files : [...files, ...filesTypeAware],
163
+ name: "zayne/baseline/recommended",
164
+ rules: recommendedRules
165
+ },
166
+ ...typescript ? [{
167
+ files: filesTypeAware,
168
+ ignores: ignoresTypeAware,
169
+ name: "zayne/baseline/recommended-type-aware",
170
+ rules: recommendedTypeAwareRules
171
+ }] : [],
172
+ {
173
+ files: [...files, ...filesTypeAware],
174
+ name: "zayne/baseline/rules",
175
+ rules: { ...overrides }
176
+ },
177
+ ...typescript && overridesTypeAware ? [{
178
+ files: filesTypeAware,
179
+ ignores: ignoresTypeAware,
180
+ name: "zayne/baseline/rules-type-aware",
181
+ rules: overridesTypeAware
182
+ }] : []
183
+ ];
184
+ };
185
+ //#endregion
142
186
  //#region src/configs/command.ts
143
187
  const command = async () => {
144
188
  return [{
@@ -201,8 +245,9 @@ const depend = async (options = {}) => {
201
245
  const expo = async (options = {}) => {
202
246
  const { overrides } = options;
203
247
  await ensurePackages(["eslint-config-expo"]);
248
+ const eslintConfigExpo = await interopDefault(import("eslint-config-expo/flat/utils/expo.js"));
204
249
  return [...overrideConfigs({
205
- configArray: await interopDefault(import("eslint-config-expo/flat/utils/expo.js")),
250
+ configArray: eslintConfigExpo,
206
251
  overrides: { name: "zayne/expo/recommended" }
207
252
  }), {
208
253
  name: "zayne/expo/rules",
@@ -840,7 +885,7 @@ const perfectionist = async (options = {}) => {
840
885
  //#endregion
841
886
  //#region src/configs/pnpm.ts
842
887
  async function pnpm(options = {}) {
843
- const { catalogs = false, isInEditor = true, json = true, sort = true, yaml = true } = options;
888
+ const { catalogs = false, isInEditor = true, json = true, sort = true, stylistic = true, yaml = true } = options;
844
889
  await ensurePackages(["eslint-plugin-pnpm"]);
845
890
  const [eslintPluginPnpm, yamlParser, eslintPluginYaml, jsoncParser] = await Promise.all([
846
891
  interopDefault(import("eslint-plugin-pnpm")),
@@ -870,80 +915,216 @@ async function pnpm(options = {}) {
870
915
  name: "zayne/pnpm/pnpm-workspace-yaml/rules",
871
916
  plugins: { pnpm: eslintPluginPnpm },
872
917
  rules: {
918
+ "pnpm/yaml-enforce-settings": ["error", { settings: { minimumReleaseAgeExcludePrune: true } }],
873
919
  "pnpm/yaml-no-duplicate-catalog-item": "error",
874
920
  "pnpm/yaml-no-unused-catalog-item": "error",
875
921
  ...isObject$1(yaml) && yaml.overrides
876
922
  }
877
923
  });
924
+ if (yaml && stylistic) configs.push({
925
+ files: ["pnpm-workspace.yaml"],
926
+ languageOptions: { parser: yamlParser },
927
+ name: "zayne/pnpm/pnpm-workspace-yaml/stylistic/rules",
928
+ plugins: { pnpm: eslintPluginPnpm },
929
+ rules: {
930
+ "pnpm/yaml-blank-lines": "warn",
931
+ ...isObject$1(yaml) && yaml.overrides
932
+ }
933
+ });
878
934
  if (yaml && sort) configs.push({
879
935
  files: ["pnpm-workspace.yaml"],
880
936
  languageOptions: { parser: yamlParser },
881
- name: "zayne/pnpm/sort/pnpm-workspace-yaml",
937
+ name: "zayne/pnpm/pnpm-workspace-yaml/sort/rules",
882
938
  plugins: { yaml: eslintPluginYaml },
883
939
  rules: { "yaml/sort-keys": [
884
940
  "error",
885
941
  {
886
942
  order: [
887
943
  ...defineEnum([
888
- "cacheDir",
944
+ "dedupeInjectedDeps",
945
+ "disallowWorkspaceCycles",
946
+ "failIfNoMatch",
947
+ "ignoreWorkspaceCycles",
948
+ "ignoreWorkspaceRootCheck",
949
+ "includeWorkspaceRoot",
950
+ "injectWorkspacePackages",
951
+ "legacyDirFiltering",
952
+ "linkWorkspacePackages",
953
+ "preferWorkspacePackages",
954
+ "saveWorkspaceProtocol",
955
+ "sharedWorkspaceLockfile",
956
+ "syncInjectedDepsAfterScripts"
957
+ ]),
958
+ ...defineEnum([
889
959
  "catalogMode",
890
- "cleanupUnusedCatalogs",
891
- "dedupeDirectDeps",
892
- "deployAllFiles",
893
- "enablePrePostScripts",
894
- "engineStrict",
960
+ "catalogPrune",
961
+ "cleanupUnusedCatalogs"
962
+ ]),
963
+ ...defineEnum([
964
+ "allowedDeprecatedVersions",
965
+ "blockExoticSubdeps",
966
+ "ignoredOptionalDependencies",
967
+ "minimumReleaseAge",
968
+ "minimumReleaseAgeIgnoreMissingTime",
969
+ "minimumReleaseAgeStrict",
970
+ "minimumReleaseAgeExcludePrune",
971
+ "minimumReleaseAgeExclude",
972
+ "registrySupportsTimeField",
973
+ "resolutionMode",
974
+ "supportedArchitectures",
975
+ "trustLockfile",
976
+ "trustPolicy",
977
+ "trustPolicyIgnoreAfter",
978
+ "trustPolicyExclude",
979
+ "update"
980
+ ]),
981
+ ...defineEnum([
982
+ "autoInstallPeers",
983
+ "dedupePeerDependents",
984
+ "dedupePeers",
985
+ "peerDependencyRules",
986
+ "resolvePeersFromWorkspaceRoot",
987
+ "strictPeerDependencies"
988
+ ]),
989
+ ...defineEnum([
990
+ "fetchMinSpeedKiBps",
991
+ "fetchRetries",
992
+ "fetchRetryFactor",
993
+ "fetchRetryMaxtimeout",
994
+ "fetchRetryMintimeout",
995
+ "fetchTimeout",
996
+ "fetchWarnTimeoutMs",
997
+ "gitShallowHosts",
998
+ "httpProxy",
999
+ "httpsProxy",
1000
+ "localAddress",
1001
+ "maxsockets",
1002
+ "namedRegistries",
1003
+ "networkConcurrency",
1004
+ "noProxy",
1005
+ "registries",
1006
+ "registry",
1007
+ "strictSsl"
1008
+ ]),
1009
+ ...defineEnum([
1010
+ "dlxCacheMaxAge",
1011
+ "enableGlobalVirtualStore",
1012
+ "enableModulesDir",
895
1013
  "extendNodePath",
1014
+ "modulesCacheMaxAge",
1015
+ "modulesDir",
1016
+ "nodeExperimentalPackageMap",
1017
+ "nodeLinker",
1018
+ "nodePackageMapType",
1019
+ "packageImportMethod",
1020
+ "preferSymlinkedExecutables",
1021
+ "symlink",
1022
+ "virtualStoreDir",
1023
+ "virtualStoreDirMaxLength",
1024
+ "virtualStoreOnly",
1025
+ "virtualStoreType"
1026
+ ]),
1027
+ ...defineEnum([
896
1028
  "hoist",
1029
+ "hoistingLimits",
897
1030
  "hoistPattern",
898
1031
  "hoistWorkspacePackages",
899
- "ignoreCompatibilityDb",
1032
+ "publicHoistPattern",
1033
+ "shamefullyHoist"
1034
+ ]),
1035
+ ...defineEnum([
1036
+ "frozenStore",
1037
+ "storeDir",
1038
+ "strictStorePkgContentCheck",
1039
+ "useRunningStoreServer",
1040
+ "verifyStoreIntegrity"
1041
+ ]),
1042
+ ...defineEnum([
1043
+ "gitBranchLockfile",
1044
+ "lockfile",
1045
+ "lockfileIncludeTarballUrl",
1046
+ "mergeGitBranchLockfilesBranchPattern",
1047
+ "peersSuffixMaxLength",
1048
+ "preferFrozenLockfile"
1049
+ ]),
1050
+ ...defineEnum([
1051
+ "childConcurrency",
1052
+ "dangerouslyAllowAllBuilds",
1053
+ "enablePrePostScripts",
900
1054
  "ignoreDepScripts",
901
1055
  "ignoreScripts",
902
- "ignoreWorkspaceRootCheck",
1056
+ "nodeOptions",
1057
+ "requiredScripts",
1058
+ "scriptShell",
1059
+ "shellEmulator",
1060
+ "sideEffectsCache",
1061
+ "sideEffectsCacheReadonly",
1062
+ "strictDepBuilds",
1063
+ "unsafePerm",
1064
+ "verifyDepsBeforeRun"
1065
+ ]),
1066
+ ...defineEnum([
903
1067
  "managePackageManagerVersions",
904
- "minimumReleaseAge",
905
- "minimumReleaseAgeExclude",
906
- "modulesDir",
907
- "nodeLinker",
1068
+ "nodeDownloadMirrors",
908
1069
  "nodeVersion",
909
- "optimisticRepeatInstall",
910
1070
  "packageManagerStrict",
911
1071
  "packageManagerStrictVersion",
912
- "preferSymlinkedExecutables",
913
- "preferWorkspacePackages",
914
- "publicHoistPattern",
915
- "registrySupportsTimeField",
916
- "requiredScripts",
917
- "resolutionMode",
1072
+ "pmOnFail",
1073
+ "runtimeOnFail"
1074
+ ]),
1075
+ ...defineEnum([
1076
+ "ci",
1077
+ "color",
1078
+ "engineStrict",
1079
+ "loglevel",
1080
+ "npmPath",
1081
+ "recursiveInstall",
1082
+ "updateNotifier",
1083
+ "useBetaCli",
1084
+ "useStderr"
1085
+ ]),
1086
+ ...defineEnum([
1087
+ "cacheDir",
1088
+ "globalBinDir",
1089
+ "globalDir",
1090
+ "globalPnpmfile",
1091
+ "globalShims",
1092
+ "ignorePnpmfile",
1093
+ "npmrcAuthFile",
1094
+ "pnpmfile",
1095
+ "stateDir"
1096
+ ]),
1097
+ ...defineEnum(["audit", "versioning"]),
1098
+ ...defineEnum([
1099
+ "allowNonAppliedPatches",
1100
+ "dedupeDirectDeps",
1101
+ "deployAllFiles",
1102
+ "ignoreCompatibilityDb",
1103
+ "initAuthorEmail",
1104
+ "initAuthorName",
1105
+ "initAuthorUrl",
1106
+ "initLicense",
1107
+ "initVersion",
1108
+ "optimisticRepeatInstall",
1109
+ "saveExact",
918
1110
  "savePrefix",
919
- "scriptShell",
920
- "shamefullyHoist",
921
- "shellEmulator",
922
- "stateDir",
923
- "supportedArchitectures",
924
- "symlink",
925
- "tag",
926
- "trustPolicy",
927
- "trustPolicyExclude",
928
- "updateNotifier"
1111
+ "tag"
929
1112
  ]),
930
1113
  "packages",
1114
+ "packageConfigs",
931
1115
  "overrides",
1116
+ "packageExtensions",
932
1117
  "patchedDependencies",
933
- "catalog",
934
- "catalogs",
1118
+ "configDependencies",
1119
+ "allowBuilds",
935
1120
  ...defineEnum([
936
- "allowedDeprecatedVersions",
937
- "allowNonAppliedPatches",
938
- "configDependencies",
939
1121
  "ignoredBuiltDependencies",
940
- "ignoredOptionalDependencies",
941
1122
  "neverBuiltDependencies",
942
1123
  "onlyBuiltDependencies",
943
- "onlyBuiltDependenciesFile",
944
- "packageExtensions",
945
- "peerDependencyRules"
946
- ])
1124
+ "onlyBuiltDependenciesFile"
1125
+ ]),
1126
+ "catalog",
1127
+ "catalogs"
947
1128
  ],
948
1129
  pathPattern: "^$"
949
1130
  },
@@ -964,13 +1145,12 @@ const ReactRouterPackages = [
964
1145
  "@react-router/serve",
965
1146
  "@react-router/dev"
966
1147
  ];
967
- const NextJsPackages = ["next"];
968
- const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
969
- const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
970
- const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
1148
+ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((item) => isPackageExists(item));
1149
+ const isUsingReactRouter = ReactRouterPackages.some((item) => isPackageExists(item));
971
1150
  let eslintPluginReactPlugins;
972
1151
  const react = async (options = {}) => {
973
- const { compiler = true, files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], nextjs = isUsingNext, overrides, react: enableReact = true, refresh = true, typescript = true, youMightNotNeedAnEffect = true } = options;
1152
+ const { compiler = true, files = [GLOB_JS, GLOB_JSX], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], nextjs = false, overrides, overridesTypeAware, react: enableReact = true, refresh = true, typescript = true, youMightNotNeedAnEffect = true } = options;
1153
+ const allFiles = [...files, ...filesTypeAware];
974
1154
  await ensurePackages([
975
1155
  enableReact ? "@eslint-react/eslint-plugin" : void 0,
976
1156
  enableReact ? "eslint-plugin-react-hooks" : void 0,
@@ -980,14 +1160,15 @@ const react = async (options = {}) => {
980
1160
  ]);
981
1161
  const [eslintPluginReact, eslintPluginCustomJsxRules, eslintReactHooks, eslintPluginReactRefresh, eslintPluginReactYouMightNotNeedAnEffect, eslintPluginNextjs] = await Promise.all([
982
1162
  enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
983
- enableReact ? interopDefault(import("./jsxRules-BAjKnxGs.js")) : void 0,
1163
+ enableReact ? interopDefault(import("./jsxRules-DR1G9lbZ.js")) : void 0,
984
1164
  enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
985
1165
  refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
986
1166
  youMightNotNeedAnEffect ? interopDefault(import("eslint-plugin-react-you-might-not-need-an-effect")) : void 0,
987
1167
  nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
988
1168
  ]);
989
- const strictReactConfigKey = typescript ? "strict-type-checked" : "strict";
990
- const strictUnofficialReactConfig = eslintPluginReact?.configs[strictReactConfigKey];
1169
+ const strictUnofficialReactConfig = eslintPluginReact?.configs.strict;
1170
+ const strictTypeCheckedUnofficialReactConfig = typescript ? eslintPluginReact?.configs["strict-type-checked"] : void 0;
1171
+ const strictTypeCheckedOnlyRules = strictTypeCheckedUnofficialReactConfig ? omitKeys(strictTypeCheckedUnofficialReactConfig.rules ?? {}, Object.keys(strictUnofficialReactConfig?.rules ?? {})) : void 0;
991
1172
  const getMergedReactPlugin = () => {
992
1173
  if (eslintPluginReactPlugins) return eslintPluginReactPlugins;
993
1174
  eslintPluginReactPlugins = renamePlugins(strictUnofficialReactConfig?.plugins, getDefaultPluginRenameMap());
@@ -1011,20 +1192,24 @@ const react = async (options = {}) => {
1011
1192
  }
1012
1193
  }];
1013
1194
  if (enableReact && strictUnofficialReactConfig && eslintReactHooks) config.push({
1014
- files,
1195
+ files: allFiles,
1015
1196
  name: "zayne/react/official/rules",
1016
1197
  rules: {
1017
1198
  "react-hooks/exhaustive-deps": "off",
1018
1199
  "react-hooks/rules-of-hooks": "off"
1019
1200
  }
1020
1201
  }, {
1021
- files: typescript ? filesTypeAware : files,
1022
- ...typescript && { ignores: ignoresTypeAware },
1023
- name: `zayne/react/unofficial/${strictReactConfigKey}`,
1202
+ files: allFiles,
1203
+ name: "zayne/react/unofficial/strict",
1024
1204
  rules: renameRules(strictUnofficialReactConfig.rules, getDefaultPluginRenameMap()),
1025
1205
  settings: strictUnofficialReactConfig.settings
1026
- }, {
1027
- files,
1206
+ }, ...typescript && strictTypeCheckedUnofficialReactConfig ? [{
1207
+ files: filesTypeAware,
1208
+ ignores: ignoresTypeAware,
1209
+ name: "zayne/react/unofficial/strict-type-checked",
1210
+ rules: renameRules(strictTypeCheckedOnlyRules, getDefaultPluginRenameMap())
1211
+ }] : [], {
1212
+ files: allFiles,
1028
1213
  name: "zayne/react/unofficial/rules",
1029
1214
  rules: {
1030
1215
  "react/globals": "error",
@@ -1037,12 +1222,11 @@ const react = async (options = {}) => {
1037
1222
  "react/refs": "error",
1038
1223
  "react/exhaustive-deps": "warn",
1039
1224
  "react/rules-of-hooks": "error",
1040
- ...overrides,
1041
1225
  ...isObject(enableReact) && enableReact.overrides
1042
1226
  }
1043
1227
  });
1044
1228
  if (compiler && eslintPluginReact) config.push({
1045
- files,
1229
+ files: allFiles,
1046
1230
  name: "zayne/react/official/compiler/rules",
1047
1231
  rules: {
1048
1232
  "react-hooks/capitalized-calls": "error",
@@ -1065,75 +1249,108 @@ const react = async (options = {}) => {
1065
1249
  "react-hooks/todo": "warn",
1066
1250
  "react-hooks/unsupported-syntax": "warn",
1067
1251
  "react-hooks/use-memo": "warn",
1068
- ...overrides,
1069
1252
  ...isObject(compiler) && compiler.overrides
1070
1253
  }
1071
1254
  });
1072
1255
  if (refresh && eslintPluginReactRefresh) config.push({
1073
- files: isObject(refresh) && refresh.files ? refresh.files : files,
1256
+ files: isObject(refresh) && refresh.files ? refresh.files : allFiles,
1074
1257
  name: "zayne/react/refresh/rules",
1075
1258
  rules: {
1076
1259
  "react-refresh/only-export-components": ["warn", {
1077
1260
  allowConstantExport: isAllowConstantExport,
1078
1261
  allowExportNames: [...nextjs ? getDefaultAllowedNextJsExportNames() : [], ...isUsingReactRouter ? getDefaultAllowedReactRouterExportNames() : []]
1079
1262
  }],
1080
- ...overrides,
1081
1263
  ...isObject(refresh) && refresh.overrides
1082
1264
  }
1083
1265
  });
1084
1266
  if (youMightNotNeedAnEffect && eslintPluginReactYouMightNotNeedAnEffect) config.push({
1085
- files,
1267
+ files: allFiles,
1086
1268
  name: "zayne/react/you-might-not-need-an-effect/recommended",
1087
1269
  rules: eslintPluginReactYouMightNotNeedAnEffect.configs.recommended.rules
1088
1270
  }, {
1089
- files,
1271
+ files: allFiles,
1090
1272
  name: "zayne/react/you-might-not-need-an-effect/rules",
1091
- rules: {
1092
- ...overrides,
1093
- ...isObject(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides
1094
- }
1273
+ rules: { ...isObject(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides }
1095
1274
  });
1096
1275
  if (nextjs && eslintPluginNextjs) config.push({
1097
- files: isObject(nextjs) && nextjs.files ? nextjs.files : files,
1276
+ files: isObject(nextjs) && nextjs.files ? nextjs.files : allFiles,
1098
1277
  name: "zayne/react/nextjs/recommended",
1099
1278
  rules: renameRules({
1100
1279
  ...eslintPluginNextjs.configs?.recommended?.rules,
1101
1280
  ...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
1102
1281
  }, getDefaultPluginRenameMap())
1103
1282
  }, {
1104
- files: isObject(nextjs) && nextjs.files ? nextjs.files : files,
1283
+ files: isObject(nextjs) && nextjs.files ? nextjs.files : allFiles,
1105
1284
  name: "zayne/react/nextjs/rules",
1106
- rules: {
1107
- ...overrides,
1108
- ...isObject(nextjs) && nextjs.overrides
1109
- }
1285
+ rules: { ...isObject(nextjs) && nextjs.overrides }
1110
1286
  });
1287
+ config.push({
1288
+ files: allFiles,
1289
+ name: "zayne/react/rules",
1290
+ rules: { ...overrides }
1291
+ }, ...typescript && overridesTypeAware ? [{
1292
+ files: filesTypeAware,
1293
+ ignores: ignoresTypeAware,
1294
+ name: "zayne/react/unofficial/rules-type-aware",
1295
+ rules: overridesTypeAware
1296
+ }] : []);
1111
1297
  return config;
1112
1298
  };
1113
1299
  //#endregion
1300
+ //#region src/configs/regexp.ts
1301
+ const regexp = async (options = {}) => {
1302
+ const { level = "warn", overrides, settings: regexpSettings } = options;
1303
+ const eslintPluginRegexp = await interopDefault(import("eslint-plugin-regexp"));
1304
+ const recommendedRules = Object.fromEntries(Object.entries(eslintPluginRegexp.configs["flat/recommended"].rules).map(([ruleName, ruleConfig]) => [ruleName, level === "warn" && ruleConfig === "error" ? "warn" : ruleConfig]));
1305
+ return [
1306
+ {
1307
+ name: "zayne/regexp/setup",
1308
+ plugins: { regexp: eslintPluginRegexp }
1309
+ },
1310
+ {
1311
+ name: "zayne/regexp/recommended",
1312
+ rules: recommendedRules
1313
+ },
1314
+ {
1315
+ name: "zayne/regexp/rules",
1316
+ rules: { ...overrides },
1317
+ ...regexpSettings && { settings: { regexp: regexpSettings } }
1318
+ }
1319
+ ];
1320
+ };
1321
+ //#endregion
1114
1322
  //#region src/configs/solid.ts
1115
1323
  const solid = async (options = {}) => {
1116
- const { files = [GLOB_SRC], overrides, typescript = true } = options;
1324
+ const { files = [GLOB_JS, GLOB_JSX], filesTypeAware = [GLOB_TS, GLOB_TSX], overrides, typescript = true } = options;
1117
1325
  await ensurePackages(["eslint-plugin-solid"]);
1118
1326
  const eslintPluginSolid = await interopDefault(import("eslint-plugin-solid"));
1119
- const recommendedSolidConfig = eslintPluginSolid.configs[typescript ? "flat/typescript" : "flat/recommended"];
1327
+ const recommendedRules = eslintPluginSolid.configs["flat/recommended"].rules;
1328
+ const recommendedTypeScriptRules = typescript ? eslintPluginSolid.configs["flat/typescript"].rules : void 0;
1329
+ const recommendedTypeScriptSpecificRules = recommendedTypeScriptRules ? omitKeys(recommendedTypeScriptRules, Object.entries(recommendedTypeScriptRules).flatMap(([ruleName, ruleConfig]) => deepCompare(recommendedRules?.[ruleName], ruleConfig) ? [ruleName] : [])) : void 0;
1330
+ const allFiles = [...files, ...filesTypeAware];
1120
1331
  return [
1121
1332
  {
1122
1333
  name: "zayne/solid/setup",
1123
1334
  plugins: { solid: eslintPluginSolid }
1124
1335
  },
1125
1336
  {
1126
- files,
1337
+ files: allFiles,
1127
1338
  name: "zayne/solid/recommended",
1128
- rules: recommendedSolidConfig.rules
1339
+ rules: recommendedRules
1129
1340
  },
1341
+ ...typescript ? [{
1342
+ files: filesTypeAware,
1343
+ name: "zayne/solid/recommended-typescript",
1344
+ rules: recommendedTypeScriptSpecificRules
1345
+ }] : [],
1130
1346
  {
1347
+ files: allFiles,
1131
1348
  name: "zayne/solid/rules",
1132
1349
  rules: {
1133
1350
  "solid/no-innerhtml": ["error", { allowStatic: true }],
1134
- "solid/style-prop": ["error", { styleProps: ["style", "css"] }]
1135
- },
1136
- ...overrides
1351
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
1352
+ ...overrides
1353
+ }
1137
1354
  }
1138
1355
  ];
1139
1356
  };
@@ -1174,6 +1391,7 @@ const sortPackageJson = () => [{
1174
1391
  "keywords",
1175
1392
  "categories",
1176
1393
  "sideEffects",
1394
+ "imports",
1177
1395
  "exports",
1178
1396
  "main",
1179
1397
  "module",
@@ -1188,6 +1406,7 @@ const sortPackageJson = () => [{
1188
1406
  "activationEvents",
1189
1407
  "contributes",
1190
1408
  "scripts",
1409
+ "scripts-info",
1191
1410
  "peerDependencies",
1192
1411
  "peerDependenciesMeta",
1193
1412
  "dependencies",
@@ -1207,10 +1426,6 @@ const sortPackageJson = () => [{
1207
1426
  order: { type: "asc" },
1208
1427
  pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
1209
1428
  },
1210
- {
1211
- order: { type: "asc" },
1212
- pathPattern: "scripts"
1213
- },
1214
1429
  {
1215
1430
  order: { type: "asc" },
1216
1431
  pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
@@ -1291,6 +1506,7 @@ const sortTsconfig = () => [{
1291
1506
  "useDefineForClassFields",
1292
1507
  "emitDecoratorMetadata",
1293
1508
  "experimentalDecorators",
1509
+ "libReplacement",
1294
1510
  "baseUrl",
1295
1511
  "rootDir",
1296
1512
  "rootDirs",
@@ -1360,6 +1576,7 @@ const sortTsconfig = () => [{
1360
1576
  "isolatedModules",
1361
1577
  "preserveSymlinks",
1362
1578
  "verbatimModuleSyntax",
1579
+ "erasableSyntaxOnly",
1363
1580
  "skipDefaultLibCheck",
1364
1581
  "skipLibCheck"
1365
1582
  ],
@@ -1521,10 +1738,10 @@ const typescript = async (options = {}) => {
1521
1738
  GLOB_TS,
1522
1739
  GLOB_TSX,
1523
1740
  ...componentExtsTypeAware.map((ext) => `**/*.${ext}`)
1524
- ], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], isInEditor = true, tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides, parserOptions, stylistic = true } = options;
1741
+ ], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], isInEditor = true, tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides, overridesTypeAware, parserOptions, stylistic = true } = options;
1525
1742
  await ensurePackages([erasableOnly ? "eslint-plugin-erasable-syntax-only" : void 0]);
1526
1743
  const [tsEslint, eslintPluginErasableOnly] = await Promise.all([interopDefault(import("typescript-eslint")), erasableOnly ? interopDefault(import("eslint-plugin-erasable-syntax-only")) : void 0]);
1527
- const makeParser = (typeAware, parsedFiles, ignores) => {
1744
+ const makeParser = (isInnerTypeAware, parsedFiles, ignores) => {
1528
1745
  return {
1529
1746
  files: parsedFiles,
1530
1747
  ...ignores && { ignores },
@@ -1533,7 +1750,7 @@ const typescript = async (options = {}) => {
1533
1750
  parserOptions: {
1534
1751
  extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1535
1752
  sourceType: "module",
1536
- ...typeAware && (allowDefaultProject ? {
1753
+ ...isInnerTypeAware && (allowDefaultProject ? {
1537
1754
  projectService: {
1538
1755
  allowDefaultProject,
1539
1756
  defaultProject: tsconfigPath
@@ -1550,7 +1767,7 @@ const typescript = async (options = {}) => {
1550
1767
  ...parserOptions
1551
1768
  }
1552
1769
  },
1553
- name: `zayne/ts-eslint/${typeAware ? "parser-type-aware" : "parser"}`
1770
+ name: `zayne/ts-eslint/${isInnerTypeAware ? "parser-type-aware" : "parser"}`
1554
1771
  };
1555
1772
  };
1556
1773
  const recommendedRules = tsEslint.configs[isTypeAware ? "strictTypeChecked" : "strict"].map((config) => config.rules).reduce((accumulator, rules) => ({
@@ -1580,9 +1797,8 @@ const typescript = async (options = {}) => {
1580
1797
  rules: renameRules(recommendedStylisticRules, getDefaultPluginRenameMap())
1581
1798
  }] : [],
1582
1799
  {
1583
- files: isTypeAware ? filesTypeAware : files,
1584
- ignores: isTypeAware ? ignoresTypeAware : [],
1585
- name: `zayne/ts-eslint/rules${isTypeAware ? "-type-checked" : ""}`,
1800
+ files,
1801
+ name: `zayne/ts-eslint/rules`,
1586
1802
  rules: {
1587
1803
  "ts-eslint/array-type": ["error", { default: "array-simple" }],
1588
1804
  "ts-eslint/consistent-type-definitions": ["error", "type"],
@@ -1614,25 +1830,31 @@ const typescript = async (options = {}) => {
1614
1830
  "ts-eslint/no-use-before-define": "off",
1615
1831
  "ts-eslint/no-useless-constructor": "error",
1616
1832
  "ts-eslint/no-useless-empty-export": "error",
1617
- ...isTypeAware && {
1618
- "ts-eslint/no-unnecessary-type-conversion": "error",
1619
- "ts-eslint/no-unnecessary-type-parameters": "off",
1620
- "ts-eslint/non-nullable-type-assertion-style": "off",
1621
- "ts-eslint/prefer-nullish-coalescing": ["error", { ignoreConditionalTests: true }],
1622
- "ts-eslint/restrict-template-expressions": ["error", {
1623
- allowAny: false,
1624
- allowArray: false,
1625
- allowBoolean: true,
1626
- allowNever: true,
1627
- allowNullish: true,
1628
- allowNumber: true,
1629
- allowRegExp: false
1630
- }],
1631
- "ts-eslint/return-await": ["error", "in-try-catch"]
1632
- },
1633
1833
  ...overrides
1634
1834
  }
1635
1835
  },
1836
+ ...isTypeAware ? [{
1837
+ files: filesTypeAware,
1838
+ ignores: ignoresTypeAware,
1839
+ name: "zayne/ts-eslint/rules-type-aware",
1840
+ rules: {
1841
+ "ts-eslint/no-unnecessary-type-conversion": "error",
1842
+ "ts-eslint/no-unnecessary-type-parameters": "off",
1843
+ "ts-eslint/non-nullable-type-assertion-style": "off",
1844
+ "ts-eslint/prefer-nullish-coalescing": ["error", { ignoreConditionalTests: true }],
1845
+ "ts-eslint/restrict-template-expressions": ["error", {
1846
+ allowAny: false,
1847
+ allowArray: false,
1848
+ allowBoolean: true,
1849
+ allowNever: true,
1850
+ allowNullish: true,
1851
+ allowNumber: true,
1852
+ allowRegExp: false
1853
+ }],
1854
+ "ts-eslint/return-await": ["error", "in-try-catch"],
1855
+ ...overridesTypeAware
1856
+ }
1857
+ }] : [],
1636
1858
  ...erasableOnly ? [{
1637
1859
  name: "zayne/ts-eslint/erasable-syntax-only/recommended",
1638
1860
  plugins: { "erasable-syntax-only": eslintPluginErasableOnly },
@@ -1655,6 +1877,7 @@ const unicorn = async (options = {}) => {
1655
1877
  kebabCase: true,
1656
1878
  pascalCase: true
1657
1879
  } }],
1880
+ "unicorn/name-replacements": "off",
1658
1881
  "unicorn/new-for-builtins": "off",
1659
1882
  "unicorn/no-array-for-each": "off",
1660
1883
  "unicorn/no-array-reduce": "off",
@@ -1665,6 +1888,7 @@ const unicorn = async (options = {}) => {
1665
1888
  "unicorn/prefer-global-this": type === "lib" || type === "lib-strict" ? "warn" : "off",
1666
1889
  "unicorn/prefer-native-coercion-functions": "off",
1667
1890
  "unicorn/prevent-abbreviations": "off",
1891
+ "unicorn/single-line-block-comment-style": "off",
1668
1892
  ...overrides
1669
1893
  }
1670
1894
  }];
@@ -1959,6 +2183,7 @@ const zayne = (options = {}, ...userConfigs) => {
1959
2183
  const { autoRenamePlugins = true, componentExts = [], componentExtsTypeAware = [], ignores: userIgnores, type = "app", withDefaults = true, ...restOfOptions } = options;
1960
2184
  const enableGitignore = restOfOptions.gitignore ?? true;
1961
2185
  const enableJsx = restOfOptions.jsx ?? true;
2186
+ const enableBaseline = restOfOptions.baseline ?? withDefaults;
1962
2187
  const enableComments = restOfOptions.comments ?? withDefaults;
1963
2188
  const enableImports = restOfOptions.imports ?? withDefaults;
1964
2189
  const enableJsdoc = restOfOptions.jsdoc ?? withDefaults;
@@ -1966,6 +2191,7 @@ const zayne = (options = {}, ...userConfigs) => {
1966
2191
  const enableNode = restOfOptions.node ?? withDefaults;
1967
2192
  const enablePerfectionist = restOfOptions.perfectionist ?? withDefaults;
1968
2193
  const enableReact = restOfOptions.react ?? (withDefaults && ReactPackages.some((pkg) => isPackageExists(pkg)));
2194
+ const enableRegexp = restOfOptions.regexp ?? withDefaults;
1969
2195
  const enableStylistic = restOfOptions.stylistic ?? withDefaults;
1970
2196
  const enableToml = restOfOptions.toml ?? withDefaults;
1971
2197
  const enableTypeScript = restOfOptions.typescript ?? (withDefaults && isPackageExists("typescript") || isPackageExists("@typescript/native-preview"));
@@ -1976,8 +2202,11 @@ const zayne = (options = {}, ...userConfigs) => {
1976
2202
  const isInEditor = restOfOptions.isInEditor ?? isInEditorEnv();
1977
2203
  if (isInEditor) console.info("[@zayne-labs/eslint-config] Detected running in editor, some rules are disabled.");
1978
2204
  const isStylistic = Boolean(enableStylistic);
1979
- const tsconfigPath = isObject$1(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : enableTypeScript === true ? enableTypeScript : null;
1980
- const isTypeAware = Boolean(tsconfigPath);
2205
+ const typeScriptOptions = resolveOptions(enableTypeScript);
2206
+ const filesTypeAware = "filesTypeAware" in typeScriptOptions ? typeScriptOptions.filesTypeAware : void 0;
2207
+ const ignoresTypeAware = "ignoresTypeAware" in typeScriptOptions ? typeScriptOptions.ignoresTypeAware : void 0;
2208
+ const tsconfigPath = isObject$1(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : enableTypeScript ? true : null;
2209
+ const isTypeAware = ("isTypeAware" in typeScriptOptions ? typeScriptOptions.isTypeAware : void 0) ?? Boolean(tsconfigPath);
1981
2210
  const configs = [
1982
2211
  ignores(userIgnores, !isTypeAware),
1983
2212
  javascript({
@@ -1999,10 +2228,10 @@ const zayne = (options = {}, ...userConfigs) => {
1999
2228
  if (enableTypeScript) configs.push(typescript({
2000
2229
  componentExts,
2001
2230
  componentExtsTypeAware,
2002
- isTypeAware,
2003
2231
  stylistic: isStylistic,
2004
- ...resolveOptions(enableTypeScript),
2005
- tsconfigPath
2232
+ ...typeScriptOptions,
2233
+ isTypeAware,
2234
+ tsconfigPath: isTypeAware ? tsconfigPath ?? true : null
2006
2235
  }));
2007
2236
  if (enableStylistic) configs.push(stylistic({
2008
2237
  jsx: Boolean(enableJsx),
@@ -2017,17 +2246,23 @@ const zayne = (options = {}, ...userConfigs) => {
2017
2246
  typescript: isTypeAware,
2018
2247
  ...resolveOptions(enableImports)
2019
2248
  }));
2020
- if (enablePnpmCatalogs) configs.push(pnpm(resolveOptions({
2249
+ if (enablePnpmCatalogs) configs.push(pnpm({
2021
2250
  isInEditor,
2022
2251
  json: enableJsonc !== false,
2023
2252
  yaml: enableYaml !== false,
2024
2253
  ...resolveOptions(enablePnpmCatalogs)
2025
- })));
2254
+ }));
2026
2255
  if (enableNode) configs.push(node({
2027
2256
  type,
2028
2257
  ...resolveOptions(enableNode)
2029
2258
  }));
2030
2259
  if (enablePerfectionist) configs.push(perfectionist(resolveOptions(enablePerfectionist)));
2260
+ if (enableBaseline) configs.push(baseline({
2261
+ filesTypeAware,
2262
+ ignoresTypeAware,
2263
+ typescript: isTypeAware,
2264
+ ...resolveOptions(enableBaseline)
2265
+ }));
2031
2266
  if (enableUnicorn) configs.push(unicorn({
2032
2267
  type,
2033
2268
  ...resolveOptions(enableUnicorn)
@@ -2050,15 +2285,19 @@ const zayne = (options = {}, ...userConfigs) => {
2050
2285
  ...resolveOptions(enableMarkdown)
2051
2286
  }));
2052
2287
  if (enableReact) configs.push(react({
2288
+ filesTypeAware,
2289
+ ignoresTypeAware,
2053
2290
  typescript: isTypeAware,
2054
2291
  ...resolveOptions(enableReact)
2055
2292
  }));
2293
+ if (enableRegexp) configs.push(regexp(resolveOptions(enableRegexp)));
2056
2294
  if (restOfOptions.vue) configs.push(vue({
2057
2295
  stylistic: isStylistic,
2058
2296
  typescript: isTypeAware,
2059
2297
  ...resolveOptions(restOfOptions.vue)
2060
2298
  }));
2061
2299
  if (restOfOptions.solid) configs.push(solid({
2300
+ filesTypeAware,
2062
2301
  typescript: isTypeAware,
2063
2302
  ...resolveOptions(restOfOptions.solid)
2064
2303
  }));
@@ -2079,6 +2318,6 @@ const zayne = (options = {}, ...userConfigs) => {
2079
2318
  return composer;
2080
2319
  };
2081
2320
  //#endregion
2082
- 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, command, 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 };
2321
+ 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, baseline, command, comments, depend, expo, gitIgnores, ignores, imports, javascript, jsdoc, jsonc, jsx, markdown, node, perfectionist, pnpm, react, regexp, solid, sortPackageJson, sortTsconfig, stylistic, tailwindcssBetter, tanstack, toml, typescript, unicorn, vue, yaml, zayne };
2083
2322
 
2084
2323
  //# sourceMappingURL=index.js.map