Skip to content

Rule suggestion: vue/no-restricted-v-on #2243

Closed
@ericuldall

Description

@ericuldall

What rule do you want to change?
no-restricted-static-attribute

Does this change cause the rule to produce more or fewer warnings?
More warnings

How will the change be implemented? (New option, new default behavior, etc.)?
It would be nice to optionally allow directive matching

Please provide some example code that this change will affect:

<div @click="foo">Why you clicking a div?</div>

What does the rule currently do for this code?
Nothing

What will the rule do after it's changed?
Allow matching key to be @click

Additional context
I'm trying to implement it like so:

{
  "vue/no-restricted-static-attribute": ["error",
    {
      "key": "@click",
      "element": "div",
      "message": "Using \"@click\" is not allowed on div's. Use interactive elements instead."
    }
  ]
}

Perhaps this makes sense as a new rule like vue/no-handlers-on-non-interactive-elements
but for now the flexibility of just grouping the directives as an attribute would work as well.

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