chore(lint): enable stricter error rules

This commit is contained in:
Peter Steinberger
2026-06-01 01:12:00 +01:00
parent 0bfba7e26d
commit 27dde7a4d6
458 changed files with 3159 additions and 936 deletions

View File

@@ -964,8 +964,10 @@ async function main() {
}
if (import.meta.url === `file://${process.argv[1]}`) {
main().catch((error) => {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
});
main().catch(
/** @param {unknown} error */ (error) => {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
},
);
}

View File

@@ -148,7 +148,10 @@ export async function fetchProofComments({
lastError = error;
}
}
throw lastError ?? new Error("No GitHub token available for proof comment lookup.");
throw toLintErrorObject(
lastError ?? new Error("No GitHub token available for proof comment lookup."),
"Non-Error thrown",
);
}
function isMainModule() {
@@ -231,3 +234,17 @@ export const testing = {
if (isMainModule()) {
await main();
}
function toLintErrorObject(value, fallbackMessage) {
if (value instanceof Error) {
return value;
}
if (typeof value === "string") {
return new Error(value);
}
const error = new Error(fallbackMessage, { cause: value });
if ((typeof value === "object" && value !== null) || typeof value === "function") {
Object.assign(error, value);
}
return error;
}