File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,12 @@ export class IncrementalChecker {
270
270
271
271
// normalize and deduplicate diagnostics
272
272
return NormalizedMessage . deduplicate (
273
- diagnostics . map ( NormalizedMessage . createFromDiagnostic )
273
+ diagnostics . map ( d =>
274
+ NormalizedMessage . createFromDiagnostic (
275
+ ts . flattenDiagnosticMessageText ,
276
+ d
277
+ )
278
+ )
274
279
) ;
275
280
}
276
281
Original file line number Diff line number Diff line change 1
- import {
2
- Diagnostic ,
3
- DiagnosticCategory ,
4
- flattenDiagnosticMessageText
5
- } from 'typescript' ;
1
+ import { Diagnostic , DiagnosticMessageChain } from 'typescript' ;
6
2
import { RuleFailure } from 'tslint' ;
7
3
8
4
type ErrorType = 'diagnostic' | 'lint' ;
@@ -45,7 +41,13 @@ export class NormalizedMessage {
45
41
}
46
42
47
43
// message types
48
- static createFromDiagnostic ( diagnostic : Diagnostic ) {
44
+ static createFromDiagnostic (
45
+ flattenDiagnosticMessageText : (
46
+ messageText : string | DiagnosticMessageChain | undefined ,
47
+ newLine : string
48
+ ) => string ,
49
+ diagnostic : Diagnostic
50
+ ) {
49
51
let file : string ;
50
52
let line : number ;
51
53
let character : number ;
@@ -61,9 +63,10 @@ export class NormalizedMessage {
61
63
return new NormalizedMessage ( {
62
64
type : NormalizedMessage . TYPE_DIAGNOSTIC ,
63
65
code : diagnostic . code ,
64
- severity : DiagnosticCategory [
65
- diagnostic . category
66
- ] . toLowerCase ( ) as Severity ,
66
+ // TODO: Keep in sync with TypeScript's DiagnosticCategory.Error or pass in
67
+ severity : ( diagnostic . category . toString ( ) === '1'
68
+ ? NormalizedMessage . SEVERITY_ERROR
69
+ : NormalizedMessage . SEVERITY_WARNING ) as Severity ,
67
70
content : flattenDiagnosticMessageText ( diagnostic . messageText , '\n' ) ,
68
71
file,
69
72
line,
You can’t perform that action at this time.
0 commit comments