@@ -23,7 +23,6 @@ import * as tslint from 'tslint'; // tslint:disable-line:no-implicit-dependencie
2323import * as ts from 'typescript' ; // tslint:disable-line:no-implicit-dependencies
2424import { stripBom } from '../angular-cli-files/utilities/strip-bom' ;
2525
26-
2726export interface TslintBuilderOptions {
2827 tslintConfig ?: string ;
2928 tsConfig ?: string | string [ ] ;
@@ -45,7 +44,7 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
4544 try {
4645 tslint = await import ( 'tslint' ) ; // tslint:disable-line:no-implicit-dependencies
4746 } 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.' ) ;
4948 }
5049
5150 const version = tslint . Linter . VERSION && tslint . Linter . VERSION . split ( '.' ) ;
@@ -72,7 +71,7 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
7271 : null ;
7372 const Linter = projectTslint . Linter ;
7473
75- let result ;
74+ let result : undefined | tslint . LintResult ;
7675 if ( options . tsConfig ) {
7776 const tsConfigs = Array . isArray ( options . tsConfig ) ? options . tsConfig : [ options . tsConfig ] ;
7877
@@ -82,9 +81,15 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
8281 if ( result == undefined ) {
8382 result = partial ;
8483 } 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.
8590 result . errorCount += partial . errorCount ;
8691 result . warningCount += partial . warningCount ;
87- result . failures = result . failures . concat ( partial . failures ) ;
92+
8893 if ( partial . fixes ) {
8994 result . fixes = result . fixes ? result . fixes . concat ( partial . fixes ) : partial . fixes ;
9095 }
0 commit comments