Closed
Description
Due to a vue compiler error, I was made aware that in Vue 3, :key can/should be placed directly on instead of the direct child element. I'm not sure when this changed, but a recent vue-next commit that is now part of 3.0.0-rc.6 now throws the error when compiling.
Checklist
- I checked the FAQ.
Tell us about your environment
- ESLint version: 7.7.0
- eslint-plugin-vue version: 7.0.0-beta.2
- Node version: 14.8.0
- Operating System: Ubuntu 20.04.1 LTS
What did you do?
<template v-for="val in tree" :key="val.refId">
<component :is="MyComponent" :item="val" />
</template>
What did you expect to happen?
No ESLint rule errors.
What actually happened?
error: '<template>' cannot be keyed. Place the key on real elements instead (vue/no-template-key) at src/ContentFrame/ContentFrame.vue:36:5:
35 | <div ref="root" class="ContentFrame">
> 36 | <template v-for="val in tree" :key="val.refId">
| ^
37 | <component :is="MyComponent" :item="val"
error: Custom elements in iteration require 'v-bind:key' directives (vue/valid-v-for) at src/ContentFrame/ContentFrame.vue:37:7:
36 | <template v-for="val in tree" :key="val.refId">
> 37 | <component :is="MyComponent" :item="val"
| ^