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

Enforce style of passing an event or part of an event to a method #1611

Open
leonheess opened this issue Aug 16, 2021 · 2 comments
Open

Enforce style of passing an event or part of an event to a method #1611

leonheess opened this issue Aug 16, 2021 · 2 comments

Comments

@leonheess
Copy link

Please describe what the rule should do:
In Vue you can use test($event.detail) as well as event => test(event.detail) to achieve the same thing. 1. should be preferred.

  1. test($event.detail)
<Component
  @click="test($event.detail)"
/>
  1. event => test(event.detail)
<Component
  @click="event => test(event.detail)"
/>

What category should the rule belong to?
[X] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<Component
  @click="event => test(event.detail)"
/>
<Component
  @click="({ detail }) => test(detail)"
/>
@ota-meshi
Copy link
Member

Thank you for the rule proposal!
I think it would be even better if the options allowed the user to choose the style they prefer.

@FloEdelmann
Copy link
Member

Instead of a separate rule, it could maybe be a new option for vue/v-on-function-call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants