@antfu/eslint-config 4.2.0 → 4.2.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.
Files changed (3) hide show
  1. package/dist/cli.js +39 -39
  2. package/dist/index.d.ts +897 -178
  3. package/package.json +17 -17
package/dist/cli.js CHANGED
@@ -1,19 +1,19 @@
1
1
  // src/cli/index.ts
2
2
  import process5 from "node:process";
3
3
  import * as p5 from "@clack/prompts";
4
- import c6 from "picocolors";
4
+ import c5 from "ansis";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
7
7
 
8
8
  // src/cli/constants.ts
9
- import c from "picocolors";
9
+ import c from "ansis";
10
10
 
11
11
  // package.json
12
12
  var package_default = {
13
13
  name: "@antfu/eslint-config",
14
14
  type: "module",
15
- version: "4.2.0",
16
- packageManager: "pnpm@10.2.1",
15
+ version: "4.2.1",
16
+ packageManager: "pnpm@10.4.0",
17
17
  description: "Anthony's ESLint config",
18
18
  author: "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
19
19
  license: "MIT",
@@ -109,20 +109,21 @@ var package_default = {
109
109
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
110
110
  "@eslint/markdown": "^6.2.2",
111
111
  "@stylistic/eslint-plugin": "^4.0.0-beta.1",
112
- "@typescript-eslint/eslint-plugin": "^8.23.0",
113
- "@typescript-eslint/parser": "^8.23.0",
114
- "@vitest/eslint-plugin": "^1.1.27",
112
+ "@typescript-eslint/eslint-plugin": "^8.24.0",
113
+ "@typescript-eslint/parser": "^8.24.0",
114
+ "@vitest/eslint-plugin": "^1.1.31",
115
+ ansis: "^3.14.0",
115
116
  "eslint-config-flat-gitignore": "^2.0.0",
116
117
  "eslint-flat-config-utils": "^2.0.1",
117
118
  "eslint-merge-processors": "^2.0.0",
118
- "eslint-plugin-antfu": "^3.0.0",
119
- "eslint-plugin-command": "^3.0.0",
119
+ "eslint-plugin-antfu": "^3.1.0",
120
+ "eslint-plugin-command": "^3.1.0",
120
121
  "eslint-plugin-import-x": "^4.6.1",
121
122
  "eslint-plugin-jsdoc": "^50.6.3",
122
123
  "eslint-plugin-jsonc": "^2.19.1",
123
124
  "eslint-plugin-n": "^17.15.1",
124
125
  "eslint-plugin-no-only-tests": "^3.3.0",
125
- "eslint-plugin-perfectionist": "^4.8.0",
126
+ "eslint-plugin-perfectionist": "^4.9.0",
126
127
  "eslint-plugin-regexp": "^2.7.0",
127
128
  "eslint-plugin-toml": "^0.12.0",
128
129
  "eslint-plugin-unicorn": "^56.0.1",
@@ -130,11 +131,10 @@ var package_default = {
130
131
  "eslint-plugin-vue": "^9.32.0",
131
132
  "eslint-plugin-yml": "^1.16.0",
132
133
  "eslint-processor-vue-blocks": "^2.0.0",
133
- globals: "^15.14.0",
134
+ globals: "^15.15.0",
134
135
  "jsonc-eslint-parser": "^2.4.0",
135
136
  "local-pkg": "^1.0.0",
136
137
  "parse-gitignore": "^2.0.0",
137
- picocolors: "^1.1.1",
138
138
  "toml-eslint-parser": "^0.10.0",
139
139
  "vue-eslint-parser": "^9.4.3",
140
140
  "yaml-eslint-parser": "^1.2.3",
@@ -148,13 +148,13 @@ var package_default = {
148
148
  "@prettier/plugin-xml": "^3.4.1",
149
149
  "@stylistic/eslint-plugin-migrate": "^4.0.0-beta.1",
150
150
  "@types/fs-extra": "^11.0.4",
151
- "@types/node": "^22.13.1",
151
+ "@types/node": "^22.13.4",
152
152
  "@types/prompts": "^2.4.9",
153
153
  "@types/yargs": "^17.0.33",
154
- "@unocss/eslint-plugin": "^65.4.3",
154
+ "@unocss/eslint-plugin": "^65.5.0",
155
155
  "astro-eslint-parser": "^1.2.1",
156
- bumpp: "^10.0.2",
157
- eslint: "^9.20.0",
156
+ bumpp: "^10.0.3",
157
+ eslint: "^9.20.1",
158
158
  "eslint-plugin-astro": "^1.3.1",
159
159
  "eslint-plugin-format": "^1.0.1",
160
160
  "eslint-plugin-react-hooks": "^5.1.0",
@@ -171,7 +171,7 @@ var package_default = {
171
171
  "prettier-plugin-slidev": "^1.0.5",
172
172
  rimraf: "^6.0.1",
173
173
  "simple-git-hooks": "^2.11.1",
174
- svelte: "^5.19.9",
174
+ svelte: "^5.20.1",
175
175
  "svelte-eslint-parser": "^0.43.0",
176
176
  tsup: "^8.3.6",
177
177
  tsx: "^4.19.2",
@@ -181,8 +181,8 @@ var package_default = {
181
181
  },
182
182
  resolutions: {
183
183
  "@eslint-community/eslint-utils": "^4.4.1",
184
- "@typescript-eslint/utils": "^8.23.0",
185
- eslint: "^9.20.0",
184
+ "@typescript-eslint/utils": "^8.24.0",
185
+ eslint: "^9.20.1",
186
186
  tsx: "^4.19.2"
187
187
  },
188
188
  "simple-git-hooks": {
@@ -312,7 +312,7 @@ import fs3 from "node:fs";
312
312
  import path4 from "node:path";
313
313
  import process4 from "node:process";
314
314
  import * as p4 from "@clack/prompts";
315
- import c5 from "picocolors";
315
+ import c4 from "ansis";
316
316
 
317
317
  // src/cli/stages/update-eslint-files.ts
318
318
  import fs from "node:fs";
@@ -320,8 +320,8 @@ import fsp from "node:fs/promises";
320
320
  import path from "node:path";
321
321
  import process from "node:process";
322
322
  import * as p from "@clack/prompts";
323
+ import c2 from "ansis";
323
324
  import parse from "parse-gitignore";
324
- import c2 from "picocolors";
325
325
 
326
326
  // src/cli/utils.ts
327
327
  import { execSync } from "node:child_process";
@@ -356,7 +356,7 @@ async function updateEslintFiles(result) {
356
356
  const pathFlatConfig = path.join(cwd, configFileName);
357
357
  const eslintIgnores = [];
358
358
  if (fs.existsSync(pathESLintIgnore)) {
359
- p.log.step(c2.cyan(`Migrating existing .eslintignore`));
359
+ p.log.step(c2.cyan`Migrating existing .eslintignore`);
360
360
  const content = await fsp.readFile(pathESLintIgnore, "utf-8");
361
361
  const parsed = parse(content);
362
362
  const globs = parsed.globs();
@@ -380,7 +380,7 @@ async function updateEslintFiles(result) {
380
380
  const additionalConfig = [];
381
381
  const eslintConfigContent = getEslintConfigContent(mainConfig, additionalConfig);
382
382
  await fsp.writeFile(pathFlatConfig, eslintConfigContent);
383
- p.log.success(c2.green(`Created ${configFileName}`));
383
+ p.log.success(c2.green`Created ${configFileName}`);
384
384
  const files = fs.readdirSync(cwd);
385
385
  const legacyConfig = [];
386
386
  files.forEach((file) => {
@@ -388,7 +388,7 @@ async function updateEslintFiles(result) {
388
388
  legacyConfig.push(file);
389
389
  });
390
390
  if (legacyConfig.length)
391
- p.note(`${c2.dim(legacyConfig.join(", "))}`, "You can now remove those files manually");
391
+ p.note(c2.dim(legacyConfig.join(", ")), "You can now remove those files manually");
392
392
  }
393
393
 
394
394
  // src/cli/stages/update-package-json.ts
@@ -396,11 +396,11 @@ import fsp2 from "node:fs/promises";
396
396
  import path2 from "node:path";
397
397
  import process2 from "node:process";
398
398
  import * as p2 from "@clack/prompts";
399
- import c3 from "picocolors";
399
+ import c3 from "ansis";
400
400
  async function updatePackageJson(result) {
401
401
  const cwd = process2.cwd();
402
402
  const pathPackageJSON = path2.join(cwd, "package.json");
403
- p2.log.step(c3.cyan(`Bumping @antfu/eslint-config to v${package_default.version}`));
403
+ p2.log.step(c3.cyan`Bumping @antfu/eslint-config to v${package_default.version}`);
404
404
  const pkgContent = await fsp2.readFile(pathPackageJSON, "utf-8");
405
405
  const pkg = JSON.parse(pkgContent);
406
406
  pkg.devDependencies ??= {};
@@ -442,9 +442,9 @@ async function updatePackageJson(result) {
442
442
  }
443
443
  }
444
444
  if (addedPackages.length)
445
- p2.note(`${c3.dim(addedPackages.join(", "))}`, "Added packages");
445
+ p2.note(c3.dim(addedPackages.join(", ")), "Added packages");
446
446
  await fsp2.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
447
- p2.log.success(c3.green(`Changes wrote to package.json`));
447
+ p2.log.success(c3.green`Changes wrote to package.json`);
448
448
  }
449
449
 
450
450
  // src/cli/stages/update-vscode-settings.ts
@@ -453,7 +453,7 @@ import fsp3 from "node:fs/promises";
453
453
  import path3 from "node:path";
454
454
  import process3 from "node:process";
455
455
  import * as p3 from "@clack/prompts";
456
- import c4 from "picocolors";
456
+ import { green } from "ansis";
457
457
  async function updateVscodeSettings(result) {
458
458
  const cwd = process3.cwd();
459
459
  if (!result.updateVscodeSettings)
@@ -465,7 +465,7 @@ async function updateVscodeSettings(result) {
465
465
  if (!fs2.existsSync(settingsPath)) {
466
466
  await fsp3.writeFile(settingsPath, `{${vscodeSettingsString}}
467
467
  `, "utf-8");
468
- p3.log.success(c4.green(`Created .vscode/settings.json`));
468
+ p3.log.success(green`Created .vscode/settings.json`);
469
469
  } else {
470
470
  let settingsContent = await fsp3.readFile(settingsPath, "utf8");
471
471
  settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
@@ -473,7 +473,7 @@ async function updateVscodeSettings(result) {
473
473
  settingsContent += `${vscodeSettingsString}}
474
474
  `;
475
475
  await fsp3.writeFile(settingsPath, settingsContent, "utf-8");
476
- p3.log.success(c4.green(`Updated .vscode/settings.json`));
476
+ p3.log.success(green`Updated .vscode/settings.json`);
477
477
  }
478
478
  }
479
479
 
@@ -483,7 +483,7 @@ async function run(options = {}) {
483
483
  const argTemplate = options.frameworks?.map((m) => m.trim());
484
484
  const argExtra = options.extra?.map((m) => m.trim());
485
485
  if (fs3.existsSync(path4.join(process4.cwd(), "eslint.config.js"))) {
486
- p4.log.warn(c5.yellow(`eslint.config.js already exists, migration wizard exited.`));
486
+ p4.log.warn(c4.yellow`eslint.config.js already exists, migration wizard exited.`);
487
487
  return process4.exit(1);
488
488
  }
489
489
  let result = {
@@ -508,7 +508,7 @@ async function run(options = {}) {
508
508
  return;
509
509
  const message = !isArgTemplateValid && argTemplate ? `"${argTemplate}" isn't a valid template. Please choose from below: ` : "Select a framework:";
510
510
  return p4.multiselect({
511
- message: c5.reset(message),
511
+ message: c4.reset(message),
512
512
  options: frameworkOptions,
513
513
  required: false
514
514
  });
@@ -519,7 +519,7 @@ async function run(options = {}) {
519
519
  return;
520
520
  const message = !isArgExtraValid && argExtra ? `"${argExtra}" isn't a valid extra util. Please choose from below: ` : "Select a extra utils:";
521
521
  return p4.multiselect({
522
- message: c5.reset(message),
522
+ message: c4.reset(message),
523
523
  options: extraOptions,
524
524
  required: false
525
525
  });
@@ -544,15 +544,15 @@ async function run(options = {}) {
544
544
  await updatePackageJson(result);
545
545
  await updateEslintFiles(result);
546
546
  await updateVscodeSettings(result);
547
- p4.log.success(c5.green(`Setup completed`));
548
- p4.outro(`Now you can update the dependencies by run ${c5.blue("pnpm install")} and run ${c5.blue("eslint . --fix")}
547
+ p4.log.success(c4.green`Setup completed`);
548
+ p4.outro(`Now you can update the dependencies by run ${c4.blue("pnpm install")} and run ${c4.blue("eslint . --fix")}
549
549
  `);
550
550
  }
551
551
 
552
552
  // src/cli/index.ts
553
553
  function header() {
554
554
  console.log("\n");
555
- p5.intro(`${c6.green(`@antfu/eslint-config `)}${c6.dim(`v${package_default.version}`)}`);
555
+ p5.intro(`${c5.green`@antfu/eslint-config `}${c5.dim`v${package_default.version}`}`);
556
556
  }
557
557
  var instance = yargs(hideBin(process5.argv)).scriptName("@antfu/eslint-config").usage("").command(
558
558
  "*",
@@ -576,8 +576,8 @@ var instance = yargs(hideBin(process5.argv)).scriptName("@antfu/eslint-config").
576
576
  try {
577
577
  await run(args);
578
578
  } catch (error) {
579
- p5.log.error(c6.inverse(c6.red(" Failed to migrate ")));
580
- p5.log.error(c6.red(`\u2718 ${String(error)}`));
579
+ p5.log.error(c5.inverse.red(" Failed to migrate "));
580
+ p5.log.error(c5.red`✘ ${String(error)}`);
581
581
  process5.exit(1);
582
582
  }
583
583
  }