You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow v-on-handler-style rule to accept ["inline", "inline-function"] as the first option.
I find method binding syntax @event="handler" unsafe as it's sometimes not clear what and how many arguments will be passed to the handler (for example, if a component is not typed). That said, only allowing inline event handlers (inline option) does the job very well in 95% cases, but in the other 5% cases it's sometimes easier to use an inline function as a handler. And it wouldn't be an issue as well if we had an option to disable a specific ESLint rule for a specific attribute (like in Prettier with prettier-ignore-attribute), but since it's seemingly not possible, I'm suggesting to allow ["inline", "inline-function"] option for v-on-handler-style rule.
Does this change cause the rule to produce more or fewer warnings?
N/A
How will the change be implemented? (New option, new default behavior, etc.)?
New option value
Please provide some example code that this change will affect:
<!-- ✅ Allow both syntaxes ... -->
<some-component @input="handler($event)" @change="(payload) => { ... }"></some-component>
<!-- ❌ ... but never the method binding one -->
<some-component @input="handler1" @change="handler2"></some-component>
What does the rule currently do for this code?
Does not allow these two styles to be used simultaneously.
What will the rule do after it's changed?
Will allow those two styles.
Additional context
The text was updated successfully, but these errors were encountered:
What rule do you want to change?
Allow
v-on-handler-style
rule to accept["inline", "inline-function"]
as the first option.I find method binding syntax
@event="handler"
unsafe as it's sometimes not clear what and how many arguments will be passed to the handler (for example, if a component is not typed). That said, only allowing inline event handlers (inline
option) does the job very well in 95% cases, but in the other 5% cases it's sometimes easier to use an inline function as a handler. And it wouldn't be an issue as well if we had an option to disable a specific ESLint rule for a specific attribute (like in Prettier withprettier-ignore-attribute
), but since it's seemingly not possible, I'm suggesting to allow["inline", "inline-function"]
option forv-on-handler-style
rule.Does this change cause the rule to produce more or fewer warnings?
N/A
How will the change be implemented? (New option, new default behavior, etc.)?
New option value
Please provide some example code that this change will affect:
<!-- ✅ Allow both syntaxes ... --> <some-component @input="handler($event)" @change="(payload) => { ... }"></some-component> <!-- ❌ ... but never the method binding one --> <some-component @input="handler1" @change="handler2"></some-component>
What does the rule currently do for this code?
Does not allow these two styles to be used simultaneously.
What will the rule do after it's changed?
Will allow those two styles.
Additional context
The text was updated successfully, but these errors were encountered: