UNPKG

1.46 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 NoMultipleVarDeclRuleWalker(sourceFile, this.getOptions()));
15 };
16 Rule.FAILURE_STRING = 'Do not use comma separated variable declarations: ';
17 return Rule;
18})(Lint.Rules.AbstractRule);
19exports.Rule = Rule;
20var NoMultipleVarDeclRuleWalker = (function (_super) {
21 __extends(NoMultipleVarDeclRuleWalker, _super);
22 function NoMultipleVarDeclRuleWalker() {
23 _super.apply(this, arguments);
24 }
25 NoMultipleVarDeclRuleWalker.prototype.visitVariableStatement = function (node) {
26 if (node.declarationList.declarations.length > 1) {
27 this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING + node.declarationList.declarations[0].getText() + ','));
28 }
29 _super.prototype.visitVariableStatement.call(this, node);
30 };
31 return NoMultipleVarDeclRuleWalker;
32})(ErrorTolerantWalker);
33//# sourceMappingURL=noMultipleVarDeclRule.js.map
\No newline at end of file