1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return function (d, b) {
|
7 | extendStatics(d, b);
|
8 | function __() { this.constructor = d; }
|
9 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10 | };
|
11 | })();
|
12 | Object.defineProperty(exports, "__esModule", { value: true });
|
13 | var Lint = require("tslint");
|
14 | var ErrorTolerantWalker_1 = require("./utils/ErrorTolerantWalker");
|
15 | var Rule = (function (_super) {
|
16 | __extends(Rule, _super);
|
17 | function Rule() {
|
18 | return _super !== null && _super.apply(this, arguments) || this;
|
19 | }
|
20 | Rule.prototype.apply = function (sourceFile) {
|
21 | return this.applyWithWalker(new MissingJSDocWalker(sourceFile, this.getOptions()));
|
22 | };
|
23 | Rule.metadata = {
|
24 | ruleName: 'missing-jsdoc',
|
25 | type: 'maintainability',
|
26 | description: 'All files must have a top level JSDoc comment.',
|
27 | options: null,
|
28 | optionsDescription: '',
|
29 | typescriptOnly: true,
|
30 | issueClass: 'Non-SDL',
|
31 | issueType: 'Warning',
|
32 | severity: 'Low',
|
33 | level: 'Opportunity for Excellence',
|
34 | group: 'Clarity',
|
35 | commonWeaknessEnumeration: '398, 710'
|
36 | };
|
37 | Rule.FAILURE_STRING = 'File missing JSDoc comment at the top-level: ';
|
38 | return Rule;
|
39 | }(Lint.Rules.AbstractRule));
|
40 | exports.Rule = Rule;
|
41 | var MissingJSDocWalker = (function (_super) {
|
42 | __extends(MissingJSDocWalker, _super);
|
43 | function MissingJSDocWalker() {
|
44 | return _super !== null && _super.apply(this, arguments) || this;
|
45 | }
|
46 | MissingJSDocWalker.prototype.visitSourceFile = function (node) {
|
47 | if (!/^\/\*\*\s*$/gm.test(node.getFullText())) {
|
48 | var failureString = Rule.FAILURE_STRING + this.getSourceFile().fileName;
|
49 | this.addFailureAt(node.getStart(), node.getWidth(), failureString);
|
50 | }
|
51 | };
|
52 | return MissingJSDocWalker;
|
53 | }(ErrorTolerantWalker_1.ErrorTolerantWalker));
|
54 |
|
\ | No newline at end of file |