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
Makes sense. I'd suggest vue/prefer-emits-arrow-function as a rule name. Arrow functions work in both TypeScript and JavaScript, and the preview docs section linked here recommend using them. So I wouldn't bother with the first style (event1(this: undefined) …).
Makes sense. I think the rule should indeed be called vue/prefer-emits-arrow-function and work like this:
Don't report arrow functions or functions (shorthand or longhand) with an explicit this parameter typed to undefined. Report all other functions (shorthand or longhand).
For an autofix, first detect if there is already type information (either only look at the function return type, or detect TypeScript usage in general somehow).
If there isn't, provide an autofix to turn it into an arrow function. We can't be compatible with the object-shorthand rule then.
If there is, don't provide an autofix, but two suggestions:
Turn into arrow function
Add explicit undefined type for this parameter
I guess that event: function(): boolean { … } will also be invalid? EDIT:Yes it is.
Please describe what the rule should do:
This rule proposal is based on this issue:
vuejs/core#5343
It should ensure that emits section does not break vue component typing.
What category should the rule belong to?
Warns about a potential error (problem)
Provide 2-3 code examples that this rule should warn about:
Valid:
Invalid:
The text was updated successfully, but these errors were encountered: