JavaScript

JavaScript

Made by DeepSource

Found unused objects JS-R1002

Anti-pattern
Minor

Class constructors being invoked and then dropped immediately is an anti-pattern and should be avoided. Objects instantiated with new should always be useful in some way (passed as a function argument, stored in a variable for later use, etc). If the object is instantiated only to invoke some side effect in the constructor, then the side effect should be refactored out into it's own function.

Bad Practice

new Foo()

Recommended

const myFoo = new Foo()