Skip to content

fix(@angular-devkit/build-angular): output non human readable lint re… #13168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions packages/angular_devkit/build_angular/src/tslint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
const targetSpecifier = this.context.targetSpecifier;
const projectName = targetSpecifier && targetSpecifier.project || '';

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

if (!options.silent) {
if (printInfo) {
this.context.logger.info(`Linting ${JSON.stringify(projectName)}...`);
}

Expand Down Expand Up @@ -127,15 +126,15 @@ export default class TslintBuilder implements Builder<TslintBuilderOptions> {
}
}

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

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

if (result.warningCount === 0 && result.errorCount === 0 && !options.silent) {
if (result.warningCount === 0 && result.errorCount === 0 && printInfo) {
this.context.logger.info('All files pass linting.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('Tslint Target', () => {
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
expect(logger.includes('Linting "app"...')).toBe(false);
expect(logger.includes('<checkstyle')).toBe(true);
}),
).toPromise().then(done, done.fail);
}, 30000);
Expand Down