Description
What rule do you want to change?
vue/prefer-true-attribute-shorthand
Does this change cause the rule to produce more or fewer warnings?
Depends on configuration. No changes by default.
How will the change be implemented? (New option, new default behavior, etc.)?
New option except
that allows specifying attribute names that should be specified in longhand form if the rule is set to always
or in shorthand form if the rule is set to never
.
Please provide some example code that this change will affect:
{
"vue/prefer-true-attribute-shorthand": ["error", "always", {
"except": ["value", "/^foo-/"]
}]
}
<template>
<MyComponent is-shorthand :value="true" foo-bar />
</template>
What does the rule currently do for this code?
It doesn't warn for is-shorthand
and foo-bar
, but it warns for value
.
What will the rule do after it's changed?
It still shouldn't warn for is-shorthand
, but it shouldn't warn for value
and should warn for foo-bar
.
Additional context
The motivating example uses PrimeVue's RadioButton
component:
<template>
<RadioButton v-model="likesPizza" name="pizza" :value="true" />
<RadioButton v-model="likesPizza" name="pizza" :value="false" />
</template>
Using the shorthand syntax for the first component's value
prop would be less readable.