Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
var failures = element.attrs.map(function (attr) { return _this.validateAttr(attr); }).filter(function (x) { return !!x; });
if (failures && failures.length) {
this.addFailureFromStartToEnd(element.sourceSpan.start.offset, element.sourceSpan.end.offset, MESSAGE + " " + failures.join(' '));
}
};
ContainerTemplateVisitor.prototype.validateAttr = function (attr) {
if (attr.name === 'class' || attr.name === 'style') {
return "Found '" + attr.name + "' with value '" + attr.value + "'.";
}
else {
return;
}
};
return ContainerTemplateVisitor;
}(basicTemplateAstVisitor_1.BasicTemplateAstVisitor));
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
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()); });