0

What is the best/correct way to use Vue libs (for example a Swiper) which need a 'new ...' in the script part? 'new ...' works fine in the frontend, but ESlint is bragging about it no matter how i write it:

const swiper = new Swiper > 'swiper' is assigned a value but never used ...
new Swiper > Do not use 'new' for side effects
Without new > Class constructor Swiper cannot be invoked without 'new' and not working anymore in the frontend

So, what is the "correct" way to write this?

Patrick
  • 413
  • 6
  • 12
  • 3
    Possible duplicate of [EsLint - Suppress "Do not use 'new' for side effects"](https://stackoverflow.com/questions/33287045/eslint-suppress-do-not-use-new-for-side-effects) – Lars Beck Jul 09 '18 at 07:28
  • Related, yes, but i think a little bit different. I've seen that, but i don't think this is the "best practise" or is it? – Patrick Jul 09 '18 at 07:56

1 Answers1

0

Ok, so i was able to talk to a "vue.js veteran" and he told me that there isn't a "best practise". The way he fixes this in his apps is by writing a

/* eslint-disable no-new */

right before the new ... part or even disable it globally in the eslint.js

Patrick
  • 413
  • 6
  • 12