Skip to content

Commit a7dd6a2

Browse files
committed
Update errors
1 parent 2453802 commit a7dd6a2

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/validate/html/validateElement.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ export default function validateElement(
219219
}
220220
} else if (attribute.type === 'Action') {
221221
if (isComponent) {
222-
validator.error(`Actions can only be applied to DOM elements, not components`, attribute.start);
222+
validator.error(`Actions can only be applied to DOM elements, not components`, attribute);
223223
}
224224

225225
validator.used.actions.add(attribute.name);
226226

227227
if (!validator.actions.has(attribute.name)) {
228228
validator.error(
229229
`Missing action '${attribute.name}'`,
230-
attribute.start
230+
attribute
231231
);
232232
}
233233
}

src/validate/js/propValidators/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function actions(validator: Validator, prop: Node) {
77
if (prop.value.type !== 'ObjectExpression') {
88
validator.error(
99
`The 'actions' property must be an object literal`,
10-
prop.start
10+
prop
1111
);
1212
}
1313

test/validator/samples/action-invalid/errors.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
"loc": {
55
"line": 1,
66
"column": 5
7+
},
8+
"end": {
9+
"line": 1,
10+
"column": 17
711
}
812
}]
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
[{
22
"message": "Actions can only be applied to DOM elements, not components",
3+
"pos": 8,
34
"loc": {
45
"line": 1,
56
"column": 8
67
},
7-
"pos": 8
8+
"end": {
9+
"line": 1,
10+
"column": 15
11+
}
812
}]

0 commit comments

Comments
 (0)