@zayne-labs/eslint-config 0.11.6 → 0.11.7
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/README.md +1 -1
- package/dist/cli/index.js +11 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/constants/defaults.d.ts +37 -0
- package/dist/constants/defaults.js +3 -0
- package/dist/defaults-Ddo61INE.js +64 -0
- package/dist/defaults-Ddo61INE.js.map +1 -0
- package/dist/index.d.ts +152 -100
- package/dist/index.js +71 -157
- package/dist/index.js.map +1 -1
- package/dist/{src-BncWNtPe.js → src-nCsOdMZJ.js} +1 -1
- package/dist/{src-BncWNtPe.js.map → src-nCsOdMZJ.js.map} +1 -1
- package/package.json +10 -14
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { a as getDefaultTailwindcssBetterSettings, i as getDefaultPluginRenameMap, n as getDefaultAllowedNextJsExportNames, r as getDefaultAllowedReactRouterExportNames, t as getDefaultAllowedDependencies } from "./defaults-Ddo61INE.js";
|
|
1
2
|
import { assert, defineEnum, isFunction, isObject as isObject$1, isObjectAndNotArray } from "@zayne-labs/toolkit-type-helpers";
|
|
2
|
-
import { isPackageExists } from "local-pkg";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { isPackageExists } from "local-pkg";
|
|
4
5
|
import { globalIgnores } from "eslint/config";
|
|
5
6
|
import globals from "globals";
|
|
6
7
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
8
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
7
9
|
import process$1 from "node:process";
|
|
8
10
|
import fsp from "node:fs/promises";
|
|
9
11
|
import fs from "node:fs";
|
|
10
12
|
import path from "node:path";
|
|
11
|
-
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
12
13
|
|
|
13
14
|
//#region src/globs.ts
|
|
14
15
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -338,6 +339,7 @@ const depend = async (options = {}) => {
|
|
|
338
339
|
const { files = [GLOB_SRC], overrides } = options;
|
|
339
340
|
await ensurePackages(["eslint-plugin-depend"]);
|
|
340
341
|
const [eslintPluginDepend, jsoncParser] = await Promise.all([interopDefault(import("eslint-plugin-depend")), interopDefault(import("jsonc-eslint-parser"))]);
|
|
342
|
+
const dependRules = { "depend/ban-dependencies": ["error", { allowed: getDefaultAllowedDependencies() }] };
|
|
341
343
|
return [
|
|
342
344
|
{
|
|
343
345
|
name: "zayne/depend/setup",
|
|
@@ -345,9 +347,9 @@ const depend = async (options = {}) => {
|
|
|
345
347
|
},
|
|
346
348
|
{
|
|
347
349
|
files,
|
|
348
|
-
name: "zayne/depend/
|
|
350
|
+
name: "zayne/depend/rules",
|
|
349
351
|
rules: {
|
|
350
|
-
...
|
|
352
|
+
...dependRules,
|
|
351
353
|
...overrides
|
|
352
354
|
}
|
|
353
355
|
},
|
|
@@ -357,7 +359,7 @@ const depend = async (options = {}) => {
|
|
|
357
359
|
name: "zayne/depend/recommended/package-json",
|
|
358
360
|
plugins: { depend: eslintPluginDepend },
|
|
359
361
|
rules: {
|
|
360
|
-
...
|
|
362
|
+
...dependRules,
|
|
361
363
|
...overrides
|
|
362
364
|
}
|
|
363
365
|
}
|
|
@@ -796,8 +798,13 @@ const jsonc = async (options = {}) => {
|
|
|
796
798
|
GLOB_JSON,
|
|
797
799
|
GLOB_JSON5,
|
|
798
800
|
GLOB_JSONC
|
|
799
|
-
], overrides
|
|
801
|
+
], overrides } = options;
|
|
800
802
|
const [eslintPluginJsonc, parserJsonc] = await Promise.all([interopDefault(import("eslint-plugin-jsonc")), interopDefault(import("jsonc-eslint-parser"))]);
|
|
803
|
+
const recommendedRules = eslintPluginJsonc.configs["flat/recommended-with-jsonc"].map((config) => config.rules).reduce((accumulator, rules) => ({
|
|
804
|
+
...accumulator,
|
|
805
|
+
...rules
|
|
806
|
+
}), {});
|
|
807
|
+
const disablePrettierRules = eslintPluginJsonc.configs["flat/prettier"].at(-1)?.rules;
|
|
801
808
|
return [
|
|
802
809
|
{
|
|
803
810
|
name: "zayne/jsonc/setup",
|
|
@@ -808,55 +815,20 @@ const jsonc = async (options = {}) => {
|
|
|
808
815
|
languageOptions: { parser: parserJsonc },
|
|
809
816
|
name: "zayne/jsonc/parser"
|
|
810
817
|
},
|
|
818
|
+
{
|
|
819
|
+
files,
|
|
820
|
+
name: "zayne/jsonc/recommended",
|
|
821
|
+
rules: recommendedRules
|
|
822
|
+
},
|
|
811
823
|
{
|
|
812
824
|
files,
|
|
813
825
|
name: "zayne/jsonc/rules",
|
|
814
|
-
rules: {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
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
|
-
}
|
|
826
|
+
rules: { ...overrides }
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
files,
|
|
830
|
+
name: "zayne/jsonc/disables-prettier",
|
|
831
|
+
rules: disablePrettierRules
|
|
860
832
|
}
|
|
861
833
|
];
|
|
862
834
|
};
|
|
@@ -1084,35 +1056,10 @@ const perfectionist = async (options = {}) => {
|
|
|
1084
1056
|
}];
|
|
1085
1057
|
};
|
|
1086
1058
|
|
|
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
1059
|
//#endregion
|
|
1107
1060
|
//#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
1061
|
async function pnpm(options = {}) {
|
|
1115
|
-
const { catalogs =
|
|
1062
|
+
const { catalogs = false, json = true, overrides, sort = true, yaml: yaml$1 = true } = options;
|
|
1116
1063
|
await ensurePackages(["eslint-plugin-pnpm"]);
|
|
1117
1064
|
const [eslintPluginPnpm, yamlParser, eslintPluginYaml, jsoncParser] = await Promise.all([
|
|
1118
1065
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
@@ -1139,10 +1086,6 @@ async function pnpm(options = {}) {
|
|
|
1139
1086
|
name: "zayne/pnpm/pnpm-workspace-yaml/rules",
|
|
1140
1087
|
plugins: { pnpm: eslintPluginPnpm },
|
|
1141
1088
|
rules: {
|
|
1142
|
-
"pnpm/yaml-enforce-settings": ["error", { settings: {
|
|
1143
|
-
shellEmulator: true,
|
|
1144
|
-
trustPolicy: "no-downgrade"
|
|
1145
|
-
} }],
|
|
1146
1089
|
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1147
1090
|
"pnpm/yaml-no-unused-catalog-item": "error",
|
|
1148
1091
|
...overrides?.yaml
|
|
@@ -1225,51 +1168,6 @@ async function pnpm(options = {}) {
|
|
|
1225
1168
|
return configs;
|
|
1226
1169
|
}
|
|
1227
1170
|
|
|
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
1171
|
//#endregion
|
|
1274
1172
|
//#region src/configs/react.ts
|
|
1275
1173
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1296,7 +1194,7 @@ const react = async (options = {}) => {
|
|
|
1296
1194
|
enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
|
|
1297
1195
|
enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
|
|
1298
1196
|
refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
|
|
1299
|
-
youMightNotNeedAnEffect ? interopDefault(import("./src-
|
|
1197
|
+
youMightNotNeedAnEffect ? interopDefault(import("./src-nCsOdMZJ.js")) : void 0,
|
|
1300
1198
|
nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
|
|
1301
1199
|
]);
|
|
1302
1200
|
const strictConfigKey = typescript$1 ? "strict-type-checked" : "strict";
|
|
@@ -1309,7 +1207,7 @@ const react = async (options = {}) => {
|
|
|
1309
1207
|
} },
|
|
1310
1208
|
name: "zayne/react/setup",
|
|
1311
1209
|
plugins: {
|
|
1312
|
-
...renamePlugins(strictReactConfig.plugins,
|
|
1210
|
+
...renamePlugins(strictReactConfig.plugins, getDefaultPluginRenameMap()),
|
|
1313
1211
|
"react-hooks": eslintReactHooks,
|
|
1314
1212
|
"react-you-might-not-need-an-effect": eslintPluginReactYouMightNotNeedAnEffect
|
|
1315
1213
|
},
|
|
@@ -1325,7 +1223,7 @@ const react = async (options = {}) => {
|
|
|
1325
1223
|
files: typescript$1 ? filesTypeAware : files,
|
|
1326
1224
|
...typescript$1 && { ignores: ignoresTypeAware },
|
|
1327
1225
|
name: `zayne/react/unofficial/${strictConfigKey}`,
|
|
1328
|
-
rules: renameRules(strictReactConfig.rules,
|
|
1226
|
+
rules: renameRules(strictReactConfig.rules, getDefaultPluginRenameMap())
|
|
1329
1227
|
}, {
|
|
1330
1228
|
files,
|
|
1331
1229
|
name: "zayne/react/unofficial/rules",
|
|
@@ -1373,7 +1271,7 @@ const react = async (options = {}) => {
|
|
|
1373
1271
|
rules: {
|
|
1374
1272
|
"react-refresh/only-export-components": ["warn", {
|
|
1375
1273
|
allowConstantExport: isAllowConstantExport,
|
|
1376
|
-
allowExportNames: [...nextjs ?
|
|
1274
|
+
allowExportNames: [...nextjs ? getDefaultAllowedNextJsExportNames() : [], ...isUsingReactRouter ? getDefaultAllowedReactRouterExportNames() : []]
|
|
1377
1275
|
}],
|
|
1378
1276
|
...overrides,
|
|
1379
1277
|
...isObject$1(refresh) && refresh.overrides
|
|
@@ -1399,7 +1297,7 @@ const react = async (options = {}) => {
|
|
|
1399
1297
|
rules: renameRules({
|
|
1400
1298
|
...eslintPluginNextjs.configs?.recommended?.rules,
|
|
1401
1299
|
...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
|
|
1402
|
-
},
|
|
1300
|
+
}, getDefaultPluginRenameMap())
|
|
1403
1301
|
}, {
|
|
1404
1302
|
files,
|
|
1405
1303
|
name: "zayne/react/nextjs/rules",
|
|
@@ -1706,6 +1604,7 @@ const tailwindcssBetter = async (options = {}) => {
|
|
|
1706
1604
|
const { overrides, settings: tailwindCssBetterSettings } = options;
|
|
1707
1605
|
await ensurePackages(["eslint-plugin-better-tailwindcss"]);
|
|
1708
1606
|
const [eslintPluginBetterTailwindCss, defaults] = await Promise.all([interopDefault(import("eslint-plugin-better-tailwindcss")), interopDefault(import("eslint-plugin-better-tailwindcss/api/defaults"))]);
|
|
1607
|
+
const zayneDefaultSettings = getDefaultTailwindcssBetterSettings();
|
|
1709
1608
|
return [
|
|
1710
1609
|
{
|
|
1711
1610
|
name: "zayne/tailwindcss-better/setup",
|
|
@@ -1714,21 +1613,20 @@ const tailwindcssBetter = async (options = {}) => {
|
|
|
1714
1613
|
...tailwindCssBetterSettings,
|
|
1715
1614
|
attributes: [
|
|
1716
1615
|
...defaults.getDefaultAttributes(),
|
|
1717
|
-
|
|
1718
|
-
tailwindCssBetterSettings?.attributes
|
|
1616
|
+
...zayneDefaultSettings.attributes,
|
|
1617
|
+
...tailwindCssBetterSettings?.attributes ?? []
|
|
1719
1618
|
],
|
|
1720
1619
|
callees: [
|
|
1721
1620
|
...defaults.getDefaultCallees(),
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
tailwindCssBetterSettings?.callees
|
|
1621
|
+
...zayneDefaultSettings.callees,
|
|
1622
|
+
...tailwindCssBetterSettings?.callees ?? []
|
|
1725
1623
|
],
|
|
1726
1624
|
entryPoint: tailwindCssBetterSettings?.entryPoint ?? `${process.cwd()}/tailwind.css`
|
|
1727
1625
|
} }
|
|
1728
1626
|
},
|
|
1729
1627
|
{
|
|
1730
1628
|
name: "zayne/tailwindcss-better/recommended",
|
|
1731
|
-
rules: renameRules(eslintPluginBetterTailwindCss.configs.recommended?.rules,
|
|
1629
|
+
rules: renameRules(eslintPluginBetterTailwindCss.configs.recommended?.rules, getDefaultPluginRenameMap())
|
|
1732
1630
|
},
|
|
1733
1631
|
{
|
|
1734
1632
|
name: "zayne/tailwindcss-better/rules",
|
|
@@ -1761,7 +1659,7 @@ const tanstack = async (options = {}) => {
|
|
|
1761
1659
|
if (query && eslintPluginTanstackQuery) config.push({
|
|
1762
1660
|
name: "zayne/tanstack-query/recommended",
|
|
1763
1661
|
plugins: { "tanstack-query": eslintPluginTanstackQuery },
|
|
1764
|
-
rules: renameRules(eslintPluginTanstackQuery.configs["flat/recommended"][0]?.rules,
|
|
1662
|
+
rules: renameRules(eslintPluginTanstackQuery.configs["flat/recommended"][0]?.rules, getDefaultPluginRenameMap())
|
|
1765
1663
|
}, {
|
|
1766
1664
|
name: "zayne/tanstack-query/rules",
|
|
1767
1665
|
rules: {
|
|
@@ -1772,7 +1670,7 @@ const tanstack = async (options = {}) => {
|
|
|
1772
1670
|
if (router && eslintPluginTanstackRouter) config.push({
|
|
1773
1671
|
name: "zayne/tanstack-router/recommended",
|
|
1774
1672
|
plugins: { "tanstack-router": eslintPluginTanstackRouter },
|
|
1775
|
-
rules: renameRules(eslintPluginTanstackRouter.configs["flat/recommended"][0]?.rules,
|
|
1673
|
+
rules: renameRules(eslintPluginTanstackRouter.configs["flat/recommended"][0]?.rules, getDefaultPluginRenameMap())
|
|
1776
1674
|
}, {
|
|
1777
1675
|
name: "zayne/tanstack-router/rules",
|
|
1778
1676
|
rules: {
|
|
@@ -1865,7 +1763,7 @@ const typescript = async (options = {}) => {
|
|
|
1865
1763
|
...parserOptions
|
|
1866
1764
|
}
|
|
1867
1765
|
},
|
|
1868
|
-
name: `zayne/
|
|
1766
|
+
name: `zayne/ts-eslint/${typeAware ? "parser-type-aware" : "parser"}`
|
|
1869
1767
|
};
|
|
1870
1768
|
};
|
|
1871
1769
|
const recommendedRules = tsEslint.configs[isTypeAware ? "strictTypeChecked" : "strict"].map((config) => config.rules).reduce((accumulator, rules) => ({
|
|
@@ -1886,23 +1784,18 @@ const typescript = async (options = {}) => {
|
|
|
1886
1784
|
files: isTypeAware ? filesTypeAware : files,
|
|
1887
1785
|
ignores: isTypeAware ? ignoresTypeAware : [],
|
|
1888
1786
|
name: `zayne/ts-eslint/recommended-${isTypeAware ? "strict-type-checked" : "strict"}`,
|
|
1889
|
-
rules: renameRules(recommendedRules,
|
|
1787
|
+
rules: renameRules(recommendedRules, getDefaultPluginRenameMap())
|
|
1890
1788
|
},
|
|
1891
1789
|
...stylistic$1 ? [{
|
|
1892
1790
|
files: isTypeAware ? filesTypeAware : files,
|
|
1893
1791
|
ignores: isTypeAware ? ignoresTypeAware : [],
|
|
1894
1792
|
name: `zayne/ts-eslint/recommended-${isTypeAware ? "stylistic-type-checked" : "stylistic"}`,
|
|
1895
|
-
rules: renameRules(recommendedStylisticRules,
|
|
1896
|
-
}] : [],
|
|
1897
|
-
...erasableOnly ? [{
|
|
1898
|
-
name: "zayne/typescript/erasable-syntax-only/recommended",
|
|
1899
|
-
plugins: { "erasable-syntax-only": eslintPluginErasableOnly },
|
|
1900
|
-
rules: eslintPluginErasableOnly?.configs.recommended.rules
|
|
1793
|
+
rules: renameRules(recommendedStylisticRules, getDefaultPluginRenameMap())
|
|
1901
1794
|
}] : [],
|
|
1902
1795
|
{
|
|
1903
1796
|
files: isTypeAware ? filesTypeAware : files,
|
|
1904
1797
|
ignores: isTypeAware ? ignoresTypeAware : [],
|
|
1905
|
-
name: `zayne/ts-eslint
|
|
1798
|
+
name: `zayne/ts-eslint/rules${isTypeAware ? "-type-checked" : ""}`,
|
|
1906
1799
|
rules: {
|
|
1907
1800
|
"ts-eslint/array-type": ["error", { default: "array-simple" }],
|
|
1908
1801
|
"ts-eslint/consistent-type-definitions": ["error", "type"],
|
|
@@ -1947,7 +1840,12 @@ const typescript = async (options = {}) => {
|
|
|
1947
1840
|
},
|
|
1948
1841
|
...overrides
|
|
1949
1842
|
}
|
|
1950
|
-
}
|
|
1843
|
+
},
|
|
1844
|
+
...erasableOnly ? [{
|
|
1845
|
+
name: "zayne/ts-eslint/erasable-syntax-only/recommended",
|
|
1846
|
+
plugins: { "erasable-syntax-only": eslintPluginErasableOnly },
|
|
1847
|
+
rules: eslintPluginErasableOnly?.configs.recommended.rules
|
|
1848
|
+
}] : []
|
|
1951
1849
|
];
|
|
1952
1850
|
};
|
|
1953
1851
|
|
|
@@ -2214,6 +2112,25 @@ const yaml = async (options = {}) => {
|
|
|
2214
2112
|
];
|
|
2215
2113
|
};
|
|
2216
2114
|
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
2117
|
+
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
2118
|
+
function findUpSync(name, { cwd = process$1.cwd(), type = "file", stopAt } = {}) {
|
|
2119
|
+
let directory = path.resolve(toPath(cwd) ?? "");
|
|
2120
|
+
const { root } = path.parse(directory);
|
|
2121
|
+
stopAt = path.resolve(directory, toPath(stopAt) ?? root);
|
|
2122
|
+
const isAbsoluteName = path.isAbsolute(name);
|
|
2123
|
+
while (directory) {
|
|
2124
|
+
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
2125
|
+
try {
|
|
2126
|
+
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
2127
|
+
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
2128
|
+
} catch {}
|
|
2129
|
+
if (directory === stopAt || directory === root) break;
|
|
2130
|
+
directory = path.dirname(directory);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2217
2134
|
//#endregion
|
|
2218
2135
|
//#region src/factory.ts
|
|
2219
2136
|
const ReactPackages = ["react", "react-dom"];
|
|
@@ -2233,7 +2150,6 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
2233
2150
|
const enableComments = restOfOptions.comments ?? withDefaults;
|
|
2234
2151
|
const enableImports = restOfOptions.imports ?? withDefaults;
|
|
2235
2152
|
const enableJsdoc = restOfOptions.jsdoc ?? withDefaults;
|
|
2236
|
-
const enablePnpmCatalogs = restOfOptions.pnpm;
|
|
2237
2153
|
const enableJsonc = restOfOptions.jsonc ?? withDefaults;
|
|
2238
2154
|
const enableNode = restOfOptions.node ?? withDefaults;
|
|
2239
2155
|
const enablePerfectionist = restOfOptions.perfectionist ?? withDefaults;
|
|
@@ -2244,6 +2160,7 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
2244
2160
|
const enableUnicorn = restOfOptions.unicorn ?? withDefaults;
|
|
2245
2161
|
const enableYaml = restOfOptions.yaml ?? withDefaults;
|
|
2246
2162
|
const enableMarkdown = restOfOptions.markdown ?? withDefaults;
|
|
2163
|
+
const enablePnpmCatalogs = restOfOptions.pnpm ?? (withDefaults && Boolean(findUpSync("pnpm-workspace.yaml")));
|
|
2247
2164
|
const isStylistic = Boolean(enableStylistic);
|
|
2248
2165
|
const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : enableTypeScript === true ? enableTypeScript : null;
|
|
2249
2166
|
const isTypeAware = Boolean(tsconfigPath);
|
|
@@ -2289,10 +2206,7 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
2289
2206
|
type,
|
|
2290
2207
|
...resolveOptions(enableUnicorn)
|
|
2291
2208
|
}));
|
|
2292
|
-
if (enableJsonc) configs.push(jsonc(
|
|
2293
|
-
stylistic: isStylistic,
|
|
2294
|
-
...resolveOptions(enableJsonc)
|
|
2295
|
-
}), sortPackageJson(), sortTsconfig());
|
|
2209
|
+
if (enableJsonc) configs.push(jsonc(resolveOptions(enableJsonc)), sortPackageJson(), sortTsconfig());
|
|
2296
2210
|
if (enableJsdoc) configs.push(jsdoc({
|
|
2297
2211
|
stylistic: isStylistic,
|
|
2298
2212
|
...resolveOptions(enableJsdoc)
|
|
@@ -2331,9 +2245,9 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
2331
2245
|
if (restOfOptions.tanstack) configs.push(tanstack(resolveOptions(restOfOptions.tanstack)));
|
|
2332
2246
|
if (restOfOptions.depend) configs.push(depend(resolveOptions(restOfOptions.depend)));
|
|
2333
2247
|
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 ?
|
|
2248
|
+
return new FlatConfigComposer().append(...configs, ...userConfigs).renamePlugins(autoRenamePlugins ? getDefaultPluginRenameMap() : {});
|
|
2335
2249
|
};
|
|
2336
2250
|
|
|
2337
2251
|
//#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,
|
|
2252
|
+
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, combine, comments, 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 };
|
|
2339
2253
|
//# sourceMappingURL=index.js.map
|