@bfra.me/eslint-config 0.18.1 → 0.19.0

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/lib/index.js CHANGED
@@ -38,7 +38,7 @@ __name(requireOf, "requireOf");
38
38
 
39
39
  // src/configs/fallback.ts
40
40
  async function fallback(missingList, options) {
41
- const rules = await interopDefault(import("./missing-module-for-config-CYJ6LECX.js"));
41
+ const rules = await interopDefault(import("./missing-module-for-config-HE7G3YMJ.js"));
42
42
  return [
43
43
  {
44
44
  plugins: {
@@ -654,7 +654,7 @@ __name(jsdoc, "jsdoc");
654
654
  import { fileURLToPath } from "node:url";
655
655
 
656
656
  // package.json
657
- var version = "0.18.1";
657
+ var version = "0.19.0";
658
658
 
659
659
  // src/parsers/any-parser.ts
660
660
  var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
@@ -11,7 +11,7 @@ import { spawnSync } from "node:child_process";
11
11
  import { existsSync } from "node:fs";
12
12
  import { resolve } from "node:path";
13
13
  import process from "node:process";
14
- import { detectSync, resolveCommand } from "package-manager-detector";
14
+ import { resolveCommand } from "package-manager-detector";
15
15
  import { packageDirectorySync } from "pkg-dir";
16
16
  var installedModules = /* @__PURE__ */ new Set();
17
17
  function tryInstall(module, targetFile = process.cwd()) {
@@ -102,14 +102,20 @@ function installPackageSync(packages, options) {
102
102
  }
103
103
  __name(installPackageSync, "installPackageSync");
104
104
  function detectPackageManagerSync(cwd = process.cwd()) {
105
- const result = detectSync({
106
- cwd,
107
- onUnknown(packageManager) {
108
- console.warn(`Unknown package manager: ${packageManager}`);
109
- return void 0;
105
+ try {
106
+ if (existsSync(resolve(cwd, "package-lock.json"))) {
107
+ return "npm";
110
108
  }
111
- });
112
- return result?.agent || null;
109
+ if (existsSync(resolve(cwd, "yarn.lock"))) {
110
+ return "yarn";
111
+ }
112
+ if (existsSync(resolve(cwd, "pnpm-lock.yaml"))) {
113
+ return "pnpm";
114
+ }
115
+ return null;
116
+ } catch {
117
+ return null;
118
+ }
113
119
  }
114
120
  __name(detectPackageManagerSync, "detectPackageManagerSync");
115
121
 
@@ -167,4 +173,4 @@ export {
167
173
  create,
168
174
  meta
169
175
  };
170
- //# sourceMappingURL=missing-module-for-config-CYJ6LECX.js.map
176
+ //# sourceMappingURL=missing-module-for-config-HE7G3YMJ.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bfra.me/eslint-config",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Shared ESLint configuration for bfra.me",
5
5
  "keywords": [
6
6
  "bfra.me",
@@ -57,15 +57,15 @@
57
57
  "is-in-ci": "1.0.0",
58
58
  "jiti": "2.4.2",
59
59
  "local-pkg": "1.1.1",
60
- "package-manager-detector": "0.2.11",
60
+ "package-manager-detector": "1.1.0",
61
61
  "pkg-dir": "8.0.0",
62
- "typescript-eslint": "8.29.0"
62
+ "typescript-eslint": "8.29.1"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@eslint/config-inspector": "1.0.2",
66
66
  "@eslint/js": "9.24.0",
67
67
  "@types/eslint-config-prettier": "6.11.3",
68
- "@typescript-eslint/types": "8.29.0",
68
+ "@typescript-eslint/types": "8.29.1",
69
69
  "@vitest/eslint-plugin": "1.1.39",
70
70
  "eslint": "9.24.0",
71
71
  "eslint-config-prettier": "10.1.1",
@@ -75,8 +75,8 @@
75
75
  "eslint-typegen": "2.1.0",
76
76
  "tsup": "8.4.0",
77
77
  "tsx": "4.19.3",
78
- "@bfra.me/eslint-config": "0.18.1",
79
- "@bfra.me/prettier-config": "0.15.3",
78
+ "@bfra.me/eslint-config": "0.19.0",
79
+ "@bfra.me/prettier-config": "0.15.4",
80
80
  "@bfra.me/tsconfig": "0.9.7"
81
81
  },
82
82
  "peerDependencies": {
@@ -107,6 +107,6 @@
107
107
  "build-inspector": "eslint-config-inspector build --config ./eslint.config.ts",
108
108
  "dev": "eslint-config-inspector --config ./eslint.config.ts --open false",
109
109
  "generate-types": "tsx ./scripts/generate-types.ts",
110
- "test": "pnpm --filter-prod=\"{.}...\" --loglevel error run build && vitest run"
110
+ "test": "pnpm --filter-prod=\"{.}...\" run build && vitest run"
111
111
  }
112
112
  }
@@ -2,7 +2,7 @@ import {spawnSync} from 'node:child_process'
2
2
  import {existsSync} from 'node:fs'
3
3
  import {resolve} from 'node:path'
4
4
  import process from 'node:process'
5
- import {detectSync, resolveCommand} from 'package-manager-detector'
5
+ import {resolveCommand, type AgentName} from 'package-manager-detector'
6
6
  import {packageDirectorySync} from 'pkg-dir'
7
7
 
8
8
  const installedModules = new Set<string>()
@@ -87,13 +87,25 @@ function installPackageSync(packages: string | string[], options: {cwd: string;
87
87
  return `${result.output}`
88
88
  }
89
89
 
90
- function detectPackageManagerSync(cwd = process.cwd()) {
91
- const result = detectSync({
92
- cwd,
93
- onUnknown(packageManager) {
94
- console.warn(`Unknown package manager: ${packageManager}`)
95
- return undefined
96
- },
97
- })
98
- return result?.agent || null
90
+ function detectPackageManagerSync(cwd = process.cwd()): AgentName | null {
91
+ // We cannot reliably convert an async detect() to sync detectSync()
92
+ // without potentially blocking. The proper fix would be to make this
93
+ // function async, but that would break API compatibility.
94
+ // For now, we'll use a simple fallback approach:
95
+
96
+ try {
97
+ // Look for lockfiles directly
98
+ if (existsSync(resolve(cwd, 'package-lock.json'))) {
99
+ return 'npm'
100
+ }
101
+ if (existsSync(resolve(cwd, 'yarn.lock'))) {
102
+ return 'yarn'
103
+ }
104
+ if (existsSync(resolve(cwd, 'pnpm-lock.yaml'))) {
105
+ return 'pnpm'
106
+ }
107
+ return null
108
+ } catch {
109
+ return null
110
+ }
99
111
  }