From 130ab0ccb9f1e914d84a8a4f6c908c0c181cac7b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 5 Aug 2018 11:08:50 -0400 Subject: [PATCH] pass `attribute` straight to `validator.error` --- src/validate/html/validateElement.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 8d5e1bc1ba..3d2d96f380 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -86,12 +86,7 @@ export default function validateElement( 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}` });