Skip to content

Files

Latest commit

 

History

History
34 lines (25 loc) · 1004 Bytes

require-slots-as-functions.md

File metadata and controls

34 lines (25 loc) · 1004 Bytes

Pattern: Missing $slots as function

Issue: -

Description

This rule enforces the properties of $slots to be used as a function.
this.$slots.default was an array of VNode in Vue.js 2.x, but changed to a function that returns an array of VNode in Vue.js 3.x.

<script>
export default {
  render(h) {
    /* ✓ GOOD */
    var children = this.$slots.default()
    var children = this.$slots.default && this.$slots.default()

    /* ✗ BAD */
    var children = [...this.$slots.default]
    var children = this.$slots.default.filter(test)
  }
}
</script>

Further Reading