@ivuorinen/eslint-config 2.0.5 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivuorinen/eslint-config",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "ivuorinen's shareable configuration for ESLint.",
5
5
  "author": {
6
6
  "name": "Ismo Vuorinen",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@eslint/js": "^10.0.1",
57
- "@ivuorinen/config-checker": "^2.2.1",
57
+ "@ivuorinen/config-checker": "^2.7.0",
58
58
  "eslint": "^10.2.0",
59
59
  "eslint-config-eslint": "^14.0.0",
60
60
  "eslint-config-prettier": "^10.1.8",
@@ -63,12 +63,8 @@
63
63
  },
64
64
  "devDependencies": {
65
65
  "@ivuorinen/semantic-release-config": "^3.0.0",
66
- "vitest": "^4.1.2"
66
+ "vite": "^8.3.5",
67
+ "vitest": "^5.0.0"
67
68
  },
68
- "packageManager": "yarn@4.18.1",
69
- "resolutions": {
70
- "brace-expansion": "^5.0.5",
71
- "picomatch": "^4.0.4",
72
- "undici": "^8.0.0"
73
- }
69
+ "packageManager": "yarn@4.19.0"
74
70
  }
@@ -1,28 +1,14 @@
1
1
  "use strict";
2
2
 
3
- /* eslint no-console: "off", n/no-process-exit: "off" -- CLI app that gives users feedback */
3
+ /* eslint no-console: "off" -- CLI app that gives users feedback */
4
4
 
5
- const fs = require("node:fs");
6
- const path = require("node:path");
7
- const process = require("node:process");
8
- const checkConfig = require("@ivuorinen/config-checker");
5
+ const { writeStarterConfig } = require("@ivuorinen/config-checker");
9
6
 
10
7
  // This runs on every consumer install, and a non-zero exit fails that whole
11
- // install. The starter config is a convenience, so every step below degrades to
12
- // a message instead of throwing.
13
-
14
- // INIT_CWD is an npm/yarn convention, not a guarantee.
15
- const cwd = process.env.INIT_CWD || process.cwd();
16
- const foundConfig = checkConfig("eslint", cwd);
17
-
18
- if (foundConfig.length > 0) {
19
- console.log("eslint-config: Found existing eslint config file, skipping creation.");
20
- console.log("eslint-config: If you want to create a new config file, please remove the existing one.");
21
- console.log(`eslint-config: Found config files at: ${foundConfig.join(", ")}`);
22
- process.exit(0);
23
- }
24
-
25
- const filePath = path.join(cwd, "eslint.config.mjs");
8
+ // install. writeStarterConfig never throws: it falls back to the working
9
+ // directory when INIT_CWD is unset, creates the file with "wx" so a config a
10
+ // concurrent install wrote is never overwritten, and returns a failed write for
11
+ // this script to report.
26
12
  const fileConfig = `import ivuorinenConfig from '@ivuorinen/eslint-config';
27
13
 
28
14
  export default [
@@ -36,14 +22,13 @@ export default [
36
22
  }
37
23
  ];
38
24
  `;
25
+ const result = writeStarterConfig("eslint", "eslint.config.mjs", fileConfig);
39
26
 
40
- // "wx" makes "does it exist?" and "write it" one atomic step, so a concurrent
41
- // install cannot create the file in between and have it overwritten.
42
- try {
43
- fs.writeFileSync(filePath, fileConfig, { flag: "wx" });
44
- } catch (error) {
45
- if (error.code !== "EEXIST") {
46
- console.log(`eslint-config: could not write ${filePath} (${error.code || error.message}).`);
47
- console.log("eslint-config: create it manually and spread @ivuorinen/eslint-config into its export.");
48
- }
27
+ if (result.status === "found") {
28
+ console.log("eslint-config: Found existing eslint config file, skipping creation.");
29
+ console.log("eslint-config: If you want to create a new config file, please remove the existing one.");
30
+ console.log(`eslint-config: Found config files at: ${result.found.join(", ")}`);
31
+ } else if (result.status === "failed") {
32
+ console.log(`eslint-config: could not write ${result.filePath} (${result.error.code || result.error.message}).`);
33
+ console.log("eslint-config: create it manually and spread @ivuorinen/eslint-config into its export.");
49
34
  }