File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -37,22 +37,29 @@ function main(): void {
37
37
38
38
function checkForUniqueCodes ( messages : string [ ] , diagnosticTable : InputDiagnosticMessageTable ) {
39
39
const originalMessageForCode : string [ ] = [ ] ;
40
+ let numConflicts = 0 ;
40
41
41
42
for ( const currentMessage of messages ) {
42
43
const code = diagnosticTable [ currentMessage ] . code ;
43
44
44
45
if ( code in originalMessageForCode ) {
45
46
const originalMessage = originalMessageForCode [ code ] ;
46
- ts . sys . write ( "\x1b[93m " ) ; // High intensity yellow .
47
- ts . sys . write ( "Warning " ) ;
47
+ ts . sys . write ( "\x1b[91m " ) ; // High intensity red .
48
+ ts . sys . write ( "Error " ) ;
48
49
ts . sys . write ( "\x1b[0m" ) ; // Reset formatting.
49
50
ts . sys . write ( `: Diagnostic code '${ code } ' conflicts between "${ originalMessage } " and "${ currentMessage } ".` ) ;
50
51
ts . sys . write ( ts . sys . newLine + ts . sys . newLine ) ;
52
+
53
+ numConflicts ++ ;
51
54
}
52
55
else {
53
56
originalMessageForCode [ code ] = currentMessage ;
54
57
}
55
58
}
59
+
60
+ if ( numConflicts > 0 ) {
61
+ throw new Error ( `Found ${ numConflicts } conflict(s) in diagnostic codes.` ) ;
62
+ }
56
63
}
57
64
58
65
function buildUniqueNameMap ( names : string [ ] ) : ts . Map < string > {
You can’t perform that action at this time.
0 commit comments