eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

Require component tag with :is

Open thedamon opened this issue 5 years ago • 1 comments

Please describe what the rule should do:

Require :is does not appear on tags other than <component>

What category should the rule belong to?

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

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

<VModal :is="computedProp">
<a :is="element">

Better:

<component :is="computedProp">
<component :is="element">

Additional context

We already have require-component-is to enforce having an :is attribute for any instance of the <component> tag which is more a practical concern. Having :is on a different tag however will function perfectly in Vue, but it is potentially confusing since glancing at the tag in the template we will get the impression that the tag is what it is.

This could alternately be considered an enhancement of the existing rule, but presumably it can't be the default to avoid breaking change

thedamon avatar Mar 18 '20 18:03 thedamon

what if you have a custom component and you want to provide a prop called "is" ?

mesqueeb avatar Sep 03 '20 05:09 mesqueeb