Skip to content

Commit f7cfd54

Browse files
alan-agius4Keen Yee Liau
authored and
Keen Yee Liau
committed
fix(@angular-devkit/build-angular): output non human readable lint result
At the moment, when the tslint formatted is non human readable, it is being fully silenced. This changes this behaviour and only emit the formatted result. Fixes #13173
1 parent a747d50 commit f7cfd54

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/angular_devkit/build_angular/src/tslint/index.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
6363
const targetSpecifier = this.context.targetSpecifier;
6464
const projectName = targetSpecifier && targetSpecifier.project || '';
6565

66-
// Print formatter output directly for non human-readable formats.
67-
if (!['prose', 'verbose', 'stylish'].includes(options.format)) {
68-
options.silent = true;
69-
}
66+
// Print formatter output only for non human-readable formats.
67+
const printInfo = ['prose', 'verbose', 'stylish'].includes(options.format)
68+
&& !options.silent;
7069

71-
if (!options.silent) {
70+
if (printInfo) {
7271
this.context.logger.info(`Linting ${JSON.stringify(projectName)}...`);
7372
}
7473

@@ -127,15 +126,15 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
127126
}
128127
}
129128

130-
if (result.warningCount > 0 && !options.silent) {
129+
if (result.warningCount > 0 && printInfo) {
131130
this.context.logger.warn('Lint warnings found in the listed files.');
132131
}
133132

134-
if (result.errorCount > 0 && !options.silent) {
133+
if (result.errorCount > 0 && printInfo) {
135134
this.context.logger.error('Lint errors found in the listed files.');
136135
}
137136

138-
if (result.warningCount === 0 && result.errorCount === 0 && !options.silent) {
137+
if (result.warningCount === 0 && result.errorCount === 0 && printInfo) {
139138
this.context.logger.info('All files pass linting.');
140139
}
141140

packages/angular_devkit/build_angular/test/tslint/works_spec_large.ts

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('Tslint Target', () => {
4343
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
4444
tap(() => {
4545
expect(logger.includes('Linting "app"...')).toBe(false);
46+
expect(logger.includes('<checkstyle')).toBe(true);
4647
}),
4748
).toPromise().then(done, done.fail);
4849
}, 30000);

0 commit comments

Comments
 (0)