Only allow modelValue in vue/no-deprecated-model-definition
#2255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #2238.
I now tested the (unreleased) rule in a large codebase that is currently prepared for upgrading to Vue 3. There, I noticed that allowing anything different than
modelValue
/update:modelValue
ormodel-value
/update:model-value
does not make sense: You'd still need to changev-model
tov-model:fooBar
in the actual Vue 3 migration if your model specifiedfooBar
/update:fooBar
.So it's better to either rename the model definition to
modelValue
/update:modelValue
ormodel-value
/update:model-value
and keep usingv-model
, or to rename the model definition tofooBar
/update:fooBar
and also update allv-model
s to:fooBar="…" @update:fooBar="… = $event"
, and after the Vue 3 migration change it tov-model:fooBar
with #2237.Therefore, I changed the rule and the suggestions to only allow
modelValue
/update:modelValue
ormodel-value
/update:model-value
.