Skip to content

Commit 8e6f6a4

Browse files
committed
Update preferConstRule to use getCombined*X*Flags
now that they are exported.
1 parent 874846a commit 8e6f6a4

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"ts-node": "latest",
7878
"tsd": "latest",
7979
"tslint": "next",
80-
"typescript": "2.1.0-dev.20160906"
80+
"typescript": "next"
8181
},
8282
"scripts": {
8383
"pretest": "jake tests",

scripts/tslint/preferConstRule.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,12 @@ function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
2121
return node;
2222
}
2323

24-
function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
25-
node = walkUpBindingElementsAndPatterns(node);
26-
27-
let flags = node.flags;
28-
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
29-
node = node.parent;
30-
}
31-
32-
if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
33-
flags |= node.flags;
34-
node = node.parent;
35-
}
36-
37-
if (node && node.kind === ts.SyntaxKind.VariableStatement) {
38-
flags |= node.flags;
39-
}
40-
41-
return flags;
42-
}
43-
4424
function isLet(node: ts.Node) {
45-
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Let);
25+
return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let);
4626
}
4727

4828
function isExported(node: ts.Node) {
49-
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Export);
29+
return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export);
5030
}
5131

5232
function isAssignmentOperator(token: ts.SyntaxKind): boolean {

0 commit comments

Comments
 (0)