JavaScript

JavaScript

Made by DeepSource

Disallow to pass multiple arguments to scoped slots JS-0692

Anti-pattern
Minor
vue

this.$scopedSlots members should not have more than 2 arguments.

  • Multiple Arguments create inconsistency.
  • Cannot omit arguments because multiple arguments should be passed in fixed order

Bad Practice

const children = this.$scopedSlots.default(foo, bar)
const children2 = this.$scopedSlots.default(...foo)

Recommended

const children1 = this.$scopedSlots.default()
const children2 = this.$scopedSlots.default(foo)
const children3 = this.$scopedSlots.default({ foo, bar })