diff --git a/src/validate/html/validateEventHandler.ts b/src/validate/html/validateEventHandler.ts index 9a22bdd6c8f1..e2b6e405d778 100644 --- a/src/validate/html/validateEventHandler.ts +++ b/src/validate/html/validateEventHandler.ts @@ -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()) ); diff --git a/test/validator/samples/method-nonexistent-helper/warnings.json b/test/validator/samples/method-nonexistent-helper/warnings.json index d090c4df94ca..88a5b7e03c91 100644 --- a/test/validator/samples/method-nonexistent-helper/warnings.json +++ b/test/validator/samples/method-nonexistent-helper/warnings.json @@ -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, diff --git a/test/validator/samples/method-nonexistent/warnings.json b/test/validator/samples/method-nonexistent/warnings.json index d8f4e0e0cfff..c5117ae98c1d 100644 --- a/test/validator/samples/method-nonexistent/warnings.json +++ b/test/validator/samples/method-nonexistent/warnings.json @@ -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, diff --git a/test/validator/samples/window-event-invalid/warnings.json b/test/validator/samples/window-event-invalid/warnings.json index 20dc4c79faf9..5dca33bf5ca0 100644 --- a/test/validator/samples/window-event-invalid/warnings.json +++ b/test/validator/samples/window-event-invalid/warnings.json @@ -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 -}] \ No newline at end of file +}]