diff --git a/src/rules/noReferenceRule.ts b/src/rules/noReferenceRule.ts index c23c0952cc0..52828010d99 100644 --- a/src/rules/noReferenceRule.ts +++ b/src/rules/noReferenceRule.ts @@ -38,14 +38,12 @@ export class Rule extends Lint.Rules.AbstractRule { public static FAILURE_STRING = " is not allowed, use imports"; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new NoReferenceWalker(sourceFile, this.getOptions())); + return this.applyWithFunction(sourceFile, walk); } } -class NoReferenceWalker extends Lint.RuleWalker { - public visitSourceFile(node: ts.SourceFile) { - for (const ref of node.referencedFiles) { - this.addFailureFromStartToEnd(ref.pos, ref.end, Rule.FAILURE_STRING); - } +function walk(ctx: Lint.WalkContext): void { + for (const ref of ctx.sourceFile.referencedFiles) { + ctx.addFailure(ref.pos, ref.end, Rule.FAILURE_STRING); } }