# no-mixed-requires

> Disallow `require` calls mixed with other variables in one declaration

A file's `require` calls are the list of what it depends on. When one `const a = .., b = ..` declaration holds both `require` calls and ordinary variables, that list is harder to find and to keep in order.

ESLint has deprecated this rule. Use `n/no-mixed-requires` instead.

## Examples

Reported:

{/* bad */}
```js
const fs = require("fs"),
  retries = 3;
```

Not reported:

{/* good */}
```js
const fs = require("fs"),
  config = require("./config");

const retries = 3;
```

## Options

| Option | Default | What it does |
| --- | --- | --- |
| `grouping` | `false` | Also report a declaration that mixes kinds of modules: Node.js built-ins (`"fs"`), packages (`"lodash"`), files (`"./config"`) and computed names (`require(name)`). |
| `allowCall` | `false` | Count a module that's called right away, like `require("debug")("app")`, as a `require` and not as an ordinary variable. |

A plain `true` or `false` instead of the object sets `grouping`.

{/* bad {"options": [{"grouping": true}]} */}
```js
const fs = require("fs"),
  config = require("./config");
```

{/* good {"options": [{"grouping": true}]} */}
```js
const fs = require("fs"),
  path = require("path");

const config = require("./config");
```

Built-ins are only recognized by their bare names. `"node:fs"` counts as a package:

{/* bad {"options": [{"grouping": true}]} */}
```js
const fs = require("node:fs"),
  path = require("path");
```

Without `allowCall`, this is reported:

{/* bad */}
```js
const express = require("express"),
  log = require("debug")("app");
```

{/* good {"options": [{"allowCall": true}]} */}
```js
const express = require("express"),
  log = require("debug")("app");
```
