linter error static method lodash typescript

Viewed 165
1 Answers

There are some options:

  1. As _.isEqual does not use this inside its body you may safely ignore this rule in this particular case:

    /* eslint-disable-next-line @typescript-eslint/unbound-method */
    const liste = computed(() => { return _.uniqWith(_.map(liste.value, 'contrat'), _.isEqual) })
    
  2. You may use wrapping function to preserve calling context:

    const liste = computed(() => { return _.uniqWith(_.map(liste.value, 'contrat'), (a, b) => _.isEqual(a, b)) })
    
  3. Explicitly bind calling context. Kind of ugly but does the job:

    const liste = computed(() => { return _.uniqWith(_.map(liste.value, 'contrat'), _.isEqual.bind(_)) })
    
Related