relax and allow double quoted strings appearing inside localize call

This commit is contained in:
Johannes Rieken 2019-12-30 18:45:00 +01:00
parent c9179d1e6a
commit 9fefd2b6fb
2 changed files with 4 additions and 0 deletions

View file

@ -39,6 +39,7 @@ module.exports = new (_a = class NoUnexternalizedStrings {
// extract key so that it can be checked later
let key;
if (isStringLiteral(keyNode)) {
doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider
key = keyNode.value;
}
else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) {
@ -46,6 +47,7 @@ module.exports = new (_a = class NoUnexternalizedStrings {
if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) {
if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') {
if (isStringLiteral(property.value)) {
doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider
key = property.value.value;
break;
}

View file

@ -49,6 +49,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
// extract key so that it can be checked later
let key: string | undefined;
if (isStringLiteral(keyNode)) {
doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider
key = keyNode.value;
} else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) {
@ -56,6 +57,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule {
if (property.type === AST_NODE_TYPES.Property && !property.computed) {
if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') {
if (isStringLiteral(property.value)) {
doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider
key = property.value.value;
break;
}