Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule suggestion: v-model cannot be used on a prop #2035

Closed
BARNZ opened this issue Nov 11, 2022 · 1 comment
Closed

Rule suggestion: v-model cannot be used on a prop #2035

BARNZ opened this issue Nov 11, 2022 · 1 comment

Comments

@BARNZ
Copy link

BARNZ commented Nov 11, 2022

Please describe what the rule should do:

This rule should check for the recently added vue compiler warning about using props directly with v-model

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>
    <input v-model="someProp" />
</template>

<script setup>
    defineProps({ someProp: String })
</script>

Additional context

The above example now throws an error when compiling with vite:

[vite:vue] v-model cannot be used on a prop, because local prop bindings are not writable.

vuejs/core#5584 (comment)

@ota-meshi
Copy link
Member

Thank you for posting the issue.
You can already check by using the vue/no-mutating-props rule.
https://eslint.vuejs.org/rules/no-mutating-props.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants