Gathering detailed insights and metrics for eslint-import-resolver-typescript
Gathering detailed insights and metrics for eslint-import-resolver-typescript
Gathering detailed insights and metrics for eslint-import-resolver-typescript
Gathering detailed insights and metrics for eslint-import-resolver-typescript
eslint-import-resolver-typescript-bun
[](https://github.com/import-js/eslint-import-resolver-typescript/actions/workflows/ci.yml) [ (ISC license) by [Alex Gorbatchev](https://github.com/alexgorbatchev).
eslint-import-resolver-ts
TypeScript .ts .tsx module resolver for `eslint-plugin-import`.
eslint-plugin-import-typescript-resolver
TypeScript .ts .tsx module resolver for `eslint-plugin-import`.
This resolver adds `TypeScript` support to `eslint-plugin-import(-x)`
npm install eslint-import-resolver-typescript
Typescript
Module System
Min. Node Version
Node Version
NPM Version
64.5
Supply Chain
87.5
Quality
94
Maintenance
100
Vulnerability
98.2
License
TypeScript (73.54%)
JavaScript (26.46%)
Total Downloads
1,215,087,558
Last Day
630,399
Last Week
11,997,849
Last Month
51,745,549
Last Year
504,653,471
ISC License
794 Stars
346 Commits
72 Forks
5 Watchers
5 Branches
46 Contributors
Updated on Jul 04, 2025
Minified
Minified + Gzipped
Latest Version
4.4.4
Package Id
eslint-import-resolver-typescript@4.4.4
Unpacked Size
58.57 kB
Size
14.57 kB
File Count
23
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 25, 2025
Cumulative downloads
Total Downloads
Last Day
-9.4%
630,399
Compared to previous day
Last Week
-7.7%
11,997,849
Compared to previous week
Last Month
-5.2%
51,745,549
Compared to previous month
Last Year
43.2%
504,653,471
Compared to previous year
This is a resolver for eslint-plugin-import(-x)
plugin, not an ESLint plugin itself, it adds TypeScript
support to eslint-plugin-import
. (Or maybe you want to try eslint-plugin-import-x
for faster speed)
This means you can:
import
/require
files with extension .cts
/.mts
/.ts
/.tsx
/.d.cts
/.d.mts
/.d.ts
paths
defined in tsconfig.json
@types/*
definitions over plain .js
/.jsx
imports/exports
fields support in package.json
unrs-resolver
After version 2.0.0, .d.ts
will take higher priority than normal .js
/.jsx
files on resolving node_modules
packages in favor of @types/*
definitions or its own definition.
If you're facing some problems with rules import/default
or import/named
from eslint-plugin-import
, do not post any issue here, because they are working exactly as expected on our side. Take import-js/eslint-plugin-import#1525 as reference or post a new issue on eslint-plugin-import
instead.
eslint-plugin-import-x
1# npm 2npm i -D eslint-plugin-import-x eslint-import-resolver-typescript 3 4# pnpm 5pnpm i -D eslint-plugin-import-x eslint-import-resolver-typescript 6 7# yarn 8yarn add -D eslint-plugin-import-x eslint-import-resolver-typescript 9 10# bun 11bun add -d eslint-plugin-import-x eslint-import-resolver-typescript
eslint-plugin-import
1# npm 2npm i -D eslint-plugin-import eslint-import-resolver-typescript 3 4# pnpm 5pnpm i -D eslint-plugin-import eslint-import-resolver-typescript 6 7# yarn 8yarn add -D eslint-plugin-import eslint-import-resolver-typescript 9 10# bun 11bun add -d eslint-plugin-import eslint-import-resolver-typescript
eslint.config.js
If you are using eslint-plugin-import-x@>=4.5.0
, you can use import
/require
to reference eslint-import-resolver-typescript
directly in your ESLint flat config:
1// eslint.config.js (CommonJS is also supported) 2import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript' 3 4export default [ 5 { 6 settings: { 7 'import-x/resolver-next': [ 8 createTypeScriptImportResolver({ 9 alwaysTryTypes: true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist` 10 11 bun: true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun) 12 13 // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default 14 15 // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json 16 project: 'path/to/folder', 17 18 // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported) 19 20 // Use a glob pattern 21 project: 'packages/*/{ts,js}config.json', 22 23 // Use an array 24 project: [ 25 'packages/module-a/tsconfig.json', 26 'packages/module-b/jsconfig.json', 27 ], 28 29 // Use an array of glob patterns 30 project: [ 31 'packages/*/tsconfig.json', 32 'other-packages/*/jsconfig.json', 33 ], 34 }), 35 ], 36 }, 37 }, 38]
But if you are using eslint-plugin-import
or the older version of eslint-plugin-import-x
, you can't use require
/import
:
1// eslint.config.js (CommonJS is also supported) 2export default [ 3 { 4 settings: { 5 'import/resolver': { 6 typescript: { 7 alwaysTryTypes: true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist` 8 9 bun: true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun) 10 11 // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default 12 13 // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json 14 project: 'path/to/folder', 15 16 // Multiple tsconfigs/jsconfigs (Useful for monorepos, but discouraged in favor of `references` supported) 17 18 // Use a glob pattern 19 project: 'packages/*/{ts,js}config.json', 20 21 // Use an array 22 project: [ 23 'packages/module-a/tsconfig.json', 24 'packages/module-b/jsconfig.json', 25 ], 26 27 // Use an array of glob patterns 28 project: [ 29 'packages/*/tsconfig.json', 30 'other-packages/*/jsconfig.json', 31 ], 32 }, 33 }, 34 }, 35 }, 36]
.eslintrc
Add the following to your .eslintrc
config:
1{ 2 "plugins": ["import"], 3 "rules": { 4 // Turn on errors for missing imports 5 "import/no-unresolved": "error", 6 }, 7 "settings": { 8 "import/parsers": { 9 "@typescript-eslint/parser": [".ts", ".tsx"], 10 }, 11 "import/resolver": { 12 "typescript": { 13 "alwaysTryTypes": true, // Always try to resolve types under `<root>@types` directory even if it doesn't contain any source code, like `@types/unist` 14 15 "bun": true, // Resolve Bun modules (https://github.com/import-js/eslint-import-resolver-typescript#bun) 16 17 // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json or <root>/jsconfig.json by default 18 19 // Use <root>/path/to/folder/tsconfig.json or <root>/path/to/folder/jsconfig.json 20 "project": "path/to/folder", 21 22 // Multiple tsconfigs (Useful for monorepos, but discouraged in favor of `references` supported) 23 24 // Use a glob pattern 25 "project": "packages/*/{ts,js}config.json", 26 27 // Use an array 28 "project": [ 29 "packages/module-a/tsconfig.json", 30 "packages/module-b/jsconfig.json", 31 ], 32 33 // Use an array of glob patterns 34 "project": [ 35 "packages/*/tsconfig.json", 36 "other-packages/*/jsconfig.json", 37 ], 38 }, 39 }, 40 }, 41}
Bun provides built-in modules such as bun:test
, which are not resolved by default.
Enable Bun built-in module resolution by choosing 1 out of these 3 options:
bun: true
option, as shown in Configuration above.bun --bun eslint
.run.bun
in bunfig.toml
.unrs-resolver
conditionNames
Default:
1[ 2 "types", 3 "import", 4 5 // APF: https://angular.io/guide/angular-package-format 6 "esm2020", 7 "es2020", 8 "es2015", 9 10 "require", 11 "node", 12 "node-addons", 13 "browser", 14 "default", 15]
extensions
Default:
1[ 2 // `.mts`, `.cts`, `.d.mts`, `.d.cts`, `.mjs`, `.cjs` are not included because `.cjs` and `.mjs` must be used explicitly 3 ".ts", 4 ".tsx", 5 ".d.ts", 6 ".js", 7 ".jsx", 8 ".json", 9 ".node", 10]
extensionAlias
Default:
1{ 2 ".js": [ 3 ".ts", 4 // `.tsx` can also be compiled as `.js` 5 ".tsx", 6 ".d.ts", 7 ".js", 8 ], 9 ".ts": [".ts", ".d.ts", ".js"], 10 ".jsx": [".tsx", ".d.ts", ".jsx"], 11 ".tsx": [ 12 ".tsx", 13 ".d.ts", 14 ".jsx", 15 // `.tsx` can also be compiled as `.js` 16 ".js", 17 ], 18 ".cjs": [".cts", ".d.cts", ".cjs"], 19 ".cts": [".cts", ".d.cts", ".cjs"], 20 ".mjs": [".mts", ".d.mts", ".mjs"], 21 ".mts": [".mts", ".d.mts", ".mjs"], 22}
mainFields
Default:
1[ 2 "types", 3 "typings", 4 5 // APF: https://angular.io/guide/angular-package-format 6 "fesm2020", 7 "fesm2015", 8 "esm2020", 9 "es2020", 10 11 "module", 12 "jsnext:main", 13 14 "main", 15]
You can pass through other options of unrs-resolver
directly.
You can reuse defaultConditionNames
, defaultExtensions
, defaultExtensionAlias
, and defaultMainFields
by directly using require
/import
.
yarn test
passes without a failure.yarn lint
passes without conflicts.yarn type-coverage
.We have GitHub 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.
1stG | RxTS | UnTS |
---|---|---|
1stG | RxTS | UnTS |
---|---|---|
Detailed changes for each release are documented in CHANGELOG.md.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
24 commit(s) and 24 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 8
Details
Reason
SAST tool is not run on all commits -- score normalized to 8
Details
Reason
Found 6/17 approved changesets -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More