# eslint-import-resolver-next

> The next resolver for `eslint-plugin-import` or `eslint-plugin-import-x`

Latest version **0.6.0** (published 2025-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-import-resolver-next
pnpm add eslint-import-resolver-next
yarn add eslint-import-resolver-next
bun add eslint-import-resolver-next
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2025-05-09 |
| First published | 2024-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.18.0 |
| Dependencies | 5 |
| Unpacked size | 61.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Maintainers | kuoruan |
| Keywords | eslint, eslint-plugin-import, eslint-plugin-import-x, eslint-import-resolver, oxc-resolver, unrs-resolver |

## Links

- npm: https://www.npmjs.com/package/eslint-import-resolver-next
- Repository: https://github.com/kuoruan/eslint-import-resolver-next
- Homepage: https://github.com/kuoruan/eslint-import-resolver-next#readme
- Issues: https://github.com/kuoruan/eslint-import-resolver-next/issues
- npm.io page: https://npm.io/package/eslint-import-resolver-next

## Dependencies (5)

- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [tinyglobby](https://npm.io/package/tinyglobby.md) ^0.2.13
- [stable-hash](https://npm.io/package/stable-hash.md) ^0.0.5
- [is-bun-module](https://npm.io/package/is-bun-module.md) ^2.0.0
- [unrs-resolver](https://npm.io/package/unrs-resolver.md) ^1.7.2

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.6.0 (latest) — 2025-05-09
- 0.5.0 — 2025-03-21
- 0.4.3 — 2025-03-17
- 0.4.2 — 2025-02-01
- 0.4.1 — 2024-12-13
- 0.4.0 — 2024-12-13
- 0.3.1 — 2024-11-20
- 0.3.0 — 2024-11-20
- 0.2.9 — 2024-11-19
- 0.2.8 — 2024-11-19
- 0.2.7 — 2024-11-19
- 0.2.6 — 2024-11-19
- 0.2.5 — 2024-11-19
- 0.2.4 — 2024-11-19
- 0.2.3 — 2024-11-19
- … 4 more at https://npm.io/package/eslint-import-resolver-next/versions

## README

# eslint-import-resolver-next

[![npm](https://img.shields.io/npm/v/eslint-import-resolver-next.svg)](https://www.npmjs.com/package/eslint-import-resolver-next)
[![npm](https://img.shields.io/npm/dw/eslint-import-resolver-next.svg)](https://www.npmjs.com/package/eslint-import-resolver-next)
[![npm](https://img.shields.io/npm/l/eslint-import-resolver-next.svg)](https://www.npmjs.com/package/eslint-import-resolver-next)

The next resolver plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import) or [`eslint-plugin-import-x`](https://www.npmjs.com/package/eslint-plugin-import-x) that resolves modules with [`unrs-resolver`](https://github.com/unrs/unrs-resolver).

## Features

- Resolves modules using the [`unrs-resolver`](https://github.com/unrs/unrs-resolver) package.
- Support mono-repos and `pnpm-workspaces.yaml`.
- Support paths alias defined in `tsconfig.compilerOptions.paths` or `jsconfig.compilerOptions.paths`.

## Usage

1. Install the package:

```sh
npm install -D eslint-import-resolver-next
```

2. Add it as a resolver to your ESLint configuration.

Example config:

```js
module.exports = {
  // ... other configuration options
  settings: {
    "import/resolver": {
      next: {
        // Options for the resolver
      },
    },
  },
};
```

with Mono-repo:

```js
module.exports = {
  // ... other configuration options
  settings: {
    "import/resolver": {
      next: {
        packages: ["packages/*"],
      },
    },
  },
};
```

pnpm-workspaces:

```js
module.exports = {
  // ... other configuration options
  settings: {
    "import/resolver": {
      next: {
        packages: {
          pnpmWorkspace: true,
          includeRoot: true,
        },
      },
    },
  },
};
```

3. For [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x/) `resolver-next`

```js
const { createNextImportResolver } = require("eslint-import-resolver-next");

module.exports = {
  // ... other configuration options
  settings: {
    "import-x/resolver-next": [createNextImportResolver({
      // Options for the resolver
    })],
  },
};
```

## Options

- `roots` (Array<string>): The directories to search for modules. Default: `[process.cwd()]`.

- `alias` (Record<string, string | string[]>): The paths alias. Default: `undefined`.
  * The alias can be set as relative paths. relative paths are resolved from the package directory.

- `tsconfig` (boolean | string | object): Weather to use the `tsconfig.json` file. Default: `true`.
  * If `true`, the resolver will try to find the `tsconfig.json` file close to the source file.
  * If a string, it's the name of the file to search for or the absolute path to the file.
  * If an object, see `ConfigFileOptions`.

- `jsconfig` (boolean | string | object): Weather to use the `jsconfig.json` file. Default: `true`.
  * If `true`, the resolver will try to find the `jsconfig.json` file close to the source file.
  * If a string, it's the name of the file to search for or the absolute path to the file.
  * If an object, see `ConfigFileOptions`.

- `packages` (string[] | PackageOptions): The patterns or options to search for packages. Default: `undefined`.
  * If an array, the resolver will search for packages in the specified patterns.
  * If an object, see `PackageOptions`.

- `bun` (boolean): Weather to enable the `bun` support. Default: `true` if bun environment is detected.
  * If `true`, the resolver will try to resolve bun built-in modules.

All other options are passed to the `unrs-resolver` package. See the [unrs-resolver documentation](https://github.com/unrs/unrs-resolver#options)

### ConfigFileOptions

The `tsconfig` and `jsconfig` options can have the following properties:

- `configFile` (string): The name of the file to search for or the absolute path to the file. Default: `tsconfig.json`.
- `ignore` (string[]): The directories to ignore. Default: `["**/node_modules/**"]`.
- `references` ('auto' | string[]): Support for Typescript Project References. Default: `'auto'`.
  * If `'auto'`, the resolver will try to find the `references` field in the `tsconfig.json` file.
  * If an array, the resolver will use the specified references.

### PackageOptions

A folder with a `package.json` file is considered a package. The `PackageOptions` object can have the following properties:

- `patterns` (string[]): The patterns to search for packages. Default: `["."]`.
- `ignore` (string[]): The directories to ignore. Default: `["**/node_modules/**", "**/bower_components/**", "**/test/**", "**/tests/**"]`.
- `includeRoot` (boolean): Weather to include the root directory. Default: `false`.
- `pnpmWorkspace` (boolean | string): Weather to use the `pnpm-workspace.yaml` file to find packages. Default: `false`.
  * If `true`, the resolver will try to find the `pnpm-workspace.yaml` file in the package directory.
  * If a string, define the path to the `pnpm-workspace.yaml` file.

---
_Source: https://npm.io/package/eslint-import-resolver-next · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
