pass `attribute` straight to `validator.error`

pull/1634/head
Rich Harris 6 years ago committed by GitHub
parent e487931a7c
commit ad91f55ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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}`
});

Loading…
Cancel
Save