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
Resolve Variable $event in JSX #298
Comments
Thank you for this report. I'm not familiar with Vue+JSX, to make sure, is the code correct? It looks to use |
<button on-click={this.warn($event, 'Form cannot be submitted yet.')}>Submit</button> //...
methods: {
warn: function (event, message) {
// now we have access to the native event
if (event) event.preventDefault()
alert(message)
}
} There is another way to do that, but I think that both way should support. <button on-click={this.warn('Form cannot be submitted yet.')}>Submit</button> //...
methods: {
warn: function (message, event) {
// event still can access here
}
} |
I know that However, as far as I know, JSX's expression container does not make such function. So I guessed that But I'm not familiar with Vue+JSX, I want to get clear. |
Yeah, I think that you're right. The conversion is done by |
Hello @LucienLee I'm afraid we can't do anything about it. As with All you can do is to just use Though if you @mysticatea have any out-of-the-box ideas regarding possible solutions that I might not be aware of please reopen this issue and share them here :) Cheers! |
@michalsnik It's feasible, so I wanted to know the correct specification. In this case, globals option is not ideal because it causes false negative of no-undef rule. |
Tell us about your environment
ESLint Version: 4.13.0
eslint-plugin-vue Version: 4.0.0-beta.2
Node Version: 8.9.1
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
eslint should know
$event
is a preserved variable, rather warnno-undef
.What actually happened? Please include the actual, raw output from ESLint.
[eslint] '$event' is not defined. (no-undef)
The text was updated successfully, but these errors were encountered: