@@ -23,7 +23,6 @@ import * as tslint from 'tslint'; // tslint:disable-line:no-implicit-dependencie
23
23
import * as ts from 'typescript' ; // tslint:disable-line:no-implicit-dependencies
24
24
import { stripBom } from '../angular-cli-files/utilities/strip-bom' ;
25
25
26
-
27
26
export interface TslintBuilderOptions {
28
27
tslintConfig ?: string ;
29
28
tsConfig ?: string | string [ ] ;
@@ -45,7 +44,7 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
45
44
try {
46
45
tslint = await import ( 'tslint' ) ; // tslint:disable-line:no-implicit-dependencies
47
46
} catch {
48
- throw new Error ( 'Unable to find TSLint. Ensure TSLint is installed.' ) ;
47
+ throw new Error ( 'Unable to find TSLint. Ensure TSLint is installed.' ) ;
49
48
}
50
49
51
50
const version = tslint . Linter . VERSION && tslint . Linter . VERSION . split ( '.' ) ;
@@ -72,7 +71,7 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
72
71
: null ;
73
72
const Linter = projectTslint . Linter ;
74
73
75
- let result ;
74
+ let result : undefined | tslint . LintResult ;
76
75
if ( options . tsConfig ) {
77
76
const tsConfigs = Array . isArray ( options . tsConfig ) ? options . tsConfig : [ options . tsConfig ] ;
78
77
@@ -82,9 +81,15 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
82
81
if ( result == undefined ) {
83
82
result = partial ;
84
83
} else {
84
+ result . failures = result . failures
85
+ . filter ( curr => ! partial . failures . some ( prev => curr . equals ( prev ) ) )
86
+ . concat ( partial . failures ) ;
87
+
88
+ // we are not doing much with 'errorCount' and 'warningCount'
89
+ // apart from checking if they are greater than 0 thus no need to dedupe these.
85
90
result . errorCount += partial . errorCount ;
86
91
result . warningCount += partial . warningCount ;
87
- result . failures = result . failures . concat ( partial . failures ) ;
92
+
88
93
if ( partial . fixes ) {
89
94
result . fixes = result . fixes ? result . fixes . concat ( partial . fixes ) : partial . fixes ;
90
95
}
0 commit comments