Vize

vue/v-if-else-key

Require keys on repeated conditional components.

Default severity Presets Automatic fix Options
warning None No None

Applies to: Vue SFC templates and blocks, with script context where the rule requires it.

Bad

Repeated conditional Panel instances have no keys.

<template>
  <section><Panel v-if="ready" /><Panel v-else /></section>
</template>

Good

Each conditional component has a stable unique key.

<template>
  <section><Panel v-if="ready" key="ready" /><Panel v-else key="fallback" /></section>
</template>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/v-if-else-key": "warn"
    }
  },
});

Then run vp run lint.