From db3cf5a24084d4601a31c5ca82a7255a8900c4c1 Mon Sep 17 00:00:00 2001 From: Rafael Santana Date: Mon, 13 Aug 2018 01:03:10 -0300 Subject: [PATCH] fix: errors not being displayed in the correct files (#700) --- src/angular/ngWalker.ts | 14 ++++---------- src/noUnusedCssRule.ts | 7 ++----- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/angular/ngWalker.ts b/src/angular/ngWalker.ts index 8f8ec059c..d8c019be6 100644 --- a/src/angular/ngWalker.ts +++ b/src/angular/ngWalker.ts @@ -205,11 +205,8 @@ export class NgWalker extends Lint.RuleWalker { compiler.templateVisitAll(referenceVisitor, roots, null); visitor._variables = referenceVisitor.variables; roots.forEach(r => visitor.visit(r, context.controller)); - visitor - .getFailures() - .forEach(f => - this.addFailureFromStartToEnd(f.getStartPosition().getPosition(), f.getEndPosition().getPosition(), f.getFailure(), f.getFix()) - ); + // tslint:disable-next-line:deprecation + visitor.getFailures().forEach(f => this.addFailure(f)); } protected visitNgStyleHelper(style: CssAst, context: ComponentMetadata, styleMetadata: StyleMetadata, baseStart: number) { @@ -220,11 +217,8 @@ export class NgWalker extends Lint.RuleWalker { const sourceFile = this.getContextSourceFile(styleMetadata.url!, styleMetadata.style.source!); const visitor = new this._config!.cssVisitorCtrl!(sourceFile, this._originalOptions, context, styleMetadata, baseStart); style.visit(visitor); - visitor - .getFailures() - .forEach(f => - this.addFailureFromStartToEnd(f.getStartPosition().getPosition(), f.getEndPosition().getPosition(), f.getFailure(), f.getFix()) - ); + // tslint:disable-next-line:deprecation + visitor.getFailures().forEach(f => this.addFailure(f)); } protected getContextSourceFile(path: string, content: string) { diff --git a/src/noUnusedCssRule.ts b/src/noUnusedCssRule.ts index 0651dd197..d90a6c72b 100644 --- a/src/noUnusedCssRule.ts +++ b/src/noUnusedCssRule.ts @@ -289,11 +289,8 @@ export class UnusedCssNgVisitor extends NgWalker { const encapsulation = getDecoratorPropertyInitializer(d, 'encapsulation'); if (isEncapsulationEnabled(encapsulation)) { style.visit(visitor); - visitor - .getFailures() - .forEach(f => - this.addFailureFromStartToEnd(f.getStartPosition().getPosition(), f.getEndPosition().getPosition(), f.getFailure(), f.getFix()) - ); + // tslint:disable-next-line:deprecation + visitor.getFailures().forEach(f => this.addFailure(f)); } } }