# eslint-import-resolver-jest

> 🃏 Jest import resolution plugin for eslint-plugin-import

Latest version **3.0.2** (published 2021-09-10) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2021-09-10 |
| First published | 2017-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 2 |
| Unpacked size | 18.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Christian Maniewski |
| Maintainers | rdig, chmanie, area, kronosapiens |
| Keywords | eslint, eslintplugin, jest, resolver, eslint-plugin-import |

## Links

- npm: https://www.npmjs.com/package/eslint-import-resolver-jest
- Repository: https://github.com/JoinColony/eslint-import-resolver-jest
- Issues: https://github.com/JoinColony/eslint-import-resolver-jest/issues
- npm.io page: https://npm.io/package/eslint-import-resolver-jest

## Dependencies (2)

- [resolve](https://npm.io/package/resolve.md) ^1.12.0
- [find-root](https://npm.io/package/find-root.md) ^1.1.0

## 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
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2021-09-10
- 3.0.1 — 2021-09-09
- 3.0.0 — 2019-08-20
- 2.1.2 — 2019-07-01
- 2.1.1 — 2018-03-16
- 2.1.0 — 2018-03-14
- 2.0.1 — 2018-02-19
- 2.0.0 — 2018-02-18
- 1.1.0 — 2017-11-02
- 1.0.1 — 2017-08-24
- 1.0.0 — 2017-04-16

## README

# eslint-import-resolver-jest

_"I like my `testutils` where I can see 'em"_ 🕵🏽‍♀️

<div align="center">
  <a href="https://circleci.com/gh/JoinColony/eslint-import-resolver-jest">
    <img src="https://circleci.com/gh/JoinColony/eslint-import-resolver-jest.svg?style=shield"
    title="CircleCi"/>
  </a>
  <a href="https://renovatebot.com/">
    <img src="https://img.shields.io/badge/renovate-enabled-brightgreen.svg"
    title="Renovate enabled" />
  </a>
  <a href="https://discord.gg/HDkjCqF">
    <img src="https://img.shields.io/discord/562263648173555742?logo=discord" alt="Chat on Discord">
  </a>
  <a href="https://build.colony.io/">
    <img src="https://img.shields.io/discourse/https/build.colony.io/status.svg" title="Contribute!" />
  </a>
</div>

If you're using [jest](https://facebook.github.io/jest/) and you have installed custom name mappings in your config via the `moduleNameMapper` config and you're using the wonderful [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) you might get yelled at by eslint:

<img width="991" alt="grafik" src="https://cloud.githubusercontent.com/assets/2174084/25067977/a80c8d9e-2219-11e7-9189-4860d7f771d5.png">

(I oftentimes create an alias for the helpers I use for testing)

### Let's fix this!

```shell
yarn add eslint-import-resolver-jest -D
```

or

```shell
npm i eslint-import-resolver-jest -D
```

If you are using the [`package.json`](https://facebook.github.io/jest/docs/configuration.html) config option from jest everything should _just work_™.

If you are using a separate config file for jest using the `--config` option you have to point this plugin to it, too (in your .eslintrc):

```json
"settings": {
  "import/resolver": {
    "jest": {
      "jestConfigFile": "./jest.conf.json"
    }
  }
}
```

That's it!

If you want to ensure that this resolver only applies to your test files, you can use ESLint's `overrides` configuration option:

```json
"overrides": [
  {
    "files": ["**/__tests__/**/*.js"],
    "settings": {
      "import/resolver": {
        "jest": {
          "jestConfigFile": "./jest.conf.json"
        }
      }
    }
  }
]
```

#### Note

It will only resolve the modules in your test files that you specified via `testRegex` or `testMatch` in your jest config.

### Contributing

Create issues in this repo or get active yourself:

```shell
yarn test # npm test works, too
```

### License

MIT

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