@zayne-labs/eslint-config 0.10.4 → 0.10.5
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/cli/index.js +35 -38
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +68 -10
- package/dist/index.js +14 -21
- package/dist/index.js.map +1 -1
- package/dist/{src-tkLps0qA.js → src-CqhpNkRz.js} +18 -16
- package/dist/{src-tkLps0qA.js.map → src-CqhpNkRz.js.map} +1 -1
- package/package.json +17 -17
package/dist/cli/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineEnumDeep } from "@zayne-labs/toolkit-type-helpers";
|
|
1
|
+
import { defineEnum, defineEnumDeep } from "@zayne-labs/toolkit-type-helpers";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
import c, { green } from "ansis";
|
|
@@ -10,7 +10,7 @@ import parse from "parse-gitignore";
|
|
|
10
10
|
import { execSync } from "node:child_process";
|
|
11
11
|
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "0.10.
|
|
13
|
+
var version = "0.10.5";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/cli/constants.ts
|
|
@@ -70,7 +70,7 @@ const frameworkOptions = [
|
|
|
70
70
|
const frameworks = frameworkOptions.map(({ value }) => value);
|
|
71
71
|
const extraOptions = [{
|
|
72
72
|
label: c.cyan("TailwindCSS (Better)"),
|
|
73
|
-
value: "
|
|
73
|
+
value: "tailwindcss-better"
|
|
74
74
|
}];
|
|
75
75
|
const extra = extraOptions.map(({ value }) => value);
|
|
76
76
|
const dependenciesMap = defineEnumDeep({
|
|
@@ -82,7 +82,7 @@ const dependenciesMap = defineEnumDeep({
|
|
|
82
82
|
],
|
|
83
83
|
solid: ["eslint-plugin-solid"],
|
|
84
84
|
svelte: ["eslint-plugin-svelte", "svelte-eslint-parser"],
|
|
85
|
-
|
|
85
|
+
"tailwindcss-better": ["eslint-plugin-better-tailwindcss"],
|
|
86
86
|
vue: [
|
|
87
87
|
"eslint-plugin-vue",
|
|
88
88
|
"eslint-processor-vue-blocks",
|
|
@@ -92,28 +92,27 @@ const dependenciesMap = defineEnumDeep({
|
|
|
92
92
|
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/cli/utils.ts
|
|
95
|
-
|
|
95
|
+
const isGitClean = () => {
|
|
96
96
|
try {
|
|
97
97
|
execSync("git diff-index --quiet HEAD --");
|
|
98
98
|
return true;
|
|
99
99
|
} catch {
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const additionalConfigsStr = additionalConfigs?.map((config) => `,{\n${config}\n}`);
|
|
102
|
+
};
|
|
103
|
+
const getEslintConfigContent = (mainConfig, additionalConfigs) => {
|
|
105
104
|
return `
|
|
106
105
|
import { zayne } from '@zayne-labs/eslint-config'
|
|
107
106
|
|
|
108
107
|
export default zayne({
|
|
109
108
|
${mainConfig}
|
|
110
|
-
}${
|
|
109
|
+
}${additionalConfigs?.map((config) => `,{\n${config}\n}`)})
|
|
111
110
|
`.trimStart();
|
|
112
|
-
}
|
|
111
|
+
};
|
|
113
112
|
|
|
114
113
|
//#endregion
|
|
115
114
|
//#region src/cli/stages/update-eslint-files.ts
|
|
116
|
-
async
|
|
115
|
+
const updateEslintFiles = async (result) => {
|
|
117
116
|
const cwd = process.cwd();
|
|
118
117
|
const pathESLintIgnore = path.join(cwd, ".eslintignore");
|
|
119
118
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
@@ -123,8 +122,7 @@ async function updateEslintFiles(result) {
|
|
|
123
122
|
const eslintIgnores = [];
|
|
124
123
|
if (fs.existsSync(pathESLintIgnore)) {
|
|
125
124
|
p.log.step(c.cyan`Migrating existing .eslintignore`);
|
|
126
|
-
const
|
|
127
|
-
const globs = parse(content).globs();
|
|
125
|
+
const globs = parse(await fsp.readFile(pathESLintIgnore, "utf8")).globs();
|
|
128
126
|
for (const glob of globs) {
|
|
129
127
|
if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
|
|
130
128
|
if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
|
|
@@ -134,30 +132,29 @@ async function updateEslintFiles(result) {
|
|
|
134
132
|
if (eslintIgnores.length > 0) configLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);
|
|
135
133
|
if (result.extra.includes("tailwindcssBetter")) configLines.push(`tailwindcssBetter: true,`);
|
|
136
134
|
for (const framework of result.frameworks) configLines.push(`${framework}: true,`);
|
|
137
|
-
const
|
|
138
|
-
const eslintConfigContent = getEslintConfigContent(mainConfig, []);
|
|
135
|
+
const eslintConfigContent = getEslintConfigContent(configLines.map((line) => ` ${line}`).join("\n"), []);
|
|
139
136
|
await fsp.writeFile(pathFlatConfig, eslintConfigContent);
|
|
140
137
|
p.log.success(c.green`Created ${configFileName}`);
|
|
141
|
-
}
|
|
138
|
+
};
|
|
142
139
|
|
|
143
140
|
//#endregion
|
|
144
141
|
//#region src/cli/constants-generated.ts
|
|
145
|
-
const versionsMap = {
|
|
146
|
-
"@eslint-react/eslint-plugin": "^
|
|
142
|
+
const versionsMap = defineEnum({
|
|
143
|
+
"@eslint-react/eslint-plugin": "^2.0.6",
|
|
147
144
|
"astro-eslint-parser": "^1.2.2",
|
|
148
|
-
eslint: "^9.
|
|
145
|
+
eslint: "^9.37.0",
|
|
149
146
|
"eslint-plugin-astro": "^1.3.1",
|
|
150
|
-
"eslint-plugin-better-tailwindcss": "^3.7.
|
|
151
|
-
"eslint-plugin-react-hooks": "^
|
|
152
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
147
|
+
"eslint-plugin-better-tailwindcss": "^3.7.9",
|
|
148
|
+
"eslint-plugin-react-hooks": "^7.0.0",
|
|
149
|
+
"eslint-plugin-react-refresh": "^0.4.23",
|
|
153
150
|
"eslint-plugin-solid": "^0.14.5",
|
|
154
|
-
"eslint-plugin-svelte": "^3.
|
|
151
|
+
"eslint-plugin-svelte": "^3.12.4",
|
|
155
152
|
"svelte-eslint-parser": "^1.1.0"
|
|
156
|
-
};
|
|
153
|
+
});
|
|
157
154
|
|
|
158
155
|
//#endregion
|
|
159
156
|
//#region src/cli/stages/update-package-json.ts
|
|
160
|
-
async
|
|
157
|
+
const updatePackageJson = async (result) => {
|
|
161
158
|
const cwd = process.cwd();
|
|
162
159
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
163
160
|
p.log.step(c.cyan`Bumping @zayne-labs/eslint-config to v${version}`);
|
|
@@ -168,10 +165,10 @@ async function updatePackageJson(result) {
|
|
|
168
165
|
pkg.devDependencies.eslint ??= versionsMap.eslint;
|
|
169
166
|
const addedPackages = [];
|
|
170
167
|
for (const item of result.extra) switch (item) {
|
|
171
|
-
case "
|
|
172
|
-
dependenciesMap.
|
|
173
|
-
pkg.devDependencies && (pkg.devDependencies[
|
|
174
|
-
addedPackages.push(
|
|
168
|
+
case "tailwindcss-better":
|
|
169
|
+
dependenciesMap["tailwindcss-better"].forEach((depName) => {
|
|
170
|
+
pkg.devDependencies && (pkg.devDependencies[depName] = versionsMap[depName]);
|
|
171
|
+
addedPackages.push(depName);
|
|
175
172
|
});
|
|
176
173
|
break;
|
|
177
174
|
default:
|
|
@@ -188,11 +185,11 @@ async function updatePackageJson(result) {
|
|
|
188
185
|
if (addedPackages.length > 0) p.note(c.dim(addedPackages.join(", ")), "Added packages");
|
|
189
186
|
await fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
190
187
|
p.log.success(c.green`Changes wrote to package.json`);
|
|
191
|
-
}
|
|
188
|
+
};
|
|
192
189
|
|
|
193
190
|
//#endregion
|
|
194
191
|
//#region src/cli/stages/update-vscode-settings.ts
|
|
195
|
-
async
|
|
192
|
+
const updateVscodeSettings = async (result) => {
|
|
196
193
|
const cwd = process.cwd();
|
|
197
194
|
if (!result.updateVscodeSettings) return;
|
|
198
195
|
const dotVscodePath = path.join(cwd, ".vscode");
|
|
@@ -209,11 +206,11 @@ async function updateVscodeSettings(result) {
|
|
|
209
206
|
await fsp.writeFile(settingsPath, settingsContent, "utf8");
|
|
210
207
|
p.log.success(green`Updated .vscode/settings.json`);
|
|
211
208
|
}
|
|
212
|
-
}
|
|
209
|
+
};
|
|
213
210
|
|
|
214
211
|
//#endregion
|
|
215
212
|
//#region src/cli/run.ts
|
|
216
|
-
async
|
|
213
|
+
const runCli = async (options = {}) => {
|
|
217
214
|
const argSkipPrompt = Boolean(process.env.SKIP_PROMPT) || options.yes;
|
|
218
215
|
const argTemplate = options.frameworks?.map((m) => m.trim()).filter(Boolean);
|
|
219
216
|
const argExtra = options.extra?.map((m) => m.trim()).filter(Boolean);
|
|
@@ -274,18 +271,18 @@ async function run(options = {}) {
|
|
|
274
271
|
await updateVscodeSettings(result);
|
|
275
272
|
p.log.success(c.green`Setup completed`);
|
|
276
273
|
p.outro(`Now you can update the dependencies by running ${c.blue("pnpm install")} and also ${c.blue("eslint --fix")}\n`);
|
|
277
|
-
}
|
|
274
|
+
};
|
|
278
275
|
|
|
279
276
|
//#endregion
|
|
280
277
|
//#region src/cli/index.ts
|
|
281
|
-
|
|
278
|
+
const header = () => {
|
|
282
279
|
p.intro(`${c.green`@zayne-labs/eslint-config `}${c.dim`v${version}`}`);
|
|
283
|
-
}
|
|
280
|
+
};
|
|
284
281
|
const cli = cac("@zayne-labs/eslint-config");
|
|
285
|
-
cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip prompts and use default values", { default: false }).option("--template, -t <template>", "Use the framework template for optimal customization: vue / react / svelte / astro", { type: [] }).option("--extra, -e <extra>", "Use the extra utils:
|
|
282
|
+
cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip prompts and use default values", { default: false }).option("--template, -t <template>", "Use the framework template for optimal customization: vue / react / svelte / astro", { type: [] }).option("--extra, -e <extra>", "Use the extra utils: tailwindcss", { type: [] }).action(async (options) => {
|
|
286
283
|
header();
|
|
287
284
|
try {
|
|
288
|
-
await
|
|
285
|
+
await runCli(options);
|
|
289
286
|
} catch (error) {
|
|
290
287
|
p.log.error(c.inverse.red(" Failed to migrate "));
|
|
291
288
|
p.log.error(c.red`✘ ${String(error)}`);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["frameworkOptions: Array<PromItem<FrameworkOptionUnion>>","frameworks: FrameworkOptionUnion[]","extraOptions: Array<PromItem<ExtraLibrariesOptionUnion>>","eslintIgnores: string[]","configLines: string[]","eslintConfigContent: string","addedPackages: string[]","dotVscodePath: string","settingsPath: string","result: PromptResult"],"sources":["../../package.json","../../src/cli/constants.ts","../../src/cli/utils.ts","../../src/cli/stages/update-eslint-files.ts","../../src/cli/constants-generated.ts","../../src/cli/stages/update-package-json.ts","../../src/cli/stages/update-vscode-settings.ts","../../src/cli/run.ts","../../src/cli/index.ts"],"sourcesContent":["{\n\t\"name\": \"@zayne-labs/eslint-config\",\n\t\"type\": \"module\",\n\t\"version\": \"0.10.4\",\n\t\"description\": \"Zayne Labs' ESLint config preset\",\n\t\"author\": \"Ryan Zayne\",\n\t\"license\": \"MIT\",\n\t\"homepage\": \"https://github.com/zayne-labs/config#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/zayne-labs/config.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/zayne-labs/config/issues\"\n\t},\n\t\"keywords\": [],\n\t\"sideEffects\": false,\n\t\"exports\": {\n\t\t\".\": \"./dist/index.js\"\n\t},\n\t\"bin\": \"./bin/index.js\",\n\t\"files\": [\n\t\t\"bin\",\n\t\t\"dist\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=20.x\"\n\t},\n\t\"scripts\": {\n\t\t\"build\": \"pnpm typegen && tsdown\",\n\t\t\"build:dev\": \"pnpm typegen && cross-env NODE_ENV=development tsdown\",\n\t\t\"dev\": \"pnpm build:dev --watch\",\n\t\t\"lint:attw\": \"attw --pack . --ignore-rules=cjs-resolves-to-esm\",\n\t\t\"lint:eslint\": \"eslint . --max-warnings 0\",\n\t\t\"lint:format\": \"prettier --write .\",\n\t\t\"lint:packages\": \"pnpm dedupe --check\",\n\t\t\"lint:publint\": \"publint --strict .\",\n\t\t\"lint:type-check\": \"pnpm typegen && tsc --pretty -p tsconfig.json\",\n\t\t\"release\": \"pnpm publish --no-git-checks\",\n\t\t\"release:test\": \"pnpx pkg-pr-new publish\",\n\t\t\"typegen\": \"tsx scripts/typegen.ts\",\n\t\t\"version-package\": \"changeset version\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@eslint-react/eslint-plugin\": \"2.x.x\",\n\t\t\"@next/eslint-plugin-next\": \"15.x.x\",\n\t\t\"@tanstack/eslint-plugin-query\": \"5.x.x\",\n\t\t\"@tanstack/eslint-plugin-router\": \"1.x.x\",\n\t\t\"astro-eslint-parser\": \"1.x.x\",\n\t\t\"eslint\": \"9.x.x\",\n\t\t\"eslint-config-expo\": \"10.x.x\",\n\t\t\"eslint-plugin-astro\": \"1.x.x\",\n\t\t\"eslint-plugin-better-tailwindcss\": \"3.x.x\",\n\t\t\"eslint-plugin-depend\": \"1.x.x\",\n\t\t\"eslint-plugin-pnpm\": \"1.x.x\",\n\t\t\"eslint-plugin-react-hooks\": \"6.x.x\",\n\t\t\"eslint-plugin-react-refresh\": \"0.x.x\",\n\t\t\"eslint-plugin-solid\": \"0.x.x\",\n\t\t\"eslint-plugin-svelte\": \"3.x.x\",\n\t\t\"eslint-plugin-vue\": \"10.x.x\",\n\t\t\"eslint-processor-vue-blocks\": \"2.x.x\",\n\t\t\"vue-eslint-parser\": \"10.x.x\"\n\t},\n\t\"peerDependenciesMeta\": {\n\t\t\"@eslint-react/eslint-plugin\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@next/eslint-plugin-next\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@tanstack/eslint-plugin-query\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@tanstack/eslint-plugin-router\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"astro-eslint-parser\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-config-expo\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-astro\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-better-tailwindcss\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-depend\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-pnpm\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-hooks\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-refresh\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-solid\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-svelte\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-vue\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-processor-vue-blocks\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"vue-eslint-parser\": {\n\t\t\t\"optional\": true\n\t\t}\n\t},\n\t\"dependencies\": {\n\t\t\"@antfu/install-pkg\": \"1.1.0\",\n\t\t\"@clack/prompts\": \"0.11.0\",\n\t\t\"@eslint-community/eslint-plugin-eslint-comments\": \"4.5.0\",\n\t\t\"@eslint/compat\": \"1.4.0\",\n\t\t\"@eslint/js\": \"9.36.0\",\n\t\t\"@stylistic/eslint-plugin\": \"5.4.0\",\n\t\t\"@zayne-labs/toolkit-type-helpers\": \"0.11.20\",\n\t\t\"ansis\": \"4.2.0\",\n\t\t\"cac\": \"6.7.14\",\n\t\t\"eslint-config-flat-gitignore\": \"2.1.0\",\n\t\t\"eslint-flat-config-utils\": \"2.1.4\",\n\t\t\"eslint-import-resolver-typescript\": \"4.4.4\",\n\t\t\"eslint-merge-processors\": \"2.0.0\",\n\t\t\"eslint-plugin-import-x\": \"4.16.1\",\n\t\t\"eslint-plugin-jsdoc\": \"60.7.0\",\n\t\t\"eslint-plugin-jsonc\": \"2.20.1\",\n\t\t\"eslint-plugin-n\": \"17.23.1\",\n\t\t\"eslint-plugin-perfectionist\": \"4.15.0\",\n\t\t\"eslint-plugin-security\": \"3.0.1\",\n\t\t\"eslint-plugin-toml\": \"^0.12.0\",\n\t\t\"eslint-plugin-unicorn\": \"61.0.2\",\n\t\t\"eslint-plugin-yml\": \"^1.17.0\",\n\t\t\"globals\": \"16.4.0\",\n\t\t\"jsonc-eslint-parser\": \"2.4.1\",\n\t\t\"local-pkg\": \"1.1.2\",\n\t\t\"parse-gitignore\": \"2.0.0\",\n\t\t\"toml-eslint-parser\": \"0.10.0\",\n\t\t\"typescript-eslint\": \"8.45.0\",\n\t\t\"yaml-eslint-parser\": \"1.3.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@arethetypeswrong/cli\": \"0.18.2\",\n\t\t\"@changesets/cli\": \"2.29.7\",\n\t\t\"@eslint-react/eslint-plugin\": \"2.0.4\",\n\t\t\"@next/eslint-plugin-next\": \"15.5.4\",\n\t\t\"@tanstack/eslint-plugin-query\": \"5.91.0\",\n\t\t\"@tanstack/eslint-plugin-router\": \"1.132.31\",\n\t\t\"@total-typescript/ts-reset\": \"0.6.1\",\n\t\t\"@types/eslint-plugin-security\": \"3.0.0\",\n\t\t\"@types/node\": \"24.6.1\",\n\t\t\"@zayne-labs/tsconfig\": \"workspace:*\",\n\t\t\"astro-eslint-parser\": \"1.2.2\",\n\t\t\"concurrently\": \"9.2.1\",\n\t\t\"cross-env\": \"10.1.0\",\n\t\t\"eslint\": \"9.36.0\",\n\t\t\"eslint-config-expo\": \"^10.0.0\",\n\t\t\"eslint-plugin-astro\": \"1.3.1\",\n\t\t\"eslint-plugin-better-tailwindcss\": \"3.7.9\",\n\t\t\"eslint-plugin-depend\": \"1.3.1\",\n\t\t\"eslint-plugin-pnpm\": \"1.2.0\",\n\t\t\"eslint-plugin-react-hooks\": \"6.1.0\",\n\t\t\"eslint-plugin-react-refresh\": \"0.4.23\",\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\": \"0.5.5\",\n\t\t\"eslint-plugin-solid\": \"0.14.5\",\n\t\t\"eslint-plugin-svelte\": \"3.12.4\",\n\t\t\"eslint-plugin-vue\": \"10.5.0\",\n\t\t\"eslint-processor-vue-blocks\": \"2.0.0\",\n\t\t\"eslint-typegen\": \"2.3.0\",\n\t\t\"husky\": \"9.1.7\",\n\t\t\"lint-staged\": \"16.2.3\",\n\t\t\"pkg-pr-new\": \"0.0.60\",\n\t\t\"prettier\": \"3.6.2\",\n\t\t\"publint\": \"0.3.13\",\n\t\t\"tailwindcss\": \"^4.1.14\",\n\t\t\"tsdown\": \"^0.15.6\",\n\t\t\"tsx\": \"4.20.6\",\n\t\t\"typescript\": \"5.9.3\",\n\t\t\"vue-eslint-parser\": \"10.2.0\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\",\n\t\t\"registry\": \"https://registry.npmjs.org/\",\n\t\t\"provenance\": true\n\t}\n}\n","import { defineEnumDeep } from \"@zayne-labs/toolkit-type-helpers\";\nimport c from \"ansis\";\nimport type { ExtraLibrariesOptionUnion, FrameworkOptionUnion, PromItem } from \"./types\";\n\nexport const vscodeSettingsString = `\n // Auto fix\n // \"editor.codeActionsOnSave\": {\n // \"source.fixAll.eslint\": \"explicit\",\n // },\n\n // Enable eslint for all supported languages\n \"eslint.validate\": [\n \"javascript\",\n \"javascriptreact\",\n \"typescript\",\n \"typescriptreact\",\n \"vue\",\n \"html\",\n \"markdown\",\n \"json\",\n \"json5\",\n \"jsonc\",\n \"yaml\",\n \"toml\",\n \"xml\",\n \"gql\",\n \"graphql\",\n \"astro\",\n \"svelte\",\n \"css\",\n \"less\",\n \"scss\",\n \"postcss\"\n ]\n`;\n\nexport const frameworkOptions: Array<PromItem<FrameworkOptionUnion>> = [\n\t{\n\t\tlabel: c.green(\"Vue\"),\n\t\tvalue: \"vue\",\n\t},\n\t{\n\t\tlabel: c.cyan(\"React\"),\n\t\tvalue: \"react\",\n\t},\n\t{\n\t\tlabel: c.red(\"Svelte\"),\n\t\tvalue: \"svelte\",\n\t},\n\t{\n\t\tlabel: c.magenta(\"Astro\"),\n\t\tvalue: \"astro\",\n\t},\n\t{\n\t\tlabel: c.cyan(\"Solid\"),\n\t\tvalue: \"solid\",\n\t},\n];\n\nexport const frameworks: FrameworkOptionUnion[] = frameworkOptions.map(({ value }) => value);\n\nexport const extraOptions: Array<PromItem<ExtraLibrariesOptionUnion>> = [\n\t{\n\t\tlabel: c.cyan(\"TailwindCSS (Better)\"),\n\t\tvalue: \"tailwindcssBetter\",\n\t},\n];\n\nexport const extra = extraOptions.map(({ value }) => value);\n\nexport const dependenciesMap = defineEnumDeep({\n\tastro: [\"eslint-plugin-astro\", \"astro-eslint-parser\"],\n\treact: [\"@eslint-react/eslint-plugin\", \"eslint-plugin-react-hooks\", \"eslint-plugin-react-refresh\"],\n\tsolid: [\"eslint-plugin-solid\"],\n\tsvelte: [\"eslint-plugin-svelte\", \"svelte-eslint-parser\"],\n\ttailwindcssBetter: [\"eslint-plugin-better-tailwindcss\"],\n\tvue: [\"eslint-plugin-vue\", \"eslint-processor-vue-blocks\", \"vue-eslint-parser\"],\n}) satisfies Record<ExtraLibrariesOptionUnion | FrameworkOptionUnion, string[]>;\n","import { execSync } from \"node:child_process\";\n\nexport function isGitClean(): boolean {\n\ttry {\n\t\texecSync(\"git diff-index --quiet HEAD --\");\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getEslintConfigContent(mainConfig: string, additionalConfigs?: string[]): string {\n\tconst additionalConfigsStr = additionalConfigs?.map((config) => `,{\\n${config}\\n}`);\n\n\treturn `\nimport { zayne } from '@zayne-labs/eslint-config'\n\nexport default zayne({\n${mainConfig}\n}${additionalConfigsStr})\n`.trimStart();\n}\n","/* eslint-disable max-depth -- Allow */\nimport fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\n// @ts-expect-error missing types\nimport parse from \"parse-gitignore\";\nimport type { PromptResult } from \"../types\";\nimport { getEslintConfigContent } from \"../utils\";\n\nexport async function updateEslintFiles(result: PromptResult): Promise<void> {\n\tconst cwd = process.cwd();\n\tconst pathESLintIgnore = path.join(cwd, \".eslintignore\");\n\tconst pathPackageJSON = path.join(cwd, \"package.json\");\n\n\tconst pkgContent = await fsp.readFile(pathPackageJSON, \"utf8\");\n\tconst pkg = JSON.parse(pkgContent) as Record<string, unknown>;\n\n\tconst configFileName = pkg.type === \"module\" ? \"eslint.config.js\" : \"eslint.config.mjs\";\n\tconst pathFlatConfig = path.join(cwd, configFileName);\n\n\tconst eslintIgnores: string[] = [];\n\n\tif (fs.existsSync(pathESLintIgnore)) {\n\t\tp.log.step(c.cyan`Migrating existing .eslintignore`);\n\n\t\tconst content = await fsp.readFile(pathESLintIgnore, \"utf8\");\n\t\tconst parsed = parse(content);\n\t\tconst globs = parsed.globs();\n\n\t\tfor (const glob of globs) {\n\t\t\tif (glob.type === \"ignore\") {\n\t\t\t\teslintIgnores.push(...(glob.patterns as string[]));\n\t\t\t}\n\n\t\t\tif (glob.type === \"unignore\") {\n\t\t\t\teslintIgnores.push(...(glob.patterns.map((pattern: string) => `!${pattern}`) as string[]));\n\t\t\t}\n\t\t}\n\t}\n\n\tconst configLines: string[] = [];\n\n\tif (eslintIgnores.length > 0) {\n\t\tconfigLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);\n\t}\n\n\tif (result.extra.includes(\"tailwindcssBetter\")) {\n\t\tconfigLines.push(`tailwindcssBetter: true,`);\n\t}\n\n\tfor (const framework of result.frameworks) {\n\t\tconfigLines.push(`${framework}: true,`);\n\t}\n\n\tconst mainConfig = configLines.map((line) => ` ${line}`).join(\"\\n\");\n\n\tconst additionalConfig: string[] = [];\n\n\tconst eslintConfigContent: string = getEslintConfigContent(mainConfig, additionalConfig);\n\n\tawait fsp.writeFile(pathFlatConfig, eslintConfigContent);\n\n\tp.log.success(c.green`Created ${configFileName}`);\n}\n","export const versionsMap = {\n\t\"@eslint-react/eslint-plugin\": \"^1.38.4\",\n\t\"astro-eslint-parser\": \"^1.2.2\",\n\teslint: \"^9.24.0\",\n\t\"eslint-plugin-astro\": \"^1.3.1\",\n\t\"eslint-plugin-better-tailwindcss\": \"^3.7.6\",\n\t\"eslint-plugin-react-hooks\": \"^5.2.0\",\n\t\"eslint-plugin-react-refresh\": \"^0.4.19\",\n\t\"eslint-plugin-solid\": \"^0.14.5\",\n\t\"eslint-plugin-svelte\": \"^3.3.3\",\n\t\"svelte-eslint-parser\": \"^1.1.0\",\n};\n","import fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { version } from \"../../../package.json\";\nimport { dependenciesMap } from \"../constants\";\nimport { versionsMap } from \"../constants-generated\";\nimport type { PromptResult } from \"../types\";\n\nexport async function updatePackageJson(result: PromptResult): Promise<void> {\n\tconst cwd = process.cwd();\n\n\tconst pathPackageJSON = path.join(cwd, \"package.json\");\n\n\tp.log.step(c.cyan`Bumping @zayne-labs/eslint-config to v${version}`);\n\n\tconst pkgContent = await fsp.readFile(pathPackageJSON, \"utf8\");\n\tconst pkg = JSON.parse(pkgContent) as Record<string, Record<string, string | undefined> | undefined>;\n\n\tpkg.devDependencies ??= {};\n\tpkg.devDependencies[\"@zayne-labs/eslint-config\"] = `^${version}`;\n\tpkg.devDependencies.eslint ??= versionsMap.eslint;\n\n\tconst addedPackages: string[] = [];\n\n\tfor (const item of result.extra) {\n\t\tswitch (item) {\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Ignore for now\n\t\t\tcase \"tailwindcssBetter\": {\n\t\t\t\tdependenciesMap.tailwindcssBetter.forEach((f) => {\n\t\t\t\t\tpkg.devDependencies\n\t\t\t\t\t\t&& (pkg.devDependencies[f] = versionsMap[f as keyof typeof versionsMap]);\n\n\t\t\t\t\taddedPackages.push(f);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\titem satisfies never;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const framework of result.frameworks) {\n\t\tconst dependencies = dependenciesMap[framework];\n\n\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\tif (!dependencies) continue;\n\n\t\tdependencies.forEach((dependency) => {\n\t\t\tif (!pkg.devDependencies) return;\n\n\t\t\tpkg.devDependencies[dependency] = versionsMap[dependency as keyof typeof versionsMap];\n\t\t\taddedPackages.push(dependency);\n\t\t});\n\t}\n\n\tif (addedPackages.length > 0) {\n\t\tp.note(c.dim(addedPackages.join(\", \")), \"Added packages\");\n\t}\n\n\tawait fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));\n\n\tp.log.success(c.green`Changes wrote to package.json`);\n}\n","import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport { green } from \"ansis\";\nimport { vscodeSettingsString } from \"../constants\";\nimport type { PromptResult } from \"../types\";\n\nexport async function updateVscodeSettings(result: PromptResult): Promise<void> {\n\tconst cwd = process.cwd();\n\n\tif (!result.updateVscodeSettings) return;\n\n\tconst dotVscodePath: string = path.join(cwd, \".vscode\");\n\tconst settingsPath: string = path.join(dotVscodePath, \"settings.json\");\n\n\tif (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });\n\n\tif (!fs.existsSync(settingsPath)) {\n\t\tawait fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\\n`, \"utf8\");\n\t\tp.log.success(green`Created .vscode/settings.json`);\n\t} else {\n\t\tlet settingsContent = await fsp.readFile(settingsPath, \"utf8\");\n\n\t\tsettingsContent = settingsContent.trim().replace(/\\s*\\}$/, \"\");\n\t\tsettingsContent += settingsContent.endsWith(\",\") || settingsContent.endsWith(\"{\") ? \"\" : \",\";\n\t\tsettingsContent += `${vscodeSettingsString}}\\n`;\n\n\t\tawait fsp.writeFile(settingsPath, settingsContent, \"utf8\");\n\t\tp.log.success(green`Updated .vscode/settings.json`);\n\t}\n}\n","/* eslint-disable perfectionist/sort-objects -- Ignore */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { extra, extraOptions, frameworkOptions, frameworks } from \"./constants\";\nimport { updateEslintFiles } from \"./stages/update-eslint-files\";\nimport { updatePackageJson } from \"./stages/update-package-json\";\nimport { updateVscodeSettings } from \"./stages/update-vscode-settings\";\nimport type { ExtraLibrariesOptionUnion, FrameworkOptionUnion, PromptResult } from \"./types\";\nimport { isGitClean } from \"./utils\";\n\nexport type CliRunOptions = {\n\t/**\n\t * Use the extra utils: formatter / perfectionist / unocss\n\t */\n\textra?: string[];\n\t/**\n\t * Use the framework template for optimal customization: vue / react / svelte / astro\n\t */\n\tframeworks?: string[];\n\t/**\n\t * Skip prompts and use default values\n\t */\n\tyes?: boolean;\n};\n\nexport async function run(options: CliRunOptions = {}): Promise<void> {\n\tconst argSkipPrompt = Boolean(process.env.SKIP_PROMPT) || options.yes;\n\tconst argTemplate = options.frameworks?.map((m) => m.trim()).filter(Boolean);\n\tconst argExtra = options.extra?.map((m) => m.trim()).filter(Boolean);\n\n\tif (fs.existsSync(path.join(process.cwd(), \"eslint.config.js\"))) {\n\t\tp.log.warn(c.yellow`eslint.config.js already exists, migration wizard exited.`);\n\n\t\treturn process.exit(1);\n\t}\n\n\t// Set default value for promptResult if `argSkipPrompt` is enabled\n\tlet result: PromptResult = {\n\t\textra: (argExtra ?? []) as ExtraLibrariesOptionUnion[],\n\t\tframeworks: (argTemplate ?? []) as FrameworkOptionUnion[],\n\t\tuncommittedConfirmed: false,\n\t\tupdateVscodeSettings: true,\n\t};\n\n\tif (!argSkipPrompt) {\n\t\tresult = (await p.group(\n\t\t\t{\n\t\t\t\tuncommittedConfirmed: () => {\n\t\t\t\t\tif (isGitClean()) {\n\t\t\t\t\t\treturn Promise.resolve(true);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p.confirm({\n\t\t\t\t\t\tinitialValue: false,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\"There are uncommitted changes in the current repository, are you sure to continue?\",\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\tframeworks: ({ results }) => {\n\t\t\t\t\tconst isArgTemplateValid =\n\t\t\t\t\t\t(argTemplate?.length ?? 0) > 0\n\t\t\t\t\t\t&& (argTemplate ?? []).filter((element) => !frameworks.includes(element)).length === 0;\n\n\t\t\t\t\tif (!results.uncommittedConfirmed || isArgTemplateValid) return;\n\n\t\t\t\t\tconst message =\n\t\t\t\t\t\targTemplate ?\n\t\t\t\t\t\t\t`\"${argTemplate}\" isn't a valid template. Please choose from below: `\n\t\t\t\t\t\t:\t\"Select a framework:\";\n\n\t\t\t\t\treturn p.multiselect<FrameworkOptionUnion>({\n\t\t\t\t\t\tmessage: c.reset(message),\n\t\t\t\t\t\toptions: frameworkOptions,\n\t\t\t\t\t\trequired: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\textra: ({ results }) => {\n\t\t\t\t\tconst isArgExtraValid =\n\t\t\t\t\t\t(argExtra?.length ?? 0) > 0\n\t\t\t\t\t\t&& (argExtra ?? []).filter((element) => !extra.includes(element)).length === 0;\n\n\t\t\t\t\tif (!results.uncommittedConfirmed || isArgExtraValid) return;\n\n\t\t\t\t\tconst message =\n\t\t\t\t\t\targExtra ?\n\t\t\t\t\t\t\t`\"${argExtra}\" isn't a valid extra util. Please choose from below: `\n\t\t\t\t\t\t:\t\"Select an extra util:\";\n\n\t\t\t\t\treturn p.multiselect<ExtraLibrariesOptionUnion>({\n\t\t\t\t\t\tmessage: c.reset(message),\n\t\t\t\t\t\toptions: extraOptions,\n\t\t\t\t\t\trequired: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\tupdateVscodeSettings: ({ results }) => {\n\t\t\t\t\tif (!results.uncommittedConfirmed) return;\n\n\t\t\t\t\treturn p.confirm({\n\t\t\t\t\t\tinitialValue: true,\n\t\t\t\t\t\tmessage: \"Update .vscode/settings.json for better VS Code experience?\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tonCancel: () => {\n\t\t\t\t\tp.cancel(\"Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t},\n\t\t\t}\n\t\t)) as PromptResult;\n\n\t\tif (!result.uncommittedConfirmed) {\n\t\t\treturn process.exit(1);\n\t\t}\n\t}\n\n\tawait updatePackageJson(result);\n\tawait updateEslintFiles(result);\n\tawait updateVscodeSettings(result);\n\n\tp.log.success(c.green`Setup completed`);\n\n\tp.outro(\n\t\t`Now you can update the dependencies by running ${c.blue(\"pnpm install\")} and also ${c.blue(\"eslint --fix\")}\\n`\n\t);\n}\n","import process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { cac } from \"cac\";\nimport { version } from \"../../package.json\";\nimport { type CliRunOptions, run } from \"./run\";\n\nfunction header(): void {\n\tp.intro(`${c.green`@zayne-labs/eslint-config `}${c.dim`v${version}`}`);\n}\n\nconst cli = cac(\"@zayne-labs/eslint-config\");\n\ncli.command(\"\", \"Run the initialization or migration\")\n\t.option(\"--yes, -y\", \"Skip prompts and use default values\", { default: false })\n\t.option(\n\t\t\"--template, -t <template>\",\n\t\t\"Use the framework template for optimal customization: vue / react / svelte / astro\",\n\t\t{ type: [] }\n\t)\n\t.option(\"--extra, -e <extra>\", \"Use the extra utils: perfectionist / tailwindcss\", { type: [] })\n\t.action(async (options: CliRunOptions) => {\n\t\theader();\n\t\ttry {\n\t\t\tawait run(options);\n\t\t} catch (error) {\n\t\t\tp.log.error(c.inverse.red(\" Failed to migrate \"));\n\t\t\tp.log.error(c.red`✘ ${String(error)}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\ncli.help();\ncli.version(version);\ncli.parse();\n"],"mappings":";;;;;;;;;;;;cAGY;;;;ACCZ,MAAa,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCpC,MAAaA,mBAA0D;CACtE;EACC,OAAO,EAAE,MAAM,MAAM;EACrB,OAAO;EACP;CACD;EACC,OAAO,EAAE,KAAK,QAAQ;EACtB,OAAO;EACP;CACD;EACC,OAAO,EAAE,IAAI,SAAS;EACtB,OAAO;EACP;CACD;EACC,OAAO,EAAE,QAAQ,QAAQ;EACzB,OAAO;EACP;CACD;EACC,OAAO,EAAE,KAAK,QAAQ;EACtB,OAAO;EACP;CACD;AAED,MAAaC,aAAqC,iBAAiB,KAAK,EAAE,YAAY,MAAM;AAE5F,MAAaC,eAA2D,CACvE;CACC,OAAO,EAAE,KAAK,uBAAuB;CACrC,OAAO;CACP,CACD;AAED,MAAa,QAAQ,aAAa,KAAK,EAAE,YAAY,MAAM;AAE3D,MAAa,kBAAkB,eAAe;CAC7C,OAAO,CAAC,uBAAuB,sBAAsB;CACrD,OAAO;EAAC;EAA+B;EAA6B;EAA8B;CAClG,OAAO,CAAC,sBAAsB;CAC9B,QAAQ,CAAC,wBAAwB,uBAAuB;CACxD,mBAAmB,CAAC,mCAAmC;CACvD,KAAK;EAAC;EAAqB;EAA+B;EAAoB;CAC9E,CAAC;;;;AC3EF,SAAgB,aAAsB;AACrC,KAAI;AACH,WAAS,iCAAiC;AAC1C,SAAO;SACA;AACP,SAAO;;;AAIT,SAAgB,uBAAuB,YAAoB,mBAAsC;CAChG,MAAM,uBAAuB,mBAAmB,KAAK,WAAW,OAAO,OAAO,KAAK;AAEnF,QAAO;;;;EAIN,WAAW;GACV,qBAAqB;E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vB,GAAE,MAAM,GAAG,EAAE,KAAK,+BAA+B,EAAE,GAAG,IAAI,YAAY;;AAGvE,MAAM,MAAM,IAAI,4BAA4B;AAE5C,IAAI,QAAQ,IAAI,sCAAsC,CACpD,OAAO,aAAa,uCAAuC,EAAE,SAAS,OAAO,CAAC,CAC9E,OACA,6BACA,sFACA,EAAE,MAAM,EAAE,EAAE,CACZ,CACA,OAAO,uBAAuB,oDAAoD,EAAE,MAAM,EAAE,EAAE,CAAC,CAC/F,OAAO,OAAO,YAA2B;AACzC,SAAQ;AACR,KAAI;AACH,QAAM,IAAI,QAAQ;UACV,OAAO;AACf,IAAE,IAAI,MAAM,EAAE,QAAQ,IAAI,sBAAsB,CAAC;AACjD,IAAE,IAAI,MAAM,EAAE,GAAG,KAAK,OAAO,MAAM,GAAG;AACtC,UAAQ,KAAK,EAAE;;EAEf;AAEH,IAAI,MAAM;AACV,IAAI,QAAQ,QAAQ;AACpB,IAAI,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["frameworkOptions: Array<PromItem<FrameworkOptionUnion>>","frameworks: FrameworkOptionUnion[]","extraOptions: Array<PromItem<ExtraLibrariesOptionUnion>>","eslintIgnores: string[]","configLines: string[]","eslintConfigContent: string","addedPackages: string[]","dotVscodePath: string","settingsPath: string","result: PromptResult"],"sources":["../../package.json","../../src/cli/constants.ts","../../src/cli/utils.ts","../../src/cli/stages/update-eslint-files.ts","../../src/cli/constants-generated.ts","../../src/cli/stages/update-package-json.ts","../../src/cli/stages/update-vscode-settings.ts","../../src/cli/run.ts","../../src/cli/index.ts"],"sourcesContent":["{\n\t\"name\": \"@zayne-labs/eslint-config\",\n\t\"type\": \"module\",\n\t\"version\": \"0.10.5\",\n\t\"description\": \"Zayne Labs' ESLint config preset\",\n\t\"author\": \"Ryan Zayne\",\n\t\"license\": \"MIT\",\n\t\"homepage\": \"https://github.com/zayne-labs/config#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/zayne-labs/config.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/zayne-labs/config/issues\"\n\t},\n\t\"keywords\": [],\n\t\"sideEffects\": false,\n\t\"exports\": {\n\t\t\".\": \"./dist/index.js\"\n\t},\n\t\"bin\": \"./bin/index.js\",\n\t\"files\": [\n\t\t\"bin\",\n\t\t\"dist\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=20.x\"\n\t},\n\t\"scripts\": {\n\t\t\"build\": \"pnpm typegen && tsdown\",\n\t\t\"build:dev\": \"pnpm typegen && cross-env NODE_ENV=development tsdown\",\n\t\t\"dev\": \"pnpm build:dev --watch\",\n\t\t\"lint:attw\": \"attw --pack . --ignore-rules=cjs-resolves-to-esm\",\n\t\t\"lint:eslint\": \"eslint . --max-warnings 0\",\n\t\t\"lint:format\": \"prettier --write .\",\n\t\t\"lint:packages\": \"pnpm dedupe --check\",\n\t\t\"lint:publint\": \"publint --strict .\",\n\t\t\"lint:type-check\": \"pnpm typegen && tsc --pretty -p tsconfig.json\",\n\t\t\"release\": \"pnpm publish --no-git-checks\",\n\t\t\"release:test\": \"pnpx pkg-pr-new publish\",\n\t\t\"typegen\": \"tsx scripts/typegen.ts\",\n\t\t\"version-package\": \"changeset version\"\n\t},\n\t\"peerDependencies\": {\n\t\t\"@eslint-react/eslint-plugin\": \"2.x.x\",\n\t\t\"@next/eslint-plugin-next\": \"15.x.x\",\n\t\t\"@tanstack/eslint-plugin-query\": \"5.x.x\",\n\t\t\"@tanstack/eslint-plugin-router\": \"1.x.x\",\n\t\t\"astro-eslint-parser\": \"1.x.x\",\n\t\t\"eslint\": \"9.x.x\",\n\t\t\"eslint-config-expo\": \"10.x.x\",\n\t\t\"eslint-plugin-astro\": \"1.x.x\",\n\t\t\"eslint-plugin-better-tailwindcss\": \"3.x.x\",\n\t\t\"eslint-plugin-depend\": \"1.x.x\",\n\t\t\"eslint-plugin-pnpm\": \"1.x.x\",\n\t\t\"eslint-plugin-react-hooks\": \"7.x.x\",\n\t\t\"eslint-plugin-react-refresh\": \"0.x.x\",\n\t\t\"eslint-plugin-solid\": \"0.x.x\",\n\t\t\"eslint-plugin-svelte\": \"3.x.x\",\n\t\t\"eslint-plugin-vue\": \"10.x.x\",\n\t\t\"eslint-processor-vue-blocks\": \"2.x.x\",\n\t\t\"vue-eslint-parser\": \"10.x.x\"\n\t},\n\t\"peerDependenciesMeta\": {\n\t\t\"@eslint-react/eslint-plugin\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@next/eslint-plugin-next\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@tanstack/eslint-plugin-query\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"@tanstack/eslint-plugin-router\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"astro-eslint-parser\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-config-expo\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-astro\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-better-tailwindcss\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-depend\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-pnpm\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-hooks\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-refresh\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-solid\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-svelte\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-plugin-vue\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"eslint-processor-vue-blocks\": {\n\t\t\t\"optional\": true\n\t\t},\n\t\t\"vue-eslint-parser\": {\n\t\t\t\"optional\": true\n\t\t}\n\t},\n\t\"dependencies\": {\n\t\t\"@antfu/install-pkg\": \"1.1.0\",\n\t\t\"@clack/prompts\": \"0.11.0\",\n\t\t\"@eslint-community/eslint-plugin-eslint-comments\": \"4.5.0\",\n\t\t\"@eslint/compat\": \"1.4.0\",\n\t\t\"@eslint/js\": \"9.37.0\",\n\t\t\"@stylistic/eslint-plugin\": \"5.4.0\",\n\t\t\"@zayne-labs/toolkit-type-helpers\": \"0.12.3\",\n\t\t\"ansis\": \"4.2.0\",\n\t\t\"cac\": \"6.7.14\",\n\t\t\"eslint-config-flat-gitignore\": \"2.1.0\",\n\t\t\"eslint-flat-config-utils\": \"2.1.4\",\n\t\t\"eslint-import-resolver-typescript\": \"4.4.4\",\n\t\t\"eslint-merge-processors\": \"2.0.0\",\n\t\t\"eslint-plugin-import-x\": \"4.16.1\",\n\t\t\"eslint-plugin-jsdoc\": \"61.1.0\",\n\t\t\"eslint-plugin-jsonc\": \"2.21.0\",\n\t\t\"eslint-plugin-n\": \"17.23.1\",\n\t\t\"eslint-plugin-perfectionist\": \"4.15.1\",\n\t\t\"eslint-plugin-security\": \"3.0.1\",\n\t\t\"eslint-plugin-toml\": \"^0.12.0\",\n\t\t\"eslint-plugin-unicorn\": \"61.0.2\",\n\t\t\"eslint-plugin-yml\": \"^1.19.0\",\n\t\t\"globals\": \"16.4.0\",\n\t\t\"jsonc-eslint-parser\": \"2.4.1\",\n\t\t\"local-pkg\": \"1.1.2\",\n\t\t\"parse-gitignore\": \"2.0.0\",\n\t\t\"toml-eslint-parser\": \"0.10.0\",\n\t\t\"typescript-eslint\": \"8.46.0\",\n\t\t\"yaml-eslint-parser\": \"1.3.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@arethetypeswrong/cli\": \"0.18.2\",\n\t\t\"@changesets/cli\": \"2.29.7\",\n\t\t\"@eslint-react/eslint-plugin\": \"2.0.6\",\n\t\t\"@next/eslint-plugin-next\": \"15.5.4\",\n\t\t\"@tanstack/eslint-plugin-query\": \"5.91.0\",\n\t\t\"@tanstack/eslint-plugin-router\": \"1.132.31\",\n\t\t\"@total-typescript/ts-reset\": \"0.6.1\",\n\t\t\"@types/eslint-plugin-security\": \"3.0.0\",\n\t\t\"@types/node\": \"24.7.2\",\n\t\t\"@zayne-labs/tsconfig\": \"workspace:*\",\n\t\t\"astro-eslint-parser\": \"1.2.2\",\n\t\t\"concurrently\": \"9.2.1\",\n\t\t\"cross-env\": \"10.1.0\",\n\t\t\"eslint\": \"9.37.0\",\n\t\t\"eslint-config-expo\": \"^10.0.0\",\n\t\t\"eslint-plugin-astro\": \"1.3.1\",\n\t\t\"eslint-plugin-better-tailwindcss\": \"3.7.9\",\n\t\t\"eslint-plugin-depend\": \"1.3.1\",\n\t\t\"eslint-plugin-pnpm\": \"1.2.0\",\n\t\t\"eslint-plugin-react-hooks\": \"7.0.0\",\n\t\t\"eslint-plugin-react-refresh\": \"0.4.23\",\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\": \"0.5.6\",\n\t\t\"eslint-plugin-solid\": \"0.14.5\",\n\t\t\"eslint-plugin-svelte\": \"3.12.4\",\n\t\t\"eslint-plugin-vue\": \"10.5.0\",\n\t\t\"eslint-processor-vue-blocks\": \"2.0.0\",\n\t\t\"eslint-typegen\": \"2.3.0\",\n\t\t\"husky\": \"9.1.7\",\n\t\t\"lint-staged\": \"16.2.4\",\n\t\t\"pkg-pr-new\": \"0.0.60\",\n\t\t\"prettier\": \"3.6.2\",\n\t\t\"publint\": \"0.3.14\",\n\t\t\"tailwindcss\": \"^4.1.14\",\n\t\t\"tsdown\": \"^0.15.6\",\n\t\t\"tsx\": \"4.20.6\",\n\t\t\"typescript\": \"5.9.3\",\n\t\t\"vue-eslint-parser\": \"10.2.0\"\n\t},\n\t\"publishConfig\": {\n\t\t\"access\": \"public\",\n\t\t\"registry\": \"https://registry.npmjs.org/\",\n\t\t\"provenance\": true\n\t}\n}\n","import { defineEnumDeep } from \"@zayne-labs/toolkit-type-helpers\";\nimport c from \"ansis\";\nimport type { ExtraLibrariesOptionUnion, FrameworkOptionUnion, PromItem } from \"./types\";\n\nexport const vscodeSettingsString = `\n // Auto fix\n // \"editor.codeActionsOnSave\": {\n // \"source.fixAll.eslint\": \"explicit\",\n // },\n\n // Enable eslint for all supported languages\n \"eslint.validate\": [\n \"javascript\",\n \"javascriptreact\",\n \"typescript\",\n \"typescriptreact\",\n \"vue\",\n \"html\",\n \"markdown\",\n \"json\",\n \"json5\",\n \"jsonc\",\n \"yaml\",\n \"toml\",\n \"xml\",\n \"gql\",\n \"graphql\",\n \"astro\",\n \"svelte\",\n \"css\",\n \"less\",\n \"scss\",\n \"postcss\"\n ]\n`;\n\nexport const frameworkOptions: Array<PromItem<FrameworkOptionUnion>> = [\n\t{\n\t\tlabel: c.green(\"Vue\"),\n\t\tvalue: \"vue\",\n\t},\n\t{\n\t\tlabel: c.cyan(\"React\"),\n\t\tvalue: \"react\",\n\t},\n\t{\n\t\tlabel: c.red(\"Svelte\"),\n\t\tvalue: \"svelte\",\n\t},\n\t{\n\t\tlabel: c.magenta(\"Astro\"),\n\t\tvalue: \"astro\",\n\t},\n\t{\n\t\tlabel: c.cyan(\"Solid\"),\n\t\tvalue: \"solid\",\n\t},\n];\n\nexport const frameworks: FrameworkOptionUnion[] = frameworkOptions.map(({ value }) => value);\n\nexport const extraOptions: Array<PromItem<ExtraLibrariesOptionUnion>> = [\n\t{\n\t\tlabel: c.cyan(\"TailwindCSS (Better)\"),\n\t\tvalue: \"tailwindcss-better\",\n\t},\n];\n\nexport const extra = extraOptions.map(({ value }) => value);\n\nexport const dependenciesMap = defineEnumDeep({\n\tastro: [\"eslint-plugin-astro\", \"astro-eslint-parser\"],\n\treact: [\"@eslint-react/eslint-plugin\", \"eslint-plugin-react-hooks\", \"eslint-plugin-react-refresh\"],\n\tsolid: [\"eslint-plugin-solid\"],\n\tsvelte: [\"eslint-plugin-svelte\", \"svelte-eslint-parser\"],\n\t\"tailwindcss-better\": [\"eslint-plugin-better-tailwindcss\"],\n\tvue: [\"eslint-plugin-vue\", \"eslint-processor-vue-blocks\", \"vue-eslint-parser\"],\n}) satisfies Record<ExtraLibrariesOptionUnion | FrameworkOptionUnion, string[]>;\n","import { execSync } from \"node:child_process\";\n\nexport const isGitClean = (): boolean => {\n\ttry {\n\t\texecSync(\"git diff-index --quiet HEAD --\");\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const getEslintConfigContent = (mainConfig: string, additionalConfigs?: string[]): string => {\n\tconst additionalConfigsStr = additionalConfigs?.map((config) => `,{\\n${config}\\n}`);\n\n\treturn `\nimport { zayne } from '@zayne-labs/eslint-config'\n\nexport default zayne({\n${mainConfig}\n}${additionalConfigsStr})\n`.trimStart();\n};\n","/* eslint-disable max-depth -- Allow */\nimport fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\n// @ts-expect-error missing types\nimport parse from \"parse-gitignore\";\nimport type { PromptResult } from \"../types\";\nimport { getEslintConfigContent } from \"../utils\";\n\nexport const updateEslintFiles = async (result: PromptResult): Promise<void> => {\n\tconst cwd = process.cwd();\n\tconst pathESLintIgnore = path.join(cwd, \".eslintignore\");\n\tconst pathPackageJSON = path.join(cwd, \"package.json\");\n\n\tconst pkgContent = await fsp.readFile(pathPackageJSON, \"utf8\");\n\tconst pkg = JSON.parse(pkgContent) as Record<string, unknown>;\n\n\tconst configFileName = pkg.type === \"module\" ? \"eslint.config.js\" : \"eslint.config.mjs\";\n\tconst pathFlatConfig = path.join(cwd, configFileName);\n\n\tconst eslintIgnores: string[] = [];\n\n\tif (fs.existsSync(pathESLintIgnore)) {\n\t\tp.log.step(c.cyan`Migrating existing .eslintignore`);\n\n\t\tconst content = await fsp.readFile(pathESLintIgnore, \"utf8\");\n\t\tconst parsed = parse(content);\n\t\tconst globs = parsed.globs();\n\n\t\tfor (const glob of globs) {\n\t\t\tif (glob.type === \"ignore\") {\n\t\t\t\teslintIgnores.push(...(glob.patterns as string[]));\n\t\t\t}\n\n\t\t\tif (glob.type === \"unignore\") {\n\t\t\t\teslintIgnores.push(...(glob.patterns.map((pattern: string) => `!${pattern}`) as string[]));\n\t\t\t}\n\t\t}\n\t}\n\n\tconst configLines: string[] = [];\n\n\tif (eslintIgnores.length > 0) {\n\t\tconfigLines.push(`ignores: ${JSON.stringify(eslintIgnores)},`);\n\t}\n\n\tif (result.extra.includes(\"tailwindcssBetter\")) {\n\t\tconfigLines.push(`tailwindcssBetter: true,`);\n\t}\n\n\tfor (const framework of result.frameworks) {\n\t\tconfigLines.push(`${framework}: true,`);\n\t}\n\n\tconst mainConfig = configLines.map((line) => ` ${line}`).join(\"\\n\");\n\n\tconst additionalConfig: string[] = [];\n\n\tconst eslintConfigContent: string = getEslintConfigContent(mainConfig, additionalConfig);\n\n\tawait fsp.writeFile(pathFlatConfig, eslintConfigContent);\n\n\tp.log.success(c.green`Created ${configFileName}`);\n};\n","import { defineEnum } from \"@zayne-labs/toolkit-type-helpers\";\n\nexport const versionsMap = defineEnum({\n\t\"@eslint-react/eslint-plugin\": \"^2.0.6\",\n\t\"astro-eslint-parser\": \"^1.2.2\",\n\teslint: \"^9.37.0\",\n\t\"eslint-plugin-astro\": \"^1.3.1\",\n\t\"eslint-plugin-better-tailwindcss\": \"^3.7.9\",\n\t\"eslint-plugin-react-hooks\": \"^7.0.0\",\n\t\"eslint-plugin-react-refresh\": \"^0.4.23\",\n\t\"eslint-plugin-solid\": \"^0.14.5\",\n\t\"eslint-plugin-svelte\": \"^3.12.4\",\n\t\"svelte-eslint-parser\": \"^1.1.0\",\n});\n","import fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { version } from \"../../../package.json\";\nimport { dependenciesMap } from \"../constants\";\nimport { versionsMap } from \"../constants-generated\";\nimport type { PromptResult } from \"../types\";\n\nexport const updatePackageJson = async (result: PromptResult): Promise<void> => {\n\tconst cwd = process.cwd();\n\n\tconst pathPackageJSON = path.join(cwd, \"package.json\");\n\n\tp.log.step(c.cyan`Bumping @zayne-labs/eslint-config to v${version}`);\n\n\tconst pkgContent = await fsp.readFile(pathPackageJSON, \"utf8\");\n\tconst pkg = JSON.parse(pkgContent) as Record<string, Record<string, string | undefined> | undefined>;\n\n\tpkg.devDependencies ??= {};\n\tpkg.devDependencies[\"@zayne-labs/eslint-config\"] = `^${version}`;\n\tpkg.devDependencies.eslint ??= versionsMap.eslint;\n\n\tconst addedPackages: string[] = [];\n\n\tfor (const item of result.extra) {\n\t\tswitch (item) {\n\t\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Ignore\n\t\t\tcase \"tailwindcss-better\": {\n\t\t\t\tdependenciesMap[\"tailwindcss-better\"].forEach((depName) => {\n\t\t\t\t\tpkg.devDependencies\n\t\t\t\t\t\t&& (pkg.devDependencies[depName] = versionsMap[depName as keyof typeof versionsMap]);\n\n\t\t\t\t\taddedPackages.push(depName);\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\titem satisfies never;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const framework of result.frameworks) {\n\t\tconst dependencies = dependenciesMap[framework];\n\n\t\t// eslint-disable-next-line ts-eslint/no-unnecessary-condition -- Allow\n\t\tif (!dependencies) continue;\n\n\t\tdependencies.forEach((dependency) => {\n\t\t\tif (!pkg.devDependencies) return;\n\n\t\t\tpkg.devDependencies[dependency] = versionsMap[dependency as keyof typeof versionsMap];\n\t\t\taddedPackages.push(dependency);\n\t\t});\n\t}\n\n\tif (addedPackages.length > 0) {\n\t\tp.note(c.dim(addedPackages.join(\", \")), \"Added packages\");\n\t}\n\n\tawait fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));\n\n\tp.log.success(c.green`Changes wrote to package.json`);\n};\n","import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport { green } from \"ansis\";\nimport { vscodeSettingsString } from \"../constants\";\nimport type { PromptResult } from \"../types\";\n\nexport const updateVscodeSettings = async (result: PromptResult): Promise<void> => {\n\tconst cwd = process.cwd();\n\n\tif (!result.updateVscodeSettings) return;\n\n\tconst dotVscodePath: string = path.join(cwd, \".vscode\");\n\tconst settingsPath: string = path.join(dotVscodePath, \"settings.json\");\n\n\tif (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });\n\n\tif (!fs.existsSync(settingsPath)) {\n\t\tawait fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\\n`, \"utf8\");\n\t\tp.log.success(green`Created .vscode/settings.json`);\n\t} else {\n\t\tlet settingsContent = await fsp.readFile(settingsPath, \"utf8\");\n\n\t\tsettingsContent = settingsContent.trim().replace(/\\s*\\}$/, \"\");\n\t\tsettingsContent += settingsContent.endsWith(\",\") || settingsContent.endsWith(\"{\") ? \"\" : \",\";\n\t\tsettingsContent += `${vscodeSettingsString}}\\n`;\n\n\t\tawait fsp.writeFile(settingsPath, settingsContent, \"utf8\");\n\t\tp.log.success(green`Updated .vscode/settings.json`);\n\t}\n};\n","/* eslint-disable perfectionist/sort-objects -- Ignore */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { extra, extraOptions, frameworkOptions, frameworks } from \"./constants\";\nimport { updateEslintFiles } from \"./stages/update-eslint-files\";\nimport { updatePackageJson } from \"./stages/update-package-json\";\nimport { updateVscodeSettings } from \"./stages/update-vscode-settings\";\nimport type { ExtraLibrariesOptionUnion, FrameworkOptionUnion, PromptResult } from \"./types\";\nimport { isGitClean } from \"./utils\";\n\nexport type CliRunOptions = {\n\t/**\n\t * Use the extra utils: formatter / perfectionist / unocss\n\t */\n\textra?: string[];\n\t/**\n\t * Use the framework template for optimal customization: vue / react / svelte / astro\n\t */\n\tframeworks?: string[];\n\t/**\n\t * Skip prompts and use default values\n\t */\n\tyes?: boolean;\n};\n\nexport const runCli = async (options: CliRunOptions = {}): Promise<void> => {\n\tconst argSkipPrompt = Boolean(process.env.SKIP_PROMPT) || options.yes;\n\tconst argTemplate = options.frameworks?.map((m) => m.trim()).filter(Boolean);\n\tconst argExtra = options.extra?.map((m) => m.trim()).filter(Boolean);\n\n\tif (fs.existsSync(path.join(process.cwd(), \"eslint.config.js\"))) {\n\t\tp.log.warn(c.yellow`eslint.config.js already exists, migration wizard exited.`);\n\n\t\treturn process.exit(1);\n\t}\n\n\t// Set default value for promptResult if `argSkipPrompt` is enabled\n\tlet result: PromptResult = {\n\t\textra: (argExtra ?? []) as ExtraLibrariesOptionUnion[],\n\t\tframeworks: (argTemplate ?? []) as FrameworkOptionUnion[],\n\t\tuncommittedConfirmed: false,\n\t\tupdateVscodeSettings: true,\n\t};\n\n\tif (!argSkipPrompt) {\n\t\tresult = (await p.group(\n\t\t\t{\n\t\t\t\tuncommittedConfirmed: () => {\n\t\t\t\t\tif (isGitClean()) {\n\t\t\t\t\t\treturn Promise.resolve(true);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p.confirm({\n\t\t\t\t\t\tinitialValue: false,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\"There are uncommitted changes in the current repository, are you sure to continue?\",\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\tframeworks: ({ results }) => {\n\t\t\t\t\tconst isArgTemplateValid =\n\t\t\t\t\t\t(argTemplate?.length ?? 0) > 0\n\t\t\t\t\t\t&& (argTemplate ?? []).filter((element) => !frameworks.includes(element)).length === 0;\n\n\t\t\t\t\tif (!results.uncommittedConfirmed || isArgTemplateValid) return;\n\n\t\t\t\t\tconst message =\n\t\t\t\t\t\targTemplate ?\n\t\t\t\t\t\t\t`\"${argTemplate}\" isn't a valid template. Please choose from below: `\n\t\t\t\t\t\t:\t\"Select a framework:\";\n\n\t\t\t\t\treturn p.multiselect<FrameworkOptionUnion>({\n\t\t\t\t\t\tmessage: c.reset(message),\n\t\t\t\t\t\toptions: frameworkOptions,\n\t\t\t\t\t\trequired: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\textra: ({ results }) => {\n\t\t\t\t\tconst isArgExtraValid =\n\t\t\t\t\t\t(argExtra?.length ?? 0) > 0\n\t\t\t\t\t\t&& (argExtra ?? []).filter((element) => !extra.includes(element)).length === 0;\n\n\t\t\t\t\tif (!results.uncommittedConfirmed || isArgExtraValid) return;\n\n\t\t\t\t\tconst message =\n\t\t\t\t\t\targExtra ?\n\t\t\t\t\t\t\t`\"${argExtra}\" isn't a valid extra util. Please choose from below: `\n\t\t\t\t\t\t:\t\"Select an extra util:\";\n\n\t\t\t\t\treturn p.multiselect<ExtraLibrariesOptionUnion>({\n\t\t\t\t\t\tmessage: c.reset(message),\n\t\t\t\t\t\toptions: extraOptions,\n\t\t\t\t\t\trequired: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\n\t\t\t\tupdateVscodeSettings: ({ results }) => {\n\t\t\t\t\tif (!results.uncommittedConfirmed) return;\n\n\t\t\t\t\treturn p.confirm({\n\t\t\t\t\t\tinitialValue: true,\n\t\t\t\t\t\tmessage: \"Update .vscode/settings.json for better VS Code experience?\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tonCancel: () => {\n\t\t\t\t\tp.cancel(\"Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t},\n\t\t\t}\n\t\t)) as PromptResult;\n\n\t\tif (!result.uncommittedConfirmed) {\n\t\t\treturn process.exit(1);\n\t\t}\n\t}\n\n\tawait updatePackageJson(result);\n\tawait updateEslintFiles(result);\n\tawait updateVscodeSettings(result);\n\n\tp.log.success(c.green`Setup completed`);\n\n\tp.outro(\n\t\t`Now you can update the dependencies by running ${c.blue(\"pnpm install\")} and also ${c.blue(\"eslint --fix\")}\\n`\n\t);\n};\n","import process from \"node:process\";\nimport * as p from \"@clack/prompts\";\nimport c from \"ansis\";\nimport { cac } from \"cac\";\nimport { version } from \"../../package.json\";\nimport { type CliRunOptions, runCli } from \"./run\";\n\nconst header = () => {\n\tp.intro(`${c.green`@zayne-labs/eslint-config `}${c.dim`v${version}`}`);\n};\n\nconst cli = cac(\"@zayne-labs/eslint-config\");\n\ncli.command(\"\", \"Run the initialization or migration\")\n\t.option(\"--yes, -y\", \"Skip prompts and use default values\", { default: false })\n\t.option(\n\t\t\"--template, -t <template>\",\n\t\t\"Use the framework template for optimal customization: vue / react / svelte / astro\",\n\t\t{ type: [] }\n\t)\n\t.option(\"--extra, -e <extra>\", \"Use the extra utils: tailwindcss\", { type: [] })\n\t.action(async (options: CliRunOptions) => {\n\t\theader();\n\t\ttry {\n\t\t\tawait runCli(options);\n\t\t} catch (error) {\n\t\t\tp.log.error(c.inverse.red(\" Failed to migrate \"));\n\t\t\tp.log.error(c.red`✘ ${String(error)}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t});\n\ncli.help();\ncli.version(version);\ncli.parse();\n"],"mappings":";;;;;;;;;;;;cAGY;;;;ACCZ,MAAa,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCpC,MAAaA,mBAA0D;CACtE;EACC,OAAO,EAAE,MAAM,MAAM;EACrB,OAAO;EACP;CACD;EACC,OAAO,EAAE,KAAK,QAAQ;EACtB,OAAO;EACP;CACD;EACC,OAAO,EAAE,IAAI,SAAS;EACtB,OAAO;EACP;CACD;EACC,OAAO,EAAE,QAAQ,QAAQ;EACzB,OAAO;EACP;CACD;EACC,OAAO,EAAE,KAAK,QAAQ;EACtB,OAAO;EACP;CACD;AAED,MAAaC,aAAqC,iBAAiB,KAAK,EAAE,YAAY,MAAM;AAE5F,MAAaC,eAA2D,CACvE;CACC,OAAO,EAAE,KAAK,uBAAuB;CACrC,OAAO;CACP,CACD;AAED,MAAa,QAAQ,aAAa,KAAK,EAAE,YAAY,M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,qBAAsB;AAEnC,WAAO,EAAE,QAAQ;KAChB,cAAc;KACd,SAAS;KACT,CAAC;;GAEH,EACD,EACC,gBAAgB;AACf,KAAE,OAAO,uBAAuB;AAChC,WAAQ,KAAK,EAAE;KAEhB,CACD;AAED,MAAI,CAAC,OAAO,qBACX,QAAO,QAAQ,KAAK,EAAE;;AAIxB,OAAM,kBAAkB,OAAO;AAC/B,OAAM,kBAAkB,OAAO;AAC/B,OAAM,qBAAqB,OAAO;AAElC,GAAE,IAAI,QAAQ,EAAE,KAAK,kBAAkB;AAEvC,GAAE,MACD,kDAAkD,EAAE,KAAK,eAAe,CAAC,YAAY,EAAE,KAAK,eAAe,CAAC,IAC5G;;;;;AC3HF,MAAM,eAAe;AACpB,GAAE,MAAM,GAAG,EAAE,KAAK,+BAA+B,EAAE,GAAG,IAAI,YAAY;;AAGvE,MAAM,MAAM,IAAI,4BAA4B;AAE5C,IAAI,QAAQ,IAAI,sCAAsC,CACpD,OAAO,aAAa,uCAAuC,EAAE,SAAS,OAAO,CAAC,CAC9E,OACA,6BACA,sFACA,EAAE,MAAM,EAAE,EAAE,CACZ,CACA,OAAO,uBAAuB,oCAAoC,EAAE,MAAM,EAAE,EAAE,CAAC,CAC/E,OAAO,OAAO,YAA2B;AACzC,SAAQ;AACR,KAAI;AACH,QAAM,OAAO,QAAQ;UACb,OAAO;AACf,IAAE,IAAI,MAAM,EAAE,QAAQ,IAAI,sBAAsB,CAAC;AACjD,IAAE,IAAI,MAAM,EAAE,GAAG,KAAK,OAAO,MAAM,GAAG;AACtC,UAAQ,KAAK,EAAE;;EAEf;AAEH,IAAI,MAAM;AACV,IAAI,QAAQ,QAAQ;AACpB,IAAI,OAAO"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1201,6 +1201,26 @@ interface Rules {
|
|
|
1201
1201
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header
|
|
1202
1202
|
*/
|
|
1203
1203
|
'jsdoc/text-escaping'?: Linter.RuleEntry<JsdocTextEscaping>;
|
|
1204
|
+
/**
|
|
1205
|
+
* Prefers either function properties or method signatures
|
|
1206
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-method-signature-style.md#repos-sticky-header
|
|
1207
|
+
*/
|
|
1208
|
+
'jsdoc/ts-method-signature-style'?: Linter.RuleEntry<JsdocTsMethodSignatureStyle>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Warns against use of the empty object type
|
|
1211
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-no-empty-object-type.md#repos-sticky-header
|
|
1212
|
+
*/
|
|
1213
|
+
'jsdoc/ts-no-empty-object-type'?: Linter.RuleEntry<[]>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Catches unnecessary template expressions such as string expressions within a template literal.
|
|
1216
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-no-unnecessary-template-expression.md#repos-sticky-header
|
|
1217
|
+
*/
|
|
1218
|
+
'jsdoc/ts-no-unnecessary-template-expression'?: Linter.RuleEntry<JsdocTsNoUnnecessaryTemplateExpression>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Prefers function types over call signatures when there are no other properties.
|
|
1221
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-prefer-function-type.md#repos-sticky-header
|
|
1222
|
+
*/
|
|
1223
|
+
'jsdoc/ts-prefer-function-type'?: Linter.RuleEntry<JsdocTsPreferFunctionType>;
|
|
1204
1224
|
/**
|
|
1205
1225
|
* Formats JSDoc type values.
|
|
1206
1226
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header
|
|
@@ -3031,7 +3051,7 @@ interface Rules {
|
|
|
3031
3051
|
*/
|
|
3032
3052
|
'react-dom/no-missing-button-type'?: Linter.RuleEntry<[]>;
|
|
3033
3053
|
/**
|
|
3034
|
-
* Enforces explicit `sandbox`
|
|
3054
|
+
* Enforces explicit `sandbox` prop for `iframe` elements.
|
|
3035
3055
|
* @see https://eslint-react.xyz/docs/rules/dom-no-missing-iframe-sandbox
|
|
3036
3056
|
*/
|
|
3037
3057
|
'react-dom/no-missing-iframe-sandbox'?: Linter.RuleEntry<[]>;
|
|
@@ -3160,7 +3180,6 @@ interface Rules {
|
|
|
3160
3180
|
* Validates against deriving values from state in an effect
|
|
3161
3181
|
*/
|
|
3162
3182
|
'react-hooks/no-deriving-state-in-effects'?: Linter.RuleEntry<ReactHooksNoDerivingStateInEffects>;
|
|
3163
|
-
'react-hooks/no-unused-directives'?: Linter.RuleEntry<ReactHooksNoUnusedDirectives>;
|
|
3164
3183
|
/**
|
|
3165
3184
|
* Validates that existing manual memoized is preserved by the compiler. React Compiler will only compile components and hooks if its inference [matches or exceeds the existing manual memoization](https://react.dev/learn/react-compiler/introduction#what-should-i-do-about-usememo-usecallback-and-reactmemo)
|
|
3166
3185
|
*/
|
|
@@ -3210,6 +3229,10 @@ interface Rules {
|
|
|
3210
3229
|
* Validates usage of the useMemo() hook against common mistakes. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.
|
|
3211
3230
|
*/
|
|
3212
3231
|
'react-hooks/use-memo'?: Linter.RuleEntry<ReactHooksUseMemo>;
|
|
3232
|
+
/**
|
|
3233
|
+
* Validates that useMemos always return a value. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.
|
|
3234
|
+
*/
|
|
3235
|
+
'react-hooks/void-use-memo'?: Linter.RuleEntry<ReactHooksVoidUseMemo>;
|
|
3213
3236
|
/**
|
|
3214
3237
|
* Enforces naming conventions for components.
|
|
3215
3238
|
* @see https://eslint-react.xyz/docs/rules/naming-convention-component-name
|
|
@@ -3257,7 +3280,7 @@ interface Rules {
|
|
|
3257
3280
|
*/
|
|
3258
3281
|
'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>;
|
|
3259
3282
|
/**
|
|
3260
|
-
* Enforces that the 'key'
|
|
3283
|
+
* Enforces that the 'key' prop is placed before the spread prop in JSX elements.
|
|
3261
3284
|
* @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
|
|
3262
3285
|
*/
|
|
3263
3286
|
'react-x/jsx-key-before-spread'?: Linter.RuleEntry<[]>;
|
|
@@ -3462,7 +3485,7 @@ interface Rules {
|
|
|
3462
3485
|
*/
|
|
3463
3486
|
'react-x/no-set-state-in-component-did-update'?: Linter.RuleEntry<[]>;
|
|
3464
3487
|
/**
|
|
3465
|
-
*
|
|
3488
|
+
* Disallow calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.
|
|
3466
3489
|
* @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
3467
3490
|
*/
|
|
3468
3491
|
'react-x/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
|
|
@@ -5024,7 +5047,7 @@ interface Rules {
|
|
|
5024
5047
|
* Disallow member access on a value with type `any`
|
|
5025
5048
|
* @see https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
5026
5049
|
*/
|
|
5027
|
-
'ts-eslint/no-unsafe-member-access'?: Linter.RuleEntry<
|
|
5050
|
+
'ts-eslint/no-unsafe-member-access'?: Linter.RuleEntry<TsEslintNoUnsafeMemberAccess>;
|
|
5028
5051
|
/**
|
|
5029
5052
|
* Disallow returning a value with type `any` from a function
|
|
5030
5053
|
* @see https://typescript-eslint.io/rules/no-unsafe-return
|
|
@@ -8450,16 +8473,44 @@ type JsdocTextEscaping = [] | [{
|
|
|
8450
8473
|
escapeHTML?: boolean;
|
|
8451
8474
|
escapeMarkdown?: boolean;
|
|
8452
8475
|
}];
|
|
8476
|
+
// ----- jsdoc/ts-method-signature-style -----
|
|
8477
|
+
type JsdocTsMethodSignatureStyle = [] | [("method" | "property")] | [("method" | "property"), {
|
|
8478
|
+
enableFixer?: boolean;
|
|
8479
|
+
}];
|
|
8480
|
+
// ----- jsdoc/ts-no-unnecessary-template-expression -----
|
|
8481
|
+
type JsdocTsNoUnnecessaryTemplateExpression = [] | [{
|
|
8482
|
+
enableFixer?: boolean;
|
|
8483
|
+
}];
|
|
8484
|
+
// ----- jsdoc/ts-prefer-function-type -----
|
|
8485
|
+
type JsdocTsPreferFunctionType = [] | [{
|
|
8486
|
+
enableFixer?: boolean;
|
|
8487
|
+
}];
|
|
8453
8488
|
// ----- jsdoc/type-formatting -----
|
|
8454
8489
|
type JsdocTypeFormatting = [] | [{
|
|
8455
8490
|
arrayBrackets?: ("angle" | "square");
|
|
8491
|
+
arrowFunctionPostReturnMarkerSpacing?: string;
|
|
8492
|
+
arrowFunctionPreReturnMarkerSpacing?: string;
|
|
8456
8493
|
enableFixer?: boolean;
|
|
8494
|
+
functionOrClassParameterSpacing?: string;
|
|
8495
|
+
functionOrClassPostGenericSpacing?: string;
|
|
8496
|
+
functionOrClassPostReturnMarkerSpacing?: string;
|
|
8497
|
+
functionOrClassPreReturnMarkerSpacing?: string;
|
|
8498
|
+
functionOrClassTypeParameterSpacing?: string;
|
|
8499
|
+
genericAndTupleElementSpacing?: string;
|
|
8457
8500
|
genericDot?: boolean;
|
|
8501
|
+
keyValuePostColonSpacing?: string;
|
|
8502
|
+
keyValuePostKeySpacing?: string;
|
|
8503
|
+
keyValuePostOptionalSpacing?: string;
|
|
8504
|
+
keyValuePostVariadicSpacing?: string;
|
|
8505
|
+
methodQuotes?: ("double" | "single");
|
|
8458
8506
|
objectFieldIndent?: string;
|
|
8459
8507
|
objectFieldQuote?: ("double" | "single" | null);
|
|
8460
8508
|
objectFieldSeparator?: ("comma" | "comma-and-linebreak" | "linebreak" | "semicolon" | "semicolon-and-linebreak");
|
|
8461
8509
|
objectFieldSeparatorOptionalLinebreak?: boolean;
|
|
8462
8510
|
objectFieldSeparatorTrailingPunctuation?: boolean;
|
|
8511
|
+
parameterDefaultValueSpacing?: string;
|
|
8512
|
+
postMethodNameSpacing?: string;
|
|
8513
|
+
postNewSpacing?: string;
|
|
8463
8514
|
separatorForSingleObjectField?: boolean;
|
|
8464
8515
|
stringQuotes?: ("double" | "single");
|
|
8465
8516
|
typeBracketSpacing?: string;
|
|
@@ -9485,12 +9536,14 @@ type NoRestrictedImports = ((string | {
|
|
|
9485
9536
|
message?: string;
|
|
9486
9537
|
importNames?: string[];
|
|
9487
9538
|
allowImportNames?: string[];
|
|
9539
|
+
allowTypeImports?: boolean;
|
|
9488
9540
|
})[] | [] | [{
|
|
9489
9541
|
paths?: (string | {
|
|
9490
9542
|
name: string;
|
|
9491
9543
|
message?: string;
|
|
9492
9544
|
importNames?: string[];
|
|
9493
9545
|
allowImportNames?: string[];
|
|
9546
|
+
allowTypeImports?: boolean;
|
|
9494
9547
|
})[];
|
|
9495
9548
|
patterns?: (string[] | ({
|
|
9496
9549
|
[k: string]: unknown | undefined;
|
|
@@ -11887,10 +11940,6 @@ type ReactHooksMemoizedEffectDependencies = [] | [{
|
|
|
11887
11940
|
type ReactHooksNoDerivingStateInEffects = [] | [{
|
|
11888
11941
|
[k: string]: unknown | undefined;
|
|
11889
11942
|
}];
|
|
11890
|
-
// ----- react-hooks/no-unused-directives -----
|
|
11891
|
-
type ReactHooksNoUnusedDirectives = [] | [{
|
|
11892
|
-
[k: string]: unknown | undefined;
|
|
11893
|
-
}];
|
|
11894
11943
|
// ----- react-hooks/preserve-manual-memoization -----
|
|
11895
11944
|
type ReactHooksPreserveManualMemoization = [] | [{
|
|
11896
11945
|
[k: string]: unknown | undefined;
|
|
@@ -11939,6 +11988,10 @@ type ReactHooksUnsupportedSyntax = [] | [{
|
|
|
11939
11988
|
type ReactHooksUseMemo = [] | [{
|
|
11940
11989
|
[k: string]: unknown | undefined;
|
|
11941
11990
|
}];
|
|
11991
|
+
// ----- react-hooks/void-use-memo -----
|
|
11992
|
+
type ReactHooksVoidUseMemo = [] | [{
|
|
11993
|
+
[k: string]: unknown | undefined;
|
|
11994
|
+
}];
|
|
11942
11995
|
// ----- react-naming-convention/component-name -----
|
|
11943
11996
|
type ReactNamingConventionComponentName = [] | [(("PascalCase" | "CONSTANT_CASE") | {
|
|
11944
11997
|
allowAllCaps?: boolean;
|
|
@@ -14694,6 +14747,10 @@ type TsEslintNoUnnecessaryTypeAssertion = [] | [{
|
|
|
14694
14747
|
checkLiteralConstAssertions?: boolean;
|
|
14695
14748
|
typesToIgnore?: string[];
|
|
14696
14749
|
}];
|
|
14750
|
+
// ----- ts-eslint/no-unsafe-member-access -----
|
|
14751
|
+
type TsEslintNoUnsafeMemberAccess = [] | [{
|
|
14752
|
+
allowOptionalChaining?: boolean;
|
|
14753
|
+
}];
|
|
14697
14754
|
// ----- ts-eslint/no-unused-expressions -----
|
|
14698
14755
|
type TsEslintNoUnusedExpressions = [] | [{
|
|
14699
14756
|
allowShortCircuit?: boolean;
|
|
@@ -14711,6 +14768,7 @@ type TsEslintNoUnusedVars = [] | [(("all" | "local") | {
|
|
|
14711
14768
|
destructuredArrayIgnorePattern?: string;
|
|
14712
14769
|
ignoreClassWithStaticInitBlock?: boolean;
|
|
14713
14770
|
ignoreRestSiblings?: boolean;
|
|
14771
|
+
ignoreUsingDeclarations?: boolean;
|
|
14714
14772
|
reportUsedIgnorePattern?: boolean;
|
|
14715
14773
|
vars?: ("all" | "local");
|
|
14716
14774
|
varsIgnorePattern?: string;
|
|
@@ -16580,7 +16638,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
16580
16638
|
}];
|
|
16581
16639
|
|
|
16582
16640
|
// Names of all the configs
|
|
16583
|
-
type ConfigNames = "zayne/js-eslint/setup" | "zayne/js-eslint/recommended" | "zayne/js-eslint/rules" | "zayne/unicorn/recommended" | "zayne/unicorn/rules" | "zayne/ts-eslint/setup" | "zayne/ts-eslint/setup/parser" | "zayne/ts-eslint/setup/parser-type-aware" | "zayne/ts-eslint/recommended-strict-type-checked" | "zayne/ts-eslint/recommended-stylistic-type-checked" | "zayne/ts-eslint/rules-type-checked" | "zayne/perfectionist/rules" | "zayne/stylistic/rules" | "zayne/import/setup" | "zayne/import/recommended" | "zayne/import/rules" | "zayne/jsdoc/rules" | "zayne/jsonc/setup" | "zayne/jsonc/rules" | "zayne/react/setup" | "zayne/react/official/
|
|
16641
|
+
type ConfigNames = "zayne/js-eslint/setup" | "zayne/js-eslint/recommended" | "zayne/js-eslint/rules" | "zayne/unicorn/recommended" | "zayne/unicorn/rules" | "zayne/ts-eslint/setup" | "zayne/ts-eslint/setup/parser" | "zayne/ts-eslint/setup/parser-type-aware" | "zayne/ts-eslint/recommended-strict-type-checked" | "zayne/ts-eslint/recommended-stylistic-type-checked" | "zayne/ts-eslint/rules-type-checked" | "zayne/perfectionist/rules" | "zayne/stylistic/rules" | "zayne/import/setup" | "zayne/import/recommended" | "zayne/import/rules" | "zayne/jsdoc/rules" | "zayne/jsonc/setup" | "zayne/jsonc/rules" | "zayne/react/setup" | "zayne/react/official/rules" | "zayne/react/unofficial/recommended-type-checked" | "zayne/react/unofficial/rules" | "zayne/react/official/compiler/rules" | "zayne/react/refresh/rules" | "zayne/react/you-might-not-need-an-effect/recommended" | "zayne/react/you-might-not-need-an-effect/rules" | "zayne/react/nextjs/recommended" | "zayne/react/nextjs/rules" | "zayne/node/recommended" | "zayne/node/rules" | "zayne/node/security/recommended" | "zayne/tanstack-query/recommended" | "zayne/tanstack-query/rules" | "zayne/tanstack-router/recommended" | "zayne/tanstack-router/rules" | "zayne/eslint-comments/rules" | "zayne/toml/setup" | "zayne/toml/rules" | "zayne/yaml/setup" | "zayne/yaml/rules" | "zayne/vue/setup" | "zayne/vue/setup/parser" | "zayne/vue/recommended" | "zayne/vue/rules" | "zayne/vue/disables" | "zayne/solid/setup" | "zayne/solid/recommended" | "zayne/solid/rules" | "zayne/pnpm/setup" | "zayne/pnpm/rules/package-json" | "zayne/pnpm/rules/pnpm-workspace-yaml" | "zayne/astro/setup" | "zayne/astro/recommended" | "zayne/astro/rules" | "zayne/depend/setup" | "zayne/depend/recommended" | "zayne/depend/recommended/package-json" | "zayne/tailwindcss-better/setup" | "zayne/tailwindcss-better/recommended" | "zayne/tailwindcss-better/rules" | "zayne/expo/recommended" | "zayne/expo/recommended" | "zayne/expo/rules";
|
|
16584
16642
|
//#endregion
|
|
16585
16643
|
//#region src/types/eslint-config-types/parser-options.d.ts
|
|
16586
16644
|
// Some types copied from `@types/eslint` `Linter.ParserOptions`
|
package/dist/index.js
CHANGED
|
@@ -331,9 +331,8 @@ const depend = async (options = {}) => {
|
|
|
331
331
|
const expo = async (options = {}) => {
|
|
332
332
|
const { overrides } = options;
|
|
333
333
|
await ensurePackages(["eslint-config-expo"]);
|
|
334
|
-
const eslintConfigExpo = await interopDefault(import("eslint-config-expo/flat/utils/expo.js"));
|
|
335
334
|
return [...overrideConfigs({
|
|
336
|
-
configArray:
|
|
335
|
+
configArray: await interopDefault(import("eslint-config-expo/flat/utils/expo.js")),
|
|
337
336
|
overrides: { name: "zayne/expo/recommended" }
|
|
338
337
|
}), {
|
|
339
338
|
name: "zayne/expo/rules",
|
|
@@ -1047,7 +1046,7 @@ const react = async (options = {}) => {
|
|
|
1047
1046
|
enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
|
|
1048
1047
|
enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
|
|
1049
1048
|
refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
|
|
1050
|
-
youMightNotNeedAnEffect ? interopDefault(import("./src-
|
|
1049
|
+
youMightNotNeedAnEffect ? interopDefault(import("./src-CqhpNkRz.js")) : void 0,
|
|
1051
1050
|
nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
|
|
1052
1051
|
]);
|
|
1053
1052
|
const recommendedReactConfig = eslintPluginReact?.configs[typescript$1 ? "recommended-type-checked" : "recommended"];
|
|
@@ -1066,25 +1065,11 @@ const react = async (options = {}) => {
|
|
|
1066
1065
|
settings: recommendedReactConfig.settings
|
|
1067
1066
|
}, {
|
|
1068
1067
|
files,
|
|
1069
|
-
name: "zayne/react/official/
|
|
1068
|
+
name: "zayne/react/official/rules",
|
|
1070
1069
|
rules: {
|
|
1071
1070
|
"react-hooks/exhaustive-deps": "warn",
|
|
1072
1071
|
"react-hooks/rules-of-hooks": "error"
|
|
1073
1072
|
}
|
|
1074
|
-
}, {
|
|
1075
|
-
files,
|
|
1076
|
-
name: "zayne/react/official/rules",
|
|
1077
|
-
rules: {
|
|
1078
|
-
"react-hooks/error-boundaries": "error",
|
|
1079
|
-
"react-hooks/globals": "error",
|
|
1080
|
-
"react-hooks/immutability": "error",
|
|
1081
|
-
"react-hooks/purity": "warn",
|
|
1082
|
-
"react-hooks/refs": "error",
|
|
1083
|
-
"react-hooks/set-state-in-effect": "warn",
|
|
1084
|
-
"react-hooks/set-state-in-render": "error",
|
|
1085
|
-
"react-hooks/static-components": "warn",
|
|
1086
|
-
"react-hooks/use-memo": "warn"
|
|
1087
|
-
}
|
|
1088
1073
|
}, {
|
|
1089
1074
|
files: typescript$1 ? filesTypeAware : files,
|
|
1090
1075
|
...typescript$1 && { ignores: ignoresTypeAware },
|
|
@@ -1116,13 +1101,22 @@ const react = async (options = {}) => {
|
|
|
1116
1101
|
});
|
|
1117
1102
|
if (compiler && eslintPluginReact) config.push({
|
|
1118
1103
|
files,
|
|
1119
|
-
name: "zayne/react/compiler/rules",
|
|
1104
|
+
name: "zayne/react/official/compiler/rules",
|
|
1120
1105
|
rules: {
|
|
1121
1106
|
"react-hooks/config": "error",
|
|
1107
|
+
"react-hooks/error-boundaries": "error",
|
|
1122
1108
|
"react-hooks/gating": "error",
|
|
1109
|
+
"react-hooks/globals": "error",
|
|
1110
|
+
"react-hooks/immutability": "error",
|
|
1123
1111
|
"react-hooks/incompatible-library": "warn",
|
|
1124
1112
|
"react-hooks/preserve-manual-memoization": "warn",
|
|
1125
|
-
"react-hooks/
|
|
1113
|
+
"react-hooks/purity": "warn",
|
|
1114
|
+
"react-hooks/refs": "error",
|
|
1115
|
+
"react-hooks/set-state-in-effect": "warn",
|
|
1116
|
+
"react-hooks/set-state-in-render": "error",
|
|
1117
|
+
"react-hooks/static-components": "warn",
|
|
1118
|
+
"react-hooks/unsupported-syntax": "error",
|
|
1119
|
+
"react-hooks/use-memo": "warn"
|
|
1126
1120
|
}
|
|
1127
1121
|
});
|
|
1128
1122
|
if (refresh && eslintPluginReactRefresh) config.push({
|
|
@@ -1602,7 +1596,6 @@ const typescript = async (options = {}) => {
|
|
|
1602
1596
|
languageOptions: {
|
|
1603
1597
|
parser: tsEslint.parser,
|
|
1604
1598
|
parserOptions: {
|
|
1605
|
-
ecmaFeatures: { globalReturn: true },
|
|
1606
1599
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1607
1600
|
sourceType: "module",
|
|
1608
1601
|
...parserOptions,
|