File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const baseArgs =
27
27
* @param fix whether to automatically fix the format
28
28
* @param files files to format
29
29
*/
30
- export function format (
30
+ export async function format (
31
31
options : Options , files : string [ ] = [ ] , fix = false ) : Promise < boolean > {
32
32
const program = createProgram ( options ) ;
33
33
const srcFiles = files . length > 0 ?
@@ -36,7 +36,16 @@ export function format(
36
36
. map ( sourceFile => sourceFile . fileName )
37
37
. filter ( f => ! f . endsWith ( '.d.ts' ) ) ;
38
38
39
- return fix ? fixFormat ( srcFiles ) : checkFormat ( srcFiles ) ;
39
+ if ( fix ) {
40
+ return fixFormat ( srcFiles ) ;
41
+ } else {
42
+ const result = await checkFormat ( srcFiles ) ;
43
+ if ( ! result ) {
44
+ options . logger . error (
45
+ 'clang-format reported errors... run `gts fix` to address.' ) ;
46
+ }
47
+ return result ;
48
+ }
40
49
}
41
50
42
51
/**
You can’t perform that action at this time.
0 commit comments