# n/no-new-require

> Disallow `new require()`

`new require("./app")` applies `new` to `require`, not to what `require` returns. You get the class the module exports, not an instance of it.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"n/no-new-require" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}
```js
const app = new require("./app");
```

Not reported:

{/* good */}
```js
const App = require("./app");
const app = new App();
```

With parentheses around the `require()` call, `new` applies to the class:

{/* good */}
```js
const app = new (require("./app"))();
```
