Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 1.04 KB

require-v-for-key.md

File metadata and controls

41 lines (26 loc) · 1.04 KB

require v-bind:key with v-for directives (vue/require-v-for-key)

  • ⚙️ This rule is included in all of "plugin:vue/essential", "plugin:vue/strongly-recommended" and "plugin:vue/recommended".

When v-for is written on custom components, it requires v-bind:key at the same time. On other elements, it's better that v-bind:key is written as well.

📖 Rule Details

This rule reports the elements which have v-for and do not have v-bind:key.

This rule does not report custom components. It will be reported by [valid-v-for] rule.

👎 Examples of incorrect code for this rule:

<div v-for="todo in todos"/>

👍 Examples of correct code for this rule:

<div
  v-for="todo in todos"
  :key="todo.id"
/>

🔧 Options

Nothing.

👫 Related rules

Related links