microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e542ce8991c3f6d33b280fc94a7bcebc4ffc25f3

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

eng/scripts/check-format.js

21lines · modecode

1// @ts-check
2import {
3 CommandFailedError,
4 ensureDotnetVersion,
5 runDotnetFormat,
6} from "../../packages/internal-build-utils/dist/src/index.js";
7import { runPrettier } from "./helpers.js";
8
9try {
10 await runPrettier("--list-different");
11 await ensureDotnetVersion({ exitWithSuccessInDevBuilds: true });
12 await runDotnetFormat("--verify-no-changes");
13} catch (err) {
14 if (err instanceof CommandFailedError) {
15 console.error(
16 "\nERROR: Files above are not formatted correctly. Run `rush format` and commit the changes."
17 );
18 process.exit(err.proc?.exitCode ?? 1);
19 }
20 throw err;
21}
22