Skip to content
This repository was archived by the owner on Jan 18, 2019. It is now read-only.

Commit 651b629

Browse files
author
roman.vasilev
committed
refactor: Rewritten always-fail-rule in es2015 style
1 parent bfa7756 commit 651b629

File tree

1 file changed

+20
-34
lines changed

1 file changed

+20
-34
lines changed
Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,22 @@
1-
var __extends =
2-
(this && this.__extends) ||
3-
function(d, b) {
4-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
5-
function __() {
6-
this.constructor = d;
1+
const Lint = require('tslint');
2+
3+
class Rule extends Lint.Rules.AbstractRule {
4+
5+
apply(sourceFile) {
6+
return this.applyWithWalker(
7+
new AlwaysFailWalker(sourceFile, this.getOptions()),
8+
);
79
}
8-
d.prototype =
9-
b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
10-
};
11-
var Lint = require('tslint');
12-
var Rule = (function(_super) {
13-
__extends(Rule, _super);
14-
function Rule() {
15-
_super.apply(this, arguments);
16-
}
17-
Rule.prototype.apply = function(sourceFile) {
18-
return this.applyWithWalker(
19-
new AlwaysFailWalker(sourceFile, this.getOptions()),
20-
);
21-
};
22-
return Rule;
23-
})(Lint.Rules.AbstractRule);
10+
}
11+
12+
13+
class AlwaysFailWalker extends Lint.RuleWalker {
14+
15+
visitSourceFile(node) {
16+
this.addFailure(
17+
this.createFailure(node.getStart(), node.getWidth(), 'failure'),
18+
);
19+
}
20+
}
21+
2422
exports.Rule = Rule;
25-
var AlwaysFailWalker = (function(_super) {
26-
__extends(AlwaysFailWalker, _super);
27-
function AlwaysFailWalker() {
28-
_super.apply(this, arguments);
29-
}
30-
AlwaysFailWalker.prototype.visitSourceFile = function(node) {
31-
this.addFailure(
32-
this.createFailure(node.getStart(), node.getWidth(), 'failure'),
33-
);
34-
};
35-
return AlwaysFailWalker;
36-
})(Lint.RuleWalker);

0 commit comments

Comments
 (0)