Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow options.* as event handler callee #900

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/validate/html/validateEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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())
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/validator/samples/method-nonexistent/warnings.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions test/validator/samples/window-event-invalid/warnings.json
Original file line number Diff line number Diff line change
@@ -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
}]
}]