Skip to content

Lint against slot wrapped in v-if for that slot's existence

There's a bug in Vue 2.6.11 that means that, under certain circumstances, a construct like:

<div v-if="$slots.other">
  <slot name="other"></slot>
</div>

will work correctly on the first render, but breaks on re-rendering.

The workaround is to use $scopedSlots instead.

We should lint against this pattern, as there's no bug fix imminent, and it leads to very surprising and hard-to-debug behaviour.

Edited by Mark Florian