From f79b4c72046f8494d708129a5fb0a4e1f2752746 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 5 Aug 2018 11:05:44 -0400 Subject: [PATCH] pass `attribute` straight to `validator.error` --- src/validate/html/validateComponent.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/validate/html/validateComponent.ts b/src/validate/html/validateComponent.ts index a6a2cdea3a..77d9cc275f 100644 --- a/src/validate/html/validateComponent.ts +++ b/src/validate/html/validateComponent.ts @@ -26,12 +26,7 @@ export default function validateComponent( if (!isValidIdentifier(attribute.name)) { const suggestion = attribute.name.replace(/[^_$a-z0-9]/ig, '_').replace(/^\d/, '_$&'); - const key = { - start: attribute.start, - end: attribute.end - }; - - validator.error(key, { + validator.error(attribute, { code: `invalid-reference-name`, message: `Reference name '${attribute.name}' is invalid — must be a valid identifier such as ${suggestion}` }); @@ -56,4 +51,4 @@ export default function validateComponent( }); } }); -} \ No newline at end of file +}