# eslint-import-resolver-ts

> TypeScript .ts .tsx module resolver for `eslint-plugin-import`.

Latest version **0.4.2** (published 2019-10-02) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2019-10-02 |
| First published | 2019-09-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=4 |
| Dependencies | 5 |
| Unpacked size | 112 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Alex Gorbatchev |
| Maintainers | jounqin |
| Keywords | typescript, eslint, import, resolver, plugin |

## Links

- npm: https://www.npmjs.com/package/eslint-import-resolver-ts
- Repository: git@github.com/rx-ts/eslint-import-resolver-ts
- npm.io page: https://npm.io/package/eslint-import-resolver-ts

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [is-glob](https://npm.io/package/is-glob.md) ^4.0.1
- [resolve](https://npm.io/package/resolve.md) ^1.12.0
- [tiny-glob](https://npm.io/package/tiny-glob.md) ^0.2.6
- [tsconfig-paths](https://npm.io/package/tsconfig-paths.md) ^3.9.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
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.4.2 (latest) — 2019-10-02
- 0.4.1 — 2019-10-02
- 0.4.0 — 2019-09-22
- 0.3.0 — 2019-09-11
- 0.2.0 — 2019-09-10
- 0.1.0 — 2019-09-10

## README

# eslint-import-resolver-ts

[![GitHub Actions](https://github.com/rx-ts/eslint-import-resolver-ts/workflows/Node%20CI/badge.svg)](https://github.com/rx-ts/eslint-import-resolver-ts/actions)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Frx-ts%2Feslint-import-resolver-ts%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-ts.svg)](https://www.npmjs.com/package/eslint-import-resolver-ts)
[![GitHub Release](https://img.shields.io/github/release/rx-ts/eslint-import-resolver-ts)](https://github.com/rx-ts/eslint-import-resolver-ts/releases)

[![David Peer](https://img.shields.io/david/peer/rx-ts/eslint-import-resolver-ts.svg)](https://david-dm.org/rx-ts/eslint-import-resolver-ts?type=peer)
[![David](https://img.shields.io/david/rx-ts/eslint-import-resolver-ts.svg)](https://david-dm.org/rx-ts/eslint-import-resolver-ts)
[![David Dev](https://img.shields.io/david/dev/rx-ts/eslint-import-resolver-ts.svg)](https://david-dm.org/rx-ts/eslint-import-resolver-ts?type=dev)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![codechecks.io](https://raw.githubusercontent.com/codechecks/docs/master/images/badges/badge-default.svg?sanitize=true)](https://codechecks.io)

This plugin adds TypeScript support to [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import).

This means you can:

- `import`/`require` files with extension `.ts`/`.tsx`!
- Use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) defined in `tsconfig.json`.
- Prefer resolve `@types/*` definitions over plain `.js`.
- Multiple tsconfigs support just like normal.

## TOC <!-- omit in toc -->

- [Installation](#installation)
- [Configuration](#configuration)
- [Contributing](#contributing)

## Installation

```sh
# npm
npm i -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-ts

# yarn
yarn add -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-ts
```

## Configuration

Add the following to your `.eslintrc` config:

```jsonc
{
  "plugins": ["import"],
  "rules": {
    // turn on errors for missing imports
    "import/no-unresolved": "error"
  },
  "settings": {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"]
    },
    "import/resolver": {
      // use <root>/tsconfig.json
      "ts": {
        "alwaysTryTypes": true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
      },

      // use <root>/path/to/folder/tsconfig.json
      "ts": {
        "directory": "./path/to/folder"
      },

      // Multiple tsconfigs (Useful for monorepos)

      // use a glob pattern
      "ts": {
        "directory": "./packages/*/tsconfig.json"
      },

      // use an array
      "ts": {
        "directory": [
          "./packages/module-a/tsconfig.json",
          "./packages/module-b/tsconfig.json"
        ]
      },

      // use an array of glob patterns
      "ts": {
        "directory": [
          "./packages/*/tsconfig.json",
          "./other-packages/*/tsconfig.json"
        ]
      }
    }
  }
}
```

## Contributing

- Make sure your change is covered by a test import.
- Make sure that `yarn test` passes without a failure.
- Make sure that `yarn lint` passes without conflicts.
- Make sure your code changes match our [type-coverage](https://github.com/plantain-00/type-coverage) settings: `yarn type-coverage`.

We have [GitHub Actions](https://github.com/rx-ts/eslint-import-resolver-ts/actions) which will run the above commands on your PRs.

If either fails, we won't be able to merge your PR until it's fixed.

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