# no-deprecated-api

Rule `node/no-deprecated-api`. Disallow deprecated APIs

- Source: node
- Technologies: Node.js
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 14.8M weekly downloads of presets that enable it
- Trend: +18.0% last quarter
- Rank: #675 by reach, #1388 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/no-deprecated-api` | yes | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-deprecated-api.md) |
| Biome | `nursery/noBufferConstructor` | no | no | group nursery, since 2.6.8 | [docs](https://biomejs.dev/linter/rules/no-buffer-constructor/) |

## Code examples

### Incorrect: the rule reports this

```js
var fs = require("fs");
fs.exists("./foo.js", function() {}); /*ERROR: 'fs.exists' was deprecated since v4. Use 'fs.stat()' or 'fs.access()' instead.*/

// Also, it can report the following patterns.
var exists = require("fs").exists;    /*ERROR: 'fs.exists' was deprecated since v4. Use 'fs.stat()' or 'fs.access()' instead.*/
const {exists} = require("fs");       /*ERROR: 'fs.exists' was deprecated since v4. Use 'fs.stat()' or 'fs.access()' instead.*/


// And other deprecated API below.
```

### Correct: the rule accepts this

```js
const buffer = require("buffer")
const data = new buffer.Buffer(10) // OK since it's in ignoreModuleItems.
```

```js
const data = new Buffer(10) // OK since it's in ignoreGlobalItems.
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/no-deprecated-api": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noBufferConstructor": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Node.js recommended](https://lintradar.dev/presets/n-recommended.md) | ESLint | `eslint-plugin-n` | 11 | 10M | +17.8% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [node/process-exit-as-throw](https://lintradar.dev/rules/node/process-exit-as-throw.md): Require that `process.exit()` expressions use the same code path as `throw`
- [node/no-exports-assign](https://lintradar.dev/rules/node/no-exports-assign.md): Disallow the assignment to `exports`
- [node/no-extraneous-import](https://lintradar.dev/rules/node/no-extraneous-import.md): Disallow `import` declarations which import extraneous modules
- [node/no-process-exit](https://lintradar.dev/rules/node/no-process-exit.md): Disallow the use of `process.exit()`
- [node/hashbang](https://lintradar.dev/rules/node/hashbang.md): Require correct usage of hashbang
- [node/no-path-concat](https://lintradar.dev/rules/node/no-path-concat.md): Disallow string concatenation with `__dirname`, `__filename`, and `import.meta` paths

---

Web page: https://lintradar.dev/rules/node/no-deprecated-api. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
