@zayne-labs/eslint-config 0.13.6 → 0.13.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/dist/cli/index.js CHANGED
@@ -10,7 +10,7 @@ import fsp from "node:fs/promises";
10
10
  import parse from "parse-gitignore";
11
11
  import { execSync } from "node:child_process";
12
12
  //#region package.json
13
- var version = "0.13.6";
13
+ var version = "0.13.7";
14
14
  //#endregion
15
15
  //#region src/cli/constants.ts
16
16
  const vscodeSettingsString = `
@@ -137,11 +137,11 @@ const updateEslintFiles = async (result) => {
137
137
  //#endregion
138
138
  //#region src/cli/constants-generated.ts
139
139
  const versionsMap = defineEnum({
140
- "@eslint-react/eslint-plugin": "^4.2.3",
140
+ "@eslint-react/eslint-plugin": "^5.6.0",
141
141
  "astro-eslint-parser": "^1.4.0",
142
142
  eslint: "^10.2.1",
143
143
  "eslint-plugin-astro": "^1.7.0",
144
- "eslint-plugin-better-tailwindcss": "^4.4.1",
144
+ "eslint-plugin-better-tailwindcss": "^4.5.0",
145
145
  "eslint-plugin-react-hooks": "^7.1.1",
146
146
  "eslint-plugin-react-refresh": "^0.5.2",
147
147
  "eslint-plugin-react-you-might-not-need-an-effect": "^0.9.3",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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":["","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: [\n\t\t\"@eslint-react/eslint-plugin\",\n\t\t\"eslint-plugin-react-hooks\",\n\t\t\"eslint-plugin-react-refresh\",\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\",\n\t],\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","/* eslint-disable ts-eslint/restrict-template-expressions -- Ignore */\nimport { 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\": \"^4.2.3\",\n\t\"astro-eslint-parser\": \"^1.4.0\",\n\teslint: \"^10.2.1\",\n\t\"eslint-plugin-astro\": \"^1.7.0\",\n\t\"eslint-plugin-better-tailwindcss\": \"^4.4.1\",\n\t\"eslint-plugin-react-hooks\": \"^7.1.1\",\n\t\"eslint-plugin-react-refresh\": \"^0.5.2\",\n\t\"eslint-plugin-react-you-might-not-need-an-effect\": \"^0.9.3\",\n\t\"eslint-plugin-solid\": \"^0.14.5\",\n\t\"eslint-plugin-svelte\": \"^3.17.1\",\n\t\"eslint-plugin-vue\": \"^10.9.0\",\n\t\"eslint-processor-vue-blocks\": \"^2.0.0\",\n\t\"svelte-eslint-parser\": \"^1.6.0\",\n\t\"vue-eslint-parser\": \"^10.4.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 * as ansis 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(ansis.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(ansis.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`\"${JSON.stringify(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`\"${JSON.stringify(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 { runCli, type CliRunOptions } 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":";;;;;;;;;;;;;;;ACIA,MAAa,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCpC,MAAa,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,MAAa,aAAqC,iBAAiB,KAAK,EAAE,YAAY,MAAM;AAE5F,MAAa,eAA2D,CACvE;CACC,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
+ {"version":3,"file":"index.js","names":[],"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":["","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: [\n\t\t\"@eslint-react/eslint-plugin\",\n\t\t\"eslint-plugin-react-hooks\",\n\t\t\"eslint-plugin-react-refresh\",\n\t\t\"eslint-plugin-react-you-might-not-need-an-effect\",\n\t],\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","/* eslint-disable ts-eslint/restrict-template-expressions -- Ignore */\nimport { 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\": \"^5.6.0\",\n\t\"astro-eslint-parser\": \"^1.4.0\",\n\teslint: \"^10.2.1\",\n\t\"eslint-plugin-astro\": \"^1.7.0\",\n\t\"eslint-plugin-better-tailwindcss\": \"^4.5.0\",\n\t\"eslint-plugin-react-hooks\": \"^7.1.1\",\n\t\"eslint-plugin-react-refresh\": \"^0.5.2\",\n\t\"eslint-plugin-react-you-might-not-need-an-effect\": \"^0.9.3\",\n\t\"eslint-plugin-solid\": \"^0.14.5\",\n\t\"eslint-plugin-svelte\": \"^3.17.1\",\n\t\"eslint-plugin-vue\": \"^10.9.0\",\n\t\"eslint-processor-vue-blocks\": \"^2.0.0\",\n\t\"svelte-eslint-parser\": \"^1.6.0\",\n\t\"vue-eslint-parser\": \"^10.4.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 * as ansis 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(ansis.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(ansis.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`\"${JSON.stringify(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`\"${JSON.stringify(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 { runCli, type CliRunOptions } 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"],"m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a,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"}
@@ -3559,11 +3559,6 @@ interface RuleOptions {
3559
3559
  * @see https://react.dev/learn/you-might-not-need-an-effect#resetting-all-state-when-a-prop-changes
3560
3560
  */
3561
3561
  'react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change'?: Linter.RuleEntry<[]>;
3562
- /**
3563
- * Disallows higher order functions that define components or hooks inside them.
3564
- * @see https://eslint-react.xyz/docs/rules/component-hook-factories
3565
- */
3566
- 'react/component-hook-factories'?: Linter.RuleEntry<[]>;
3567
3562
  /**
3568
3563
  * Disallows DOM elements from using 'dangerouslySetInnerHTML'.
3569
3564
  * @see https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
@@ -3644,11 +3639,6 @@ interface RuleOptions {
3644
3639
  * @see https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
3645
3640
  */
3646
3641
  'react/dom-no-void-elements-with-children'?: Linter.RuleEntry<[]>;
3647
- /**
3648
- * Enforces importing React DOM via a namespace import.
3649
- * @see https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
3650
- */
3651
- 'react/dom-prefer-namespace-import'?: Linter.RuleEntry<[]>;
3652
3642
  /**
3653
3643
  * Validates usage of Error Boundaries instead of try/catch for errors in child components.
3654
3644
  * @see https://eslint-react.xyz/docs/rules/error-boundaries
@@ -3659,6 +3649,11 @@ interface RuleOptions {
3659
3649
  * @see https://github.com/facebook/react/issues/14920
3660
3650
  */
3661
3651
  'react/exhaustive-deps'?: Linter.RuleEntry<ReactExhaustiveDeps>;
3652
+ /**
3653
+ * Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
3654
+ * @see https://eslint-react.xyz/docs/rules/globals
3655
+ */
3656
+ 'react/globals'?: Linter.RuleEntry<[]>;
3662
3657
  /**
3663
3658
  * Validates against mutating props, state, and other values that are immutable.
3664
3659
  * @see https://eslint-react.xyz/docs/rules/immutability
@@ -3862,11 +3857,6 @@ interface RuleOptions {
3862
3857
  * @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
3863
3858
  */
3864
3859
  'react/no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
3865
- /**
3866
- * Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
3867
- * @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
3868
- */
3869
- 'react/no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
3870
3860
  /**
3871
3861
  * Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
3872
3862
  * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
@@ -3882,16 +3872,6 @@ interface RuleOptions {
3882
3872
  * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
3883
3873
  */
3884
3874
  'react/no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
3885
- /**
3886
- * Disallows unnecessary usage of 'useCallback'.
3887
- * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
3888
- */
3889
- 'react/no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
3890
- /**
3891
- * Disallows unnecessary usage of 'useMemo'.
3892
- * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
3893
- */
3894
- 'react/no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
3895
3875
  /**
3896
3876
  * Enforces that a function with the 'use' prefix uses at least one Hook inside it.
3897
3877
  * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
@@ -3932,26 +3912,11 @@ interface RuleOptions {
3932
3912
  * @see https://eslint-react.xyz/docs/rules/no-unused-props
3933
3913
  */
3934
3914
  'react/no-unused-props'?: Linter.RuleEntry<[]>;
3935
- /**
3936
- * Warns about unused class component state.
3937
- * @see https://eslint-react.xyz/docs/rules/no-unused-state
3938
- */
3939
- 'react/no-unused-state'?: Linter.RuleEntry<[]>;
3940
3915
  /**
3941
3916
  * Replaces usage of 'useContext' with 'use'.
3942
3917
  * @see https://eslint-react.xyz/docs/rules/no-use-context
3943
3918
  */
3944
3919
  'react/no-use-context'?: Linter.RuleEntry<[]>;
3945
- /**
3946
- * Enforces destructuring assignment for component props and context.
3947
- * @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
3948
- */
3949
- 'react/prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
3950
- /**
3951
- * Enforces importing React via a namespace import.
3952
- * @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
3953
- */
3954
- 'react/prefer-namespace-import'?: Linter.RuleEntry<[]>;
3955
3920
  /**
3956
3921
  * Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
3957
3922
  * @see https://eslint-react.xyz/docs/rules/purity
@@ -3982,6 +3947,11 @@ interface RuleOptions {
3982
3947
  * @see https://eslint-react.xyz/docs/rules/set-state-in-render
3983
3948
  */
3984
3949
  'react/set-state-in-render'?: Linter.RuleEntry<[]>;
3950
+ /**
3951
+ * Validates that components are static, not recreated every render.
3952
+ * @see https://eslint-react.xyz/docs/rules/static-components
3953
+ */
3954
+ 'react/static-components'?: Linter.RuleEntry<[]>;
3985
3955
  /**
3986
3956
  * Validates against syntax that React Compiler does not support.
3987
3957
  * @see https://eslint-react.xyz/docs/rules/unsupported-syntax
@@ -4002,6 +3972,11 @@ interface RuleOptions {
4002
3972
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
4003
3973
  */
4004
3974
  'react/web-api-no-leaked-event-listener'?: Linter.RuleEntry<[]>;
3975
+ /**
3976
+ * Enforces that every 'fetch' in a component or custom hook has a corresponding 'AbortController' abort in the cleanup function.
3977
+ * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
3978
+ */
3979
+ 'react/web-api-no-leaked-fetch'?: Linter.RuleEntry<[]>;
4005
3980
  /**
4006
3981
  * Enforces that every 'setInterval' in a component or custom hook has a corresponding 'clearInterval'.
4007
3982
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
@@ -4017,11 +3992,6 @@ interface RuleOptions {
4017
3992
  * @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
4018
3993
  */
4019
3994
  'react/web-api-no-leaked-timeout'?: Linter.RuleEntry<[]>;
4020
- /**
4021
- * Disallows higher order functions that define components or hooks inside them.
4022
- * @see https://eslint-react.xyz/docs/rules/component-hook-factories
4023
- */
4024
- 'react/x-component-hook-factories'?: Linter.RuleEntry<[]>;
4025
3995
  /**
4026
3996
  * Validates usage of Error Boundaries instead of try/catch for errors in child components.
4027
3997
  * @see https://eslint-react.xyz/docs/rules/error-boundaries
@@ -4032,6 +4002,11 @@ interface RuleOptions {
4032
4002
  * @see https://github.com/facebook/react/issues/14920
4033
4003
  */
4034
4004
  'react/x-exhaustive-deps'?: Linter.RuleEntry<ReactXExhaustiveDeps>;
4005
+ /**
4006
+ * Validates against assignment/mutation of globals during render, part of ensuring that side effects must run outside of render.
4007
+ * @see https://eslint-react.xyz/docs/rules/globals
4008
+ */
4009
+ 'react/x-globals'?: Linter.RuleEntry<[]>;
4035
4010
  /**
4036
4011
  * Validates against mutating props, state, and other values that are immutable.
4037
4012
  * @see https://eslint-react.xyz/docs/rules/immutability
@@ -4172,11 +4147,6 @@ interface RuleOptions {
4172
4147
  * @see https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
4173
4148
  */
4174
4149
  'react/x-no-nested-lazy-component-declarations'?: Linter.RuleEntry<[]>;
4175
- /**
4176
- * Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'.
4177
- * @see https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
4178
- */
4179
- 'react/x-no-redundant-should-component-update'?: Linter.RuleEntry<[]>;
4180
4150
  /**
4181
4151
  * Disallows calling 'this.setState' in 'componentDidMount' outside functions such as callbacks.
4182
4152
  * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
@@ -4192,16 +4162,6 @@ interface RuleOptions {
4192
4162
  * @see https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
4193
4163
  */
4194
4164
  'react/x-no-set-state-in-component-will-update'?: Linter.RuleEntry<[]>;
4195
- /**
4196
- * Disallows unnecessary usage of 'useCallback'.
4197
- * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
4198
- */
4199
- 'react/x-no-unnecessary-use-callback'?: Linter.RuleEntry<[]>;
4200
- /**
4201
- * Disallows unnecessary usage of 'useMemo'.
4202
- * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
4203
- */
4204
- 'react/x-no-unnecessary-use-memo'?: Linter.RuleEntry<[]>;
4205
4165
  /**
4206
4166
  * Enforces that a function with the 'use' prefix uses at least one Hook inside it.
4207
4167
  * @see https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
@@ -4242,26 +4202,11 @@ interface RuleOptions {
4242
4202
  * @see https://eslint-react.xyz/docs/rules/no-unused-props
4243
4203
  */
4244
4204
  'react/x-no-unused-props'?: Linter.RuleEntry<[]>;
4245
- /**
4246
- * Warns about unused class component state.
4247
- * @see https://eslint-react.xyz/docs/rules/no-unused-state
4248
- */
4249
- 'react/x-no-unused-state'?: Linter.RuleEntry<[]>;
4250
4205
  /**
4251
4206
  * Replaces usage of 'useContext' with 'use'.
4252
4207
  * @see https://eslint-react.xyz/docs/rules/no-use-context
4253
4208
  */
4254
4209
  'react/x-no-use-context'?: Linter.RuleEntry<[]>;
4255
- /**
4256
- * Enforces destructuring assignment for component props and context.
4257
- * @see https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
4258
- */
4259
- 'react/x-prefer-destructuring-assignment'?: Linter.RuleEntry<[]>;
4260
- /**
4261
- * Enforces importing React via a namespace import.
4262
- * @see https://eslint-react.xyz/docs/rules/prefer-namespace-import
4263
- */
4264
- 'react/x-prefer-namespace-import'?: Linter.RuleEntry<[]>;
4265
4210
  /**
4266
4211
  * Validates that components and hooks are pure by checking that they do not call known-impure functions during render.
4267
4212
  * @see https://eslint-react.xyz/docs/rules/purity
@@ -4287,6 +4232,11 @@ interface RuleOptions {
4287
4232
  * @see https://eslint-react.xyz/docs/rules/set-state-in-render
4288
4233
  */
4289
4234
  'react/x-set-state-in-render'?: Linter.RuleEntry<[]>;
4235
+ /**
4236
+ * Validates that components are static, not recreated every render.
4237
+ * @see https://eslint-react.xyz/docs/rules/static-components
4238
+ */
4239
+ 'react/x-static-components'?: Linter.RuleEntry<[]>;
4290
4240
  /**
4291
4241
  * Validates against syntax that React Compiler does not support.
4292
4242
  * @see https://eslint-react.xyz/docs/rules/unsupported-syntax
@@ -15333,6 +15283,7 @@ type TailwindcssBetterEnforceCanonicalClasses = [] | [{
15333
15283
  rootFontSize?: number;
15334
15284
  cwd?: string;
15335
15285
  collapse?: boolean;
15286
+ ignore?: string[];
15336
15287
  logical?: boolean;
15337
15288
  }]; // ----- tailwindcss-better/enforce-consistent-class-order -----
15338
15289
  type TailwindcssBetterEnforceConsistentClassOrder = [] | [{
@@ -15929,6 +15880,7 @@ type TailwindcssBetterEnforceConsistentLineWrapping = [] | [{
15929
15880
  preferSingleLine?: boolean;
15930
15881
  printWidth?: number;
15931
15882
  strictness?: ("strict" | "loose");
15883
+ tabWidth?: number;
15932
15884
  }]; // ----- tailwindcss-better/enforce-consistent-variable-syntax -----
15933
15885
  type TailwindcssBetterEnforceConsistentVariableSyntax = [] | [{
15934
15886
  selectors?: ({
@@ -21108,4 +21060,4 @@ interface OptionsConfig extends OptionsComponentExts, OptionsComponentExtsTypeAw
21108
21060
  type ExtractOptions<TUnion> = Extract<TUnion, object>;
21109
21061
  //#endregion
21110
21062
  export { RuleOptions as A, OptionsTypeScriptErasableOnly as C, OptionsVue as D, OptionsTypescript as E, TypedFlatConfigItem as O, OptionsTanstack as S, OptionsTypeScriptWithTypes as T, OptionsReact as _, OptionsConfig as a, OptionsTailwindCSS as b, OptionsHasJsx as c, OptionsJSX as d, OptionsMarkdown as f, OptionsPnpm as g, OptionsOverridesMultiple as h, OptionsComponentExtsTypeAware as i, ConfigNames as k, OptionsHasTypeScript as l, OptionsOverrides as m, OptionsAppType as n, OptionsE18e as o, OptionsNode as p, OptionsComponentExts as r, OptionsFiles as s, ExtractOptions as t, OptionsIsInEditor as u, OptionsRegExp as v, OptionsTypeScriptParserOptions as w, OptionsTailwindCSSBetter as x, OptionsStylistic as y };
21111
- //# sourceMappingURL=index-BF0lj0uZ.d.ts.map
21063
+ //# sourceMappingURL=index-DAz17cHA.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as RuleOptions, C as OptionsTypeScriptErasableOnly, D as OptionsVue, E as OptionsTypescript, O as TypedFlatConfigItem, S as OptionsTanstack, T as OptionsTypeScriptWithTypes, _ as OptionsReact, a as OptionsConfig, b as OptionsTailwindCSS, c as OptionsHasJsx, d as OptionsJSX, f as OptionsMarkdown, g as OptionsPnpm, h as OptionsOverridesMultiple, i as OptionsComponentExtsTypeAware, k as ConfigNames, l as OptionsHasTypeScript, m as OptionsOverrides, n as OptionsAppType, o as OptionsE18e, p as OptionsNode, r as OptionsComponentExts, s as OptionsFiles, t as ExtractOptions, u as OptionsIsInEditor, v as OptionsRegExp, w as OptionsTypeScriptParserOptions, x as OptionsTailwindCSSBetter, y as OptionsStylistic } from "./index-BF0lj0uZ.js";
1
+ import { A as RuleOptions, C as OptionsTypeScriptErasableOnly, D as OptionsVue, E as OptionsTypescript, O as TypedFlatConfigItem, S as OptionsTanstack, T as OptionsTypeScriptWithTypes, _ as OptionsReact, a as OptionsConfig, b as OptionsTailwindCSS, c as OptionsHasJsx, d as OptionsJSX, f as OptionsMarkdown, g as OptionsPnpm, h as OptionsOverridesMultiple, i as OptionsComponentExtsTypeAware, k as ConfigNames, l as OptionsHasTypeScript, m as OptionsOverrides, n as OptionsAppType, o as OptionsE18e, p as OptionsNode, r as OptionsComponentExts, s as OptionsFiles, t as ExtractOptions, u as OptionsIsInEditor, v as OptionsRegExp, w as OptionsTypeScriptParserOptions, x as OptionsTailwindCSSBetter, y as OptionsStylistic } from "./index-DAz17cHA.js";
2
2
  import { Awaitable } from "@zayne-labs/toolkit-type-helpers";
3
3
  import { FlatConfigComposer } from "eslint-flat-config-utils";
4
4
  import { Linter } from "eslint";
package/dist/index.js CHANGED
@@ -1026,7 +1026,7 @@ const react = async (options = {}) => {
1026
1026
  ]);
1027
1027
  const [eslintPluginReact, eslintPluginCustomJsxRules, eslintReactHooks, eslintPluginReactRefresh, eslintPluginReactYouMightNotNeedAnEffect, eslintPluginNextjs] = await Promise.all([
1028
1028
  enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
1029
- enableReact ? interopDefault(import("./jsxRules-CqsZUc21.js")) : void 0,
1029
+ enableReact ? interopDefault(import("./jsxRules-BAjKnxGs.js")) : void 0,
1030
1030
  enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
1031
1031
  refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
1032
1032
  youMightNotNeedAnEffect ? interopDefault(import("eslint-plugin-react-you-might-not-need-an-effect")) : void 0,
@@ -1073,11 +1073,14 @@ const react = async (options = {}) => {
1073
1073
  files,
1074
1074
  name: "zayne/react/unofficial/rules",
1075
1075
  rules: {
1076
+ "react/globals": "error",
1077
+ "react/immutability": "error",
1076
1078
  "react/jsx-shorthand-boolean": "error",
1077
1079
  "react/jsx-shorthand-fragment": "warn",
1078
1080
  "react/no-children-count": "off",
1079
1081
  "react/no-children-only": "off",
1080
1082
  "react/no-clone-element": "off",
1083
+ "react/refs": "error",
1081
1084
  "react/exhaustive-deps": "warn",
1082
1085
  "react/rules-of-hooks": "error",
1083
1086
  ...overrides,
@@ -1090,20 +1093,20 @@ const react = async (options = {}) => {
1090
1093
  rules: {
1091
1094
  "react-hooks/capitalized-calls": "error",
1092
1095
  "react-hooks/config": "error",
1093
- "react-hooks/error-boundaries": "error",
1096
+ "react-hooks/error-boundaries": "off",
1094
1097
  "react-hooks/gating": "error",
1095
- "react-hooks/globals": "error",
1098
+ "react-hooks/globals": "off",
1096
1099
  "react-hooks/hooks": "error",
1097
- "react-hooks/immutability": "error",
1100
+ "react-hooks/immutability": "off",
1098
1101
  "react-hooks/incompatible-library": "warn",
1099
1102
  "react-hooks/no-deriving-state-in-effects": "error",
1100
1103
  "react-hooks/preserve-manual-memoization": "warn",
1101
- "react-hooks/purity": "warn",
1102
- "react-hooks/refs": "error",
1104
+ "react-hooks/purity": "off",
1105
+ "react-hooks/refs": "off",
1103
1106
  "react-hooks/rule-suppression": "off",
1104
1107
  "react-hooks/set-state-in-effect": "off",
1105
- "react-hooks/set-state-in-render": "error",
1106
- "react-hooks/static-components": "error",
1108
+ "react-hooks/set-state-in-render": "off",
1109
+ "react-hooks/static-components": "off",
1107
1110
  "react-hooks/syntax": "error",
1108
1111
  "react-hooks/todo": "warn",
1109
1112
  "react-hooks/unsupported-syntax": "warn",
@@ -1494,6 +1497,7 @@ const tanstack = async (options = {}) => {
1494
1497
  }, {
1495
1498
  name: "zayne/tanstack-query/rules",
1496
1499
  rules: {
1500
+ "tanstack-query/prefer-query-options": "warn",
1497
1501
  ...overrides,
1498
1502
  ...isObject$1(query) && query.overrides
1499
1503
  }