tslint-microsoft-contrib
Version:
TSLint Rules for Microsoft
54 lines • 2.1 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Lint = require("tslint");
var Rule = (function (_super) {
__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
if (Rule.isWarningShown === false) {
console.warn('Warning: missing-jsdoc rule is deprecated. Replace your usage with the TSLint missing-jsdoc rule.');
Rule.isWarningShown = true;
}
return this.applyWithFunction(sourceFile, walk);
};
Rule.metadata = {
ruleName: 'missing-jsdoc',
type: 'maintainability',
description: 'All files must have a top level JSDoc comment.',
options: null,
optionsDescription: '',
typescriptOnly: true,
issueClass: 'Ignored',
issueType: 'Warning',
severity: 'Low',
level: 'Opportunity for Excellence',
group: 'Deprecated',
recommendation: 'false'
};
Rule.FAILURE_STRING = 'File missing JSDoc comment at the top-level.';
Rule.isWarningShown = false;
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
function walk(ctx) {
var node = ctx.sourceFile;
if (!/^\/\*\*\s*$/gm.test(node.getFullText())) {
ctx.addFailureAt(node.getStart(), node.getWidth(), Rule.FAILURE_STRING);
}
}
//# sourceMappingURL=missingJsdocRule.js.map