Closed
Description
Please describe what the rule should do:
Rule to prevent any attribute on <template>
tags.
I think it makes sense that the only thing that should be allowed are some directives (eg. v-if
, v-for
, v-slot
) but not v-bind
or v-on
. And with the exception of legacy API like slot="..."
.
What category should the rule belong to?
[ ] Enforces code style (layout)
[x] 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:
<template>
<div>
<template class="heading">
<h1>Hello world</h1>
</template>
</div>
</template>
<template>
<div>
<template ref="input">
<input type="text">
</template>
</div>
</template>
Additional context
I noticed there were mistakes in Vue code where people would accidentally leave class="..."
, ref="..."
, etc. on <template>
tags.
These fail silently so it's easy to go unnoticed.