async function checkFormat()

in scripts/check-format.ts [22:50]


async function checkFormat(): Promise<void> {
  const prettierPromise = new Promise<boolean>((resolve) => {
    exec(
      `npx prettier -c ${getFormatPatternsString()}`,
      (error, stdout, stderr) => {
        console.log(stdout);
        console.log(stderr);
        if (error) {
          resolve(true);
        }
        resolve(false);
      },
    );
  });
  const prettierUpdated = await prettierPromise;
  const licensesUpdated = await doLicense(false);
  let exitCode = 0;
  if (licensesUpdated) {
    console.error(
      "License headers were changed. Make sure to run `npm run format`.",
    );
    exitCode = 1;
  }
  if (prettierUpdated) {
    console.error("Formatting needs fixes. Make sure to run `npm run format`.");
    exitCode = 1;
  }
  process.exit(exitCode);
}