UNPKG

1.38 kBJavaScriptView Raw
1var __extends = (this && this.__extends) || function (d, b) {
2 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3 function __() { this.constructor = d; }
4 __.prototype = b.prototype;
5 d.prototype = new __();
6};
7var ErrorTolerantWalker = require('./utils/ErrorTolerantWalker');
8var 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 MissingJSDocWalker(sourceFile, this.getOptions()));
15 };
16 Rule.FAILURE_STRING = 'File missing JSDoc comment at the top-level: ';
17 return Rule;
18})(Lint.Rules.AbstractRule);
19exports.Rule = Rule;
20var MissingJSDocWalker = (function (_super) {
21 __extends(MissingJSDocWalker, _super);
22 function MissingJSDocWalker() {
23 _super.apply(this, arguments);
24 }
25 MissingJSDocWalker.prototype.visitSourceFile = function (node) {
26 if (!/^\/\*\*\s*$/gm.test(node.getFullText())) {
27 var failureString = Rule.FAILURE_STRING + this.getSourceFile().fileName;
28 var failure = this.createFailure(node.getStart(), node.getWidth(), failureString);
29 this.addFailure(failure);
30 }
31 };
32 return MissingJSDocWalker;
33})(ErrorTolerantWalker);
34//# sourceMappingURL=missingJsdocRule.js.map
\No newline at end of file