UNPKG

2.1 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 }
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16var Lint = require("tslint");
17var Rule = (function (_super) {
18 __extends(Rule, _super);
19 function Rule() {
20 return _super !== null && _super.apply(this, arguments) || this;
21 }
22 Rule.prototype.apply = function (sourceFile) {
23 if (Rule.isWarningShown === false) {
24 console.warn('Warning: missing-jsdoc rule is deprecated. Replace your usage with the TSLint missing-jsdoc rule.');
25 Rule.isWarningShown = true;
26 }
27 return this.applyWithFunction(sourceFile, walk);
28 };
29 Rule.metadata = {
30 ruleName: 'missing-jsdoc',
31 type: 'maintainability',
32 description: 'All files must have a top level JSDoc comment.',
33 options: null,
34 optionsDescription: '',
35 typescriptOnly: true,
36 issueClass: 'Ignored',
37 issueType: 'Warning',
38 severity: 'Low',
39 level: 'Opportunity for Excellence',
40 group: 'Deprecated',
41 recommendation: 'false'
42 };
43 Rule.FAILURE_STRING = 'File missing JSDoc comment at the top-level.';
44 Rule.isWarningShown = false;
45 return Rule;
46}(Lint.Rules.AbstractRule));
47exports.Rule = Rule;
48function walk(ctx) {
49 var node = ctx.sourceFile;
50 if (!/^\/\*\*\s*$/gm.test(node.getFullText())) {
51 ctx.addFailureAt(node.getStart(), node.getWidth(), Rule.FAILURE_STRING);
52 }
53}
54//# sourceMappingURL=missingJsdocRule.js.map
\No newline at end of file