---
title: "n/no-new-require"
description: "Disallow `new require()`"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "node"
aliases: ["node/no-new-require"]
kind: "suggestion"
category: "restriction"
default: "off"
fixable: "no"
typeAware: false
deprecated: false
---

`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"))();
```
