diff --git a/src/css/Selector.ts b/src/css/Selector.ts
index 9153768f2f..fba0386f1f 100644
--- a/src/css/Selector.ts
+++ b/src/css/Selector.ts
@@ -102,7 +102,7 @@ export default class Selector {
while (i-- > 1) {
const selector = block.selectors[i];
if (selector.type === 'PseudoClassSelector' && selector.name === 'global') {
- validator.error(`:global(...) must be the first element in a compound selector`, { start: selector.start, end: selector.end });
+ validator.error(`:global(...) must be the first element in a compound selector`, selector);
}
}
});
@@ -120,8 +120,7 @@ export default class Selector {
for (let i = start; i < end; i += 1) {
if (this.blocks[i].global) {
- const selector = this.blocks[i].selectors[0];
- validator.error(`:global(...) can be at the start or end of a selector sequence, but not in the middle`, { start: selector.start, end: selector.end });
+ validator.error(`:global(...) can be at the start or end of a selector sequence, but not in the middle`, this.blocks[i].selectors[0]);
}
}
}
diff --git a/src/interfaces.ts b/src/interfaces.ts
index 82de8cd047..de187da71d 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -29,6 +29,7 @@ export interface Parsed {
export interface Warning {
loc?: { line: number; column: number; pos?: number };
+ end?: { line: number; column: number; };
pos?: number;
message: string;
filename?: string;
diff --git a/src/validate/html/a11y.ts b/src/validate/html/a11y.ts
index 8f24565071..e9953d6083 100644
--- a/src/validate/html/a11y.ts
+++ b/src/validate/html/a11y.ts
@@ -33,7 +33,7 @@ export default function a11y(
if (name.startsWith('aria-')) {
if (invisibleElements.has(node.name)) {
// aria-unsupported-elements
- validator.warn(`A11y: <${node.name}> should not have aria-* attributes`, { start: attribute.start, end: attribute.end });
+ validator.warn(`A11y: <${node.name}> should not have aria-* attributes`, attribute);
}
const type = name.slice(5);
@@ -42,7 +42,7 @@ export default function a11y(
let message = `A11y: Unknown aria attribute 'aria-${type}'`;
if (match) message += ` (did you mean '${match}'?)`;
- validator.warn(message, { start: attribute.start, end: attribute.end });
+ validator.warn(message, attribute);
}
}
@@ -50,7 +50,7 @@ export default function a11y(
if (name === 'role') {
if (invisibleElements.has(node.name)) {
// aria-unsupported-elements
- validator.warn(`A11y: <${node.name}> should not have role attribute`, { start: attribute.start, end: attribute.end });
+ validator.warn(`A11y: <${node.name}> should not have role attribute`, attribute);
}
const value = getStaticAttributeValue(node, 'role');
@@ -59,30 +59,30 @@ export default function a11y(
let message = `A11y: Unknown role '${value}'`;
if (match) message += ` (did you mean '${match}'?)`;
- validator.warn(message, { start: attribute.start, end: attribute.end });
+ validator.warn(message, attribute);
}
}
// no-access-key
if (name === 'accesskey') {
- validator.warn(`A11y: Avoid using accesskey`, { start: attribute.start, end: attribute.end });
+ validator.warn(`A11y: Avoid using accesskey`, attribute);
}
// no-autofocus
if (name === 'autofocus') {
- validator.warn(`A11y: Avoid using autofocus`, { start: attribute.start, end: attribute.end });
+ validator.warn(`A11y: Avoid using autofocus`, attribute);
}
// scope
if (name === 'scope' && node.name !== 'th') {
- validator.warn(`A11y: The scope attribute should only be used with
elements`, { start: attribute.start, end: attribute.end });
+ validator.warn(`A11y: The scope attribute should only be used with