Skip to content

Commit 89a667b

Browse files
ref[mnt]: resolves type errors
1 parent 1151459 commit 89a667b

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

npm/bin/commit-lint.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ import { once } from "node:events";
44
import { readFileSync } from "node:fs";
55
import { createRequire } from "node:module";
66

7-
// glibc distros ship /usr/bin/ldd as a script that never mentions musl;
8-
// musl ones either mention it there or lack the glibc runtime header.
97
const isMusl = () => {
108
try {
119
return readFileSync("/usr/bin/ldd", "utf8").includes("musl");
1210
} catch {
13-
return !process.report?.getReport?.().header?.glibcVersionRuntime;
11+
return !(
12+
/** @type {Record<string, any>} */ (process.report?.getReport())?.["header"]?.[
13+
"glibcVersionRuntime"
14+
]
15+
);
1416
}
1517
};
1618

1719
const exe = process.platform === "win32" ? "commit-lint.exe" : "commit-lint";
1820
const libc = process.platform === "linux" && isMusl() ? "-musl" : "";
1921
const pkg = `@atypical/commit-${process.platform}-${process.arch}${libc}`;
2022

21-
let bin = process.env.COMMIT_LINT_BINARY;
23+
let bin = process.env["COMMIT_LINT_BINARY"];
2224
if (!bin) {
2325
try {
2426
bin = createRequire(import.meta.url).resolve(`${pkg}/${exe}`);
2527
} catch {
28+
// oxlint-disable-next-line no-console
2629
console.error(
2730
`commit-lint: ${pkg} is not installed ` +
2831
"(unsupported platform, or optional dependencies were skipped)",
@@ -35,7 +38,8 @@ const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
3538
try {
3639
const [status] = await once(child, "exit");
3740
process.exit(status ?? 1);
38-
} catch (error) {
41+
} catch (/** @type {any} */ error) {
42+
// oxlint-disable-next-line no-console
3943
console.error(`commit-lint: ${error.message}`);
4044
process.exit(127);
4145
}

0 commit comments

Comments
 (0)