How to use the codelyzer/angular/ngWalker.NgWalker function in codelyzer

To help you get started, we’ve selected a few codelyzer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intershop / intershop-pwa / tslint-rules / dist / ccpNoMarkupInContainersRule.js View on Github external
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;
github dynatrace-oss / barista / tools / tslint-rules / dtIconNamesRule.ts View on Github external
apply(sourceFile: SourceFile): RuleFailure[] {
    return this.applyWithWalker(new NgWalker(sourceFile, this.getOptions(), { templateVisitorCtrl: DtIconTemplateVisitor }));
  }
}
github intershop / intershop-pwa / tslint-rules / src / ccpNoMarkupInContainersRule.ts View on Github external
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 [];
  }
}