@coderwyd/eslint-config 4.6.3 → 4.7.1

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.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export { };
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import process from "node:process";
2
- import c from "picocolors";
2
+ import { styleText } from "node:util";
3
3
  import yargs from "yargs";
4
4
  import { hideBin } from "yargs/helpers";
5
5
  import fs from "node:fs";
@@ -10,37 +10,41 @@ import prompts from "prompts";
10
10
  import { execSync } from "node:child_process";
11
11
 
12
12
  //#region package.json
13
- var version = "4.6.3";
13
+ var version = "4.7.1";
14
14
  var devDependencies = {
15
- "@antfu/ni": "^25.0.0",
16
- "@eslint-react/eslint-plugin": "^1.52.9",
17
- "@eslint/config-inspector": "^1.2.0",
15
+ "@antfu/ni": "^26.1.0",
16
+ "@eslint-react/eslint-plugin": "^2.2.2",
17
+ "@eslint/config-inspector": "^1.3.0",
18
18
  "@types/eslint-config-prettier": "^6.11.3",
19
- "@types/node": "^24.3.0",
19
+ "@types/node": "^24.7.2",
20
20
  "@types/prompts": "^2.4.9",
21
21
  "@types/yargs": "^17.0.33",
22
- "@unocss/eslint-plugin": "^66.5.0",
23
- "bumpp": "^10.2.3",
24
- "eslint": "^9.34.0",
25
- "eslint-plugin-react-hooks": "6.0.0-rc1",
26
- "eslint-plugin-react-refresh": "^0.4.20",
27
- "eslint-plugin-svelte": "^3.12.0",
22
+ "@unocss/eslint-plugin": "^66.5.3",
23
+ "bumpp": "^10.3.1",
24
+ "eslint": "^9.37.0",
25
+ "eslint-plugin-react-hooks": "7.0.0",
26
+ "eslint-plugin-react-refresh": "^0.4.23",
27
+ "eslint-plugin-svelte": "^3.12.4",
28
28
  "eslint-plugin-tailwindcss": "^3.18.2",
29
- "jiti": "^2.5.1",
29
+ "eslint-typegen": "^2.3.0",
30
+ "jiti": "^2.6.1",
30
31
  "nano-staged": "^0.8.0",
32
+ "prettier": "^3.6.2",
33
+ "publint": "^0.3.14",
31
34
  "simple-git-hooks": "^2.13.1",
32
- "svelte": "^5.38.6",
33
- "svelte-eslint-parser": "^1.3.1",
34
- "tsdown": "^0.14.2",
35
- "typescript": "^5.9.2"
35
+ "svelte": "^5.40.0",
36
+ "svelte-eslint-parser": "^1.3.3",
37
+ "tsdown": "^0.15.7",
38
+ "typescript": "^5.9.3",
39
+ "unplugin-unused": "^0.5.4"
36
40
  };
37
41
 
38
42
  //#endregion
39
43
  //#region src/cli/constants.ts
40
- const ARROW = c.cyan("→");
41
- const CHECK = c.green("✔");
42
- const CROSS = c.red("✘");
43
- const WARN = c.yellow("ℹ");
44
+ const ARROW = styleText("cyan", "→");
45
+ const CHECK = styleText("green", "✔");
46
+ const CROSS = styleText("red", "✘");
47
+ const WARN = styleText("yellow", "ℹ");
44
48
  const eslintVersion = devDependencies.eslint;
45
49
  const vscodeSettingsString = `
46
50
  "editor.formatOnSave": true,
@@ -73,7 +77,7 @@ async function run(options = {}) {
73
77
  const pathPackageJSON = path.join(cwd, "package.json");
74
78
  const pathESLintIngore = path.join(cwd, ".eslintignore");
75
79
  if (fs.existsSync(pathFlatConfig)) {
76
- console.log(c.yellow(`${WARN} eslint.config.js already exists, migration wizard exited.`));
80
+ console.log(styleText("yellow", `${WARN} eslint.config.js already exists, migration wizard exited.`));
77
81
  return process.exit(1);
78
82
  }
79
83
  if (!SKIP_GIT_CHECK && !isGitClean()) {
@@ -85,20 +89,18 @@ async function run(options = {}) {
85
89
  });
86
90
  if (!confirmed) return process.exit(1);
87
91
  }
88
- console.log(c.cyan(`${ARROW} bumping @coderwyd/eslint-config to v${version}`));
92
+ console.log(styleText("cyan", `${ARROW} bumping @coderwyd/eslint-config to v${version}`));
89
93
  const pkgContent = await fsp.readFile(pathPackageJSON, "utf-8");
90
94
  const pkg = JSON.parse(pkgContent);
91
95
  pkg.devDependencies ??= {};
92
96
  pkg.devDependencies["@coderwyd/eslint-config"] = `^${version}`;
93
97
  if (!pkg.devDependencies.eslint) pkg.devDependencies.eslint = eslintVersion;
94
98
  await fsp.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
95
- console.log(c.green(`${CHECK} changes wrote to package.json`));
99
+ console.log(styleText("green", `${CHECK} changes wrote to package.json`));
96
100
  const eslintIgnores = [];
97
101
  if (fs.existsSync(pathESLintIngore)) {
98
- console.log(c.cyan(`${ARROW} migrating existing .eslintignore`));
99
- const content = await fsp.readFile(pathESLintIngore, "utf-8");
100
- const parsed = parse(content);
101
- const globs = parsed.globs();
102
+ console.log(styleText("cyan", `${ARROW} migrating existing .eslintignore`));
103
+ const globs = parse(await fsp.readFile(pathESLintIngore, "utf-8")).globs();
102
104
  for (const glob of globs) if (glob.type === "ignore") eslintIgnores.push(...glob.patterns);
103
105
  else if (glob.type === "unignore") eslintIgnores.push(...glob.patterns.map((pattern) => `!${pattern}`));
104
106
  }
@@ -115,7 +117,7 @@ const { defineConfig } = require('@coderwyd/eslint-config')
115
117
  module.exports = defineConfig({\n${coderwydConfig}\n})
116
118
  `.trimStart();
