Update preferConstRule to use getCombined*X*Flags

now that they are exported.
This commit is contained in:
Nathan Shively-Sanders
2016-09-08 08:34:33 -07:00
parent 874846a534
commit 8e6f6a4060
2 changed files with 3 additions and 23 deletions

View File

@@ -77,7 +77,7 @@
"ts-node": "latest",
"tsd": "latest",
"tslint": "next",
"typescript": "2.1.0-dev.20160906"
"typescript": "next"
},
"scripts": {
"pretest": "jake tests",

View File

@@ -21,32 +21,12 @@ function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
return node;
}
function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
node = walkUpBindingElementsAndPatterns(node);
let flags = node.flags;
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
node = node.parent;
}
if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
flags |= node.flags;
node = node.parent;
}
if (node && node.kind === ts.SyntaxKind.VariableStatement) {
flags |= node.flags;
}
return flags;
}
function isLet(node: ts.Node) {
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Let);
return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let);
}
function isExported(node: ts.Node) {
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Export);
return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export);
}
function isAssignmentOperator(token: ts.SyntaxKind): boolean {