Skip to content

Rule Proposal: use-v-on-exact #271

Closed
@mysticatea

Description

@mysticatea

From #269.

Please describe what the rule should do:

<button @click="select" @click.ctrl="toggle">test</button>

In that case, I think that people expected click triggers the select and ctrl+click triggers the toggle. But actually, the select is triggered by the both cases.

This rule reports v-on directives if multiple v-on directives exist and those have different system modifiers.

Consider to use '.exact' modifier.

What category of rule is this? (place an "X" next to just one item)

[ ] Enforces code style
[X] Warns about a potential error
[X] Suggests an alternate way of doing something
[ ] Other (please specify:)

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

<!-- ✓ GOOD -->
<button @click="foo"/>
<button @click.ctrl="foo"/>

<!-- ✘ BAD -->
<button @click="foo" @click.ctrl="foo"/>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions