tweak error wording slightly

pull/1046/head
Rich Harris 7 years ago
parent d561c93841
commit 4b87d20b93

@ -34,14 +34,14 @@ export default function computed(validator: Validator, prop: Node) {
walkThroughTopFunctionScope(body, (node: Node) => {
if (isThisGetCallExpression(node) && !node.callee.property.computed) {
validator.error(
`Cannot use this.get(...) — it must be passed into the computed function as an argument`,
`Cannot use this.get(...) — values must be passed into the function as arguments`,
node.start
);
}
if (node.type === 'ThisExpression') {
validator.error(
`Computed should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?`,
`Computed properties should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?`,
node.start
);
}

@ -25,7 +25,7 @@ export default function helpers(validator: Validator, prop: Node) {
walkThroughTopFunctionScope(prop.value.body, (node: Node) => {
if (isThisGetCallExpression(node) && !node.callee.property.computed) {
validator.error(
`Cannot use this.get(...) — it must be passed into the helper function as an argument`,
`Cannot use this.get(...) — values must be passed into the helper function as arguments`,
node.start
);
}

@ -1,8 +0,0 @@
[{
"message": "Computed should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?",
"pos": 83,
"loc": {
"line": 7,
"column": 4
}
}]

@ -1,8 +0,0 @@
[{
"message": "Cannot use this.get(...) — it must be passed into the computed function as an argument",
"pos": 73,
"loc": {
"line": 7,
"column": 11
}
}]

@ -0,0 +1,8 @@
[{
"message": "Computed properties should be pure functions — they do not have access to the component instance and cannot use 'this'. Did you mean to put this in 'methods'?",
"pos": 83,
"loc": {
"line": 7,
"column": 4
}
}]

@ -0,0 +1,8 @@
[{
"message": "Cannot use this.get(...) — values must be passed into the function as arguments",
"pos": 73,
"loc": {
"line": 7,
"column": 11
}
}]

@ -1,5 +1,5 @@
[{
"message": "Cannot use this.get(...) — it must be passed into the helper function as an argument",
"message": "Cannot use this.get(...) — values must be passed into the helper function as arguments",
"pos": 74,
"loc": {
"line": 7,

Loading…
Cancel
Save