Skip to content

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

Closed
@leonheess

Description

@leonheess

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)"
/>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions