chore: migrate formatting to Oxfmt (#615)

This commit is contained in:
morluto
2026-10-06 01:59:19 +08:00
committed by GitHub
parent f557207887
commit 5daaa453ff
25 changed files with 514 additions and 139 deletions
+12
View File
@@ -0,0 +1,12 @@
import { format } from "oxfmt";
import config from "../../.oxfmtrc.json" with { type: "json" };
/** Format generated source with the same options as the repository formatter. */
export const formatGeneratedFile = async (fileName, source) => {
const result = await format(fileName, source, config);
if (result.errors.length > 0)
throw new Error(
`Cannot format ${fileName}: ${result.errors.map(({ message }) => message).join("; ")}`,
);
return result.code;
};