Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Rule.prototype.apply = function (sourceFile) {
if (!sourceFile.fileName.match(/.*\/containers\/.*.ts/)) {
return [];
}
var walker = new ngWalker_1.NgWalker(sourceFile, this.getOptions(), { templateVisitorCtrl: ContainerTemplateVisitor });
walker.walk(sourceFile);
var failures = walker.getFailures();
if (failures && failures.length) {
var errorToken_1 = tsquery_1.tsquery(sourceFile, 'ClassDeclaration > Identifier')[0];
return this.applyWithFunction(sourceFile, function (ctx) {
failures.forEach(function (f) { return ctx.addFailureAtNode(errorToken_1, f.getFailure()); });
});
}
return [];
};
return Rule;
apply(sourceFile: SourceFile): RuleFailure[] {
return this.applyWithWalker(new NgWalker(sourceFile, this.getOptions(), { templateVisitorCtrl: DtIconTemplateVisitor }));
}
}
apply(sourceFile: SourceFile): Lint.RuleFailure[] {
if (!sourceFile.fileName.match(/.*\/containers\/.*.ts/)) {
return [];
}
const walker = new NgWalker(sourceFile, this.getOptions(), { templateVisitorCtrl: ContainerTemplateVisitor });
walker.walk(sourceFile);
const failures = walker.getFailures();
if (failures && failures.length) {
const errorToken = tsquery(sourceFile, 'ClassDeclaration > Identifier')[0];
return this.applyWithFunction(sourceFile, ctx => {
failures.forEach(f => ctx.addFailureAtNode(errorToken, f.getFailure()));
});
}
return [];
}
}