From cfdc8902ab2f2f850832045a7266a48fdcbe3885 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 13 Jan 2018 20:05:27 -0500 Subject: [PATCH] run prettier (spaces -> tabs) --- src/validate/js/propValidators/computed.ts | 2 +- .../js/utils/checkForValidIdentifiers.ts | 22 ++++++++++------- .../input.html | 24 +++++++++---------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/validate/js/propValidators/computed.ts b/src/validate/js/propValidators/computed.ts index 1bf3144c31..9ee4ed5ebe 100644 --- a/src/validate/js/propValidators/computed.ts +++ b/src/validate/js/propValidators/computed.ts @@ -21,7 +21,7 @@ export default function computed(validator: Validator, prop: Node) { checkForDupes(validator, prop.value.properties); checkForComputedKeys(validator, prop.value.properties); - checkForValidIdentifiers(validator, prop.value.properties); + checkForValidIdentifiers(validator, prop.value.properties); prop.value.properties.forEach((computation: Node) => { if (!isFunctionExpression.has(computation.value.type)) { diff --git a/src/validate/js/utils/checkForValidIdentifiers.ts b/src/validate/js/utils/checkForValidIdentifiers.ts index 2e5bdd08d6..3b9968f902 100644 --- a/src/validate/js/utils/checkForValidIdentifiers.ts +++ b/src/validate/js/utils/checkForValidIdentifiers.ts @@ -8,14 +8,18 @@ export default function checkForValidIdentifiers( properties: Node[] ) { properties.forEach(prop => { - const name = getName(prop.key); - const functionDefinitionString = `function ${name}() {}`; - try { - parse(functionDefinitionString); - } catch(exception) { - const invalidCharacter = functionDefinitionString[exception.pos] - validator.error(`Computed property name "${name}" is invalid. Character '${invalidCharacter}' at position ${exception.pos} is illegal in function identifiers`, prop.start); - } - + const name = getName(prop.key); + const functionDefinitionString = `function ${name}() {}`; + try { + parse(functionDefinitionString); + } catch (exception) { + const invalidCharacter = functionDefinitionString[exception.pos]; + validator.error( + `Computed property name "${name}" is invalid. Character '${ + invalidCharacter + }' at position ${exception.pos} is illegal in function identifiers`, + prop.start + ); + } }); } diff --git a/test/validator/samples/properties-computed-must-be-valid-function-names/input.html b/test/validator/samples/properties-computed-must-be-valid-function-names/input.html index 74ddb45b96..92da829133 100644 --- a/test/validator/samples/properties-computed-must-be-valid-function-names/input.html +++ b/test/validator/samples/properties-computed-must-be-valid-function-names/input.html @@ -1,17 +1,17 @@

- The hour is - {{hours}} + The hour is + {{hours}}