noAnyRule.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var Lint = require("../lint");
  8. var Rule = (function (_super) {
  9. __extends(Rule, _super);
  10. function Rule() {
  11. _super.apply(this, arguments);
  12. }
  13. Rule.prototype.apply = function (sourceFile) {
  14. return this.applyWithWalker((new NoAnyWalker(sourceFile, this.getOptions())));
  15. };
  16. Rule.FAILURE_STRING = "type decoration of 'any' is forbidden";
  17. return Rule;
  18. }(Lint.Rules.AbstractRule));
  19. exports.Rule = Rule;
  20. var NoAnyWalker = (function (_super) {
  21. __extends(NoAnyWalker, _super);
  22. function NoAnyWalker() {
  23. _super.apply(this, arguments);
  24. }
  25. NoAnyWalker.prototype.visitAnyKeyword = function (node) {
  26. this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
  27. _super.prototype.visitAnyKeyword.call(this, node);
  28. };
  29. return NoAnyWalker;
  30. }(Lint.RuleWalker));