@@ -53,6 +53,8 @@ function lint(input, options) {
53
53
merge ( options , this . options . tslint ) ;
54
54
}
55
55
56
+ var bailEnabled = ( this . options . bail === true ) ;
57
+
56
58
//Override options in tslint.json by those passed to the loader as a query string
57
59
var query = loaderUtils . parseQuery ( this . query ) ;
58
60
merge ( options , query ) ;
@@ -61,19 +63,23 @@ function lint(input, options) {
61
63
var result = linter . lint ( ) ;
62
64
var emitter = options . emitErrors ? this . emitError : this . emitWarning ;
63
65
64
- report ( result , emitter , options . failOnHint , options . fileOutput ) ;
66
+ report ( result , emitter , options . failOnHint , options . fileOutput , this . resourcePath , bailEnabled ) ;
65
67
}
66
68
67
- function report ( result , emitter , failOnHint , fileOutputOpts ) {
69
+ function report ( result , emitter , failOnHint , fileOutputOpts , filename , bailEnabled ) {
68
70
if ( result . failureCount === 0 ) return ;
69
71
emitter ( result . output ) ;
70
72
71
73
if ( fileOutputOpts && fileOutputOpts . dir ) {
72
74
writeToFile ( fileOutputOpts , result ) ;
73
75
}
74
76
75
- if ( failOnHint ) {
76
- throw new Error ( "Compilation failed due to tslint errors." ) ;
77
+ if ( failOnHint ) {
78
+ var messages = "" ;
79
+ if ( bailEnabled ) {
80
+ messages = "\n\n" + filename + "\n" + result . output ;
81
+ }
82
+ throw new Error ( "Compilation failed due to tslint errors." + messages ) ;
77
83
}
78
84
}
79
85
0 commit comments