Pattern: New operator with require
Issue: -
Using new with require is confusing since require doesn't always return a constructor. Import the module first, then create new instances from the imported constructor.
Example of incorrect code:
const header = new require('header');
const db = new require('./database.js');
Example of correct code:
const Header = require('header');
const header = new Header();
const Database = require('./database.js');
const db = new Database();