Skip to content

vue/valid-model-definition

require valid keys in model option

  • 🚫 This rule was deprecated.
  • ⚙️ This rule is included in all of "plugin:vue/vue2-essential", *.configs["flat/vue2-essential"], "plugin:vue/vue2-strongly-recommended", *.configs["flat/vue2-strongly-recommended"], "plugin:vue/vue2-recommended" and *.configs["flat/vue2-recommended"].

📖 Rule Details

This rule is aimed at preventing invalid keys in model option.

<script> /* ✓ GOOD */ export default { model: { prop: 'list', } } </script>
Now loading...
<script> /* ✓ GOOD */ export default { model: { event: 'update' } } </script>
Now loading...
<script> /* ✓ GOOD */ export default { model: { prop: 'list', event: 'update' } } </script>
Now loading...
<script> /* ✗ BAD */ export default { model: { prop: 'list', events: 'update' } } </script>
Now loading...
<script> /* ✗ BAD */ export default { model: { props: 'list', events: 'update' } } </script>
Now loading...
<script> /* ✗ BAD */ export default { model: { name: 'checked', props: 'list', event: 'update' } } </script>
Now loading...

🚀 Version

This rule was introduced in eslint-plugin-vue v9.0.0

🔍 Implementation