Merge pull request #900 from sveltejs/event-handler-options-callee

allow options.* as event handler callee
pull/902/head
Rich Harris 7 years ago committed by GitHub
commit 921ad06bc7

@ -21,7 +21,7 @@ export default function validateEventHandlerCallee(
const { name } = flattenReference(callee);
if (validCalleeObjects.has(name)) return;
if (validCalleeObjects.has(name) || name === 'options') return;
if (name === 'refs') {
refCallees.push(callee);
@ -34,7 +34,7 @@ export default function validateEventHandlerCallee(
)
return;
const validCallees = ['this.*', 'event.*', 'console.*'].concat(
const validCallees = ['this.*', 'event.*', 'options.*', 'console.*'].concat(
Array.from(validBuiltins),
Array.from(validator.methods.keys())
);

@ -1,5 +1,5 @@
[{
"message": "'foo' is an invalid callee (should be one of this.*, event.*, console.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar). 'foo' exists on 'helpers', did you put it in the wrong place?",
"pos": 18,
"loc": {
"line": 1,

@ -1,5 +1,5 @@
[{
"message": "'foo' is an invalid callee (should be one of this.*, event.*, console.*, set, fire, destroy or bar)",
"message": "'foo' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire, destroy or bar)",
"pos": 18,
"loc": {
"line": 1,

@ -1,8 +1,8 @@
[{
"message": "'resize' is an invalid callee (should be one of this.*, event.*, console.*, set, fire or destroy)",
"message": "'resize' is an invalid callee (should be one of this.*, event.*, options.*, console.*, set, fire or destroy)",
"loc": {
"line": 1,
"column": 20
},
"pos": 20
}]
}]

Loading…
Cancel
Save