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

In `new require("./server")`, the `new` applies to `require`, not to what it returns, so you don't get an instance of the exported class. To create one in a single expression, put the `require` call in parentheses, or use two statements.

ESLint has deprecated this rule. Use `n/no-new-require` instead.

## Examples

Reported:

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

Not reported:

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

const logger = new (require("./logger"))();
```