117
119
  await fsp.writeFile(pathFlatConfig, eslintConfigContent);
118
- console.log(c.green(`${CHECK} created eslint.config.js`));
120
+ console.log(styleText("green", `${CHECK} created eslint.config.js`));
119
121
  const files = fs.readdirSync(cwd);
120
122
  const legacyConfig = [];
121
123
  files.forEach((file) => {
@@ -123,7 +125,7 @@ module.exports = defineConfig({\n${coderwydConfig}\n})
123
125
  });
124
126
  if (legacyConfig.length > 0) {
125
127
  console.log(`${WARN} you can now remove those files manually:`);
126
- console.log(` ${c.dim(legacyConfig.join(", "))}`);
128
+ console.log(` ${styleText("dim", legacyConfig.join(", "))}`);
127
129
  }
128
130
  let promptResult = { updateVscodeSettings: true };
129
131
  if (!SKIP_PROMPT) try {
@@ -145,26 +147,26 @@ module.exports = defineConfig({\n${coderwydConfig}\n})
145
147
  if (!fs.existsSync(dotVscodePath)) await fsp.mkdir(dotVscodePath, { recursive: true });
146
148
  if (!fs.existsSync(settingsPath)) {
147
149
  await fsp.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf-8");
148
- console.log(c.green(`${CHECK} created .vscode/settings.json`));
150
+ console.log(styleText("green", `${CHECK} created .vscode/settings.json`));
149
151
  } else {
150
152
  let settingsContent = await fsp.readFile(settingsPath, "utf8");
151
153
  settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
152
154
  settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
153
155
  settingsContent += `${vscodeSettingsString}}\n`;
154
156
  await fsp.writeFile(settingsPath, settingsContent, "utf-8");
155
- console.log(c.green(`${CHECK} updated .vscode/settings.json`));
157
+ console.log(styleText("green", `${CHECK} updated .vscode/settings.json`));
156
158
  }
157
159
  }
158
- console.log(c.green(`${CHECK} migration completed`));
159
- console.log(`Now you can update the dependencies and run ${c.blue("eslint . --fix")}\n`);
160
+ console.log(styleText("green", `${CHECK} migration completed`));
161
+ console.log(`Now you can update the dependencies and run ${styleText("blue", "eslint . --fix")}\n`);
160
162
  }
161
163
 
162
164
  //#endregion
163
165
  //#region src/cli/index.ts
164
166
  function header() {
165
- console.log(`\n${c.green(`@coderwyd/eslint-config `)}${c.dim(`v${version}`)}`);
167
+ console.log(`\n${styleText("green", `@coderwyd/eslint-config `)}${styleText("dim", `v${version}`)}`);
166
168
  }
167
- const instance = yargs(hideBin(process.argv)).scriptName("@coderwyd/eslint-config").usage("").command("*", "Run the initialization or migration", (args) => args.option("yes", {
169
+ yargs(hideBin(process.argv)).scriptName("@coderwyd/eslint-config").usage("").command("*", "Run the initialization or migration", (args) => args.option("yes", {
168
170
  alias: "y",
169
171
  description: "Skip prompts and use default values",
170
172
  type: "boolean"
@@ -174,12 +176,11 @@ const instance = yargs(hideBin(process.argv)).scriptName("@coderwyd/eslint-confi
174
176
  try {
175
177
  await run(args);
176
178
  } catch (error) {
177
- console.error(c.inverse(c.red(" Failed to migrate ")));
178
- console.error(c.red(`${CROSS} ${String(error)}`));
179
+ console.error(styleText(["red", "inverse"], " Failed to migrate "));
180
+ console.error(styleText("red", `${CROSS} ${String(error)}`));
179
181
  process.exit(1);
180
182
  }
181
- }).showHelpOnFail(false).alias("h", "help").version("version", version).alias("v", "version");
182
- instance.help().argv;
183
+ }).showHelpOnFail(false).alias("h", "help").version("version", version).alias("v", "version").help().argv;
183
184
 
184
185
  //#endregion
185
186
  export { };