aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/noStringLiteralRule.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-12-10 21:51:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-12-10 21:51:33 +0100
commit0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch)
treef9864d4a4148621378958794cbbfdc2393733283 /node_modules/tslint/lib/rules/noStringLiteralRule.js
parent6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff)
upgrade dependencies
Diffstat (limited to 'node_modules/tslint/lib/rules/noStringLiteralRule.js')
-rw-r--r--node_modules/tslint/lib/rules/noStringLiteralRule.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/node_modules/tslint/lib/rules/noStringLiteralRule.js b/node_modules/tslint/lib/rules/noStringLiteralRule.js
index 7774cbcb2..c543aa4d8 100644
--- a/node_modules/tslint/lib/rules/noStringLiteralRule.js
+++ b/node_modules/tslint/lib/rules/noStringLiteralRule.js
@@ -50,9 +50,11 @@ function walk(ctx) {
if (tsutils_1.isElementAccessExpression(node)) {
var argument = node.argumentExpression;
if (argument !== undefined && tsutils_1.isStringLiteral(argument) && tsutils_1.isValidPropertyAccess(argument.text)) {
+ // for compatibility with typescript@<2.5.0 to avoid fixing expr['__foo'] to expr.___foo
+ var propertyName = ts.unescapeIdentifier(argument.text); // tslint:disable-line:deprecation
ctx.addFailureAtNode(argument, Rule.FAILURE_STRING,
// expr['foo'] -> expr.foo
- Lint.Replacement.replaceFromTo(node.expression.end, node.end, "." + argument.text));
+ Lint.Replacement.replaceFromTo(node.expression.end, node.end, "." + propertyName));
}
}
return ts.forEachChild(node, cb);