
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@helljs/eslint-import-resolver-x
Advanced tools
This plugin adds support `jsconfig` or `tsconfig` aliases to `eslint-plugin-import`
This resolver adds TypeScript or JavaScript import support to eslint-plugin-import with tsconfig.json or jsconfig.json aliases (compilerOptions.paths)
This is fork of eslint-import-resolver-typescript but much faster and more efficient. You can save time on project linting by (~30-40%).

We use strace package for count of fstat call when linting codebase
For example you codebase has multiple packages with 100 000 LOC ()
The following data depends directly on the number of imports in your case, but the comparison table is filled with data on the same code base
| syscall | eslint-import-resolver-x | eslint-import-resolver-typescript |
|---|---|---|
| access | 52 900 | 50 641 |
| chdir | 1 | 1 |
| execve | 78 | 78 |
| faccessat2 | 1 | 1 |
| getcwd | 3 | 3 |
| mkdir | 2 | 2 |
| newfstatat | 31 761 | 32 137 🔺 |
| openat | 74 965 | 81 592 🔺 |
| readlink | 1 183 525 | 1 194 240 🔺 |
| statfs | 2 | 2 |
| statx | 1 058 381 | 11 734 655 🔺 |
| unlink | 3 | 2 |
We are interested in how many accesses to the file system occurred during the linting process.
For example we can pay attention to statx syscall.
eslint-import-resolver-x makes 10 MILLION fewer statx calls
If you notice an increase in linting performance in your CI on large code bases, write your feedback here
You can:
import/require files with extension any extenstions of js or tspaths defined in tsconfig.json or jsconfig.jsonimports/exports fields support in package.json# npm
npm i -D eslint-plugin-import @helljs/eslint-import-resolver-x
# pnpm
pnpm i -D eslint-plugin-import @helljs/eslint-import-resolver-x
# yarn
yarn add -D eslint-plugin-import @helljs/eslint-import-resolver-x
If you are using eslint-plugin-import-x@>=4.5.0, you can use import/require to reference eslint-import-resolver-x directly in your ESLint flat config:
// eslint.config.js
const {
createImportResolver,
} = require('eslint-import-resolver-x')
module.exports = [{
settings: {
"import/resolver-x": [
createImportResolver({
alwaysTryTypes: true,
project: "path/to/folder",
// ...
}),
];
}
}]
Add the following to your .eslintrc config:
{
"plugins": ["import"],
"rules": {
// turn on errors for missing imports
"import/no-unresolved": "error",
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
"@helljs/eslint-import-resolver-x": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
// use <root>/path/to/folder/tsconfig.json
"project": "path/to/folder",
// Multiple tsconfigs (Useful for monorepos)
// use a glob pattern
"project": "packages/*/tsconfig.json",
// use an array
"project": ["packages/module-a/tsconfig.json", "packages/module-b/tsconfig.json"],
// use an array of glob patterns
"project": ["packages/*/tsconfig.json", "other-packages/*/tsconfig.json"],
},
},
},
}
{
"plugins": ["import"],
"rules": {
// turn on errors for missing imports
"import/no-unresolved": "error",
},
"settings": {
"import/parsers": {
"@babel/eslint-parser": [".js", ".mjs"],
},
"import/resolver": {
"@helljs/eslint-import-resolver-x": {
// use <root>/path/to/folder/jsconfig.json
"project": "path/to/folder",
// Multiple jsconfigs (Useful for monorepos)
// use a glob pattern
"project": "packages/*/jsconfig.json",
// use an array
"project": ["packages/module-a/jsconfig.json", "packages/module-b/jsconfig.json"],
// use an array of glob patterns
"project": ["packages/*/jsconfig.json", "other-packages/*/jsconfig.json"],
},
},
},
}
You can use this resolver for mixed codebase with javascript & typescript:
"settings": {
"import/parsers": {
"@babel/eslint-parser": [".js", ".mjs"],
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
"@helljs/eslint-import-resolver-x": {
"project": ["packages/*/tsconfig.json", "packages/*/jsconfig.json"],
},
},
}
enhanced-resolveconditionNames - See defaultextensions - See defaultextensionAlias - See defaultmainFields - See defaultYou can pass through other options of enhanced-resolve directly
FAQs
This plugin adds support `jsconfig` or `tsconfig` aliases to `eslint-plugin-import`
We found that @helljs/eslint-import-resolver-x demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.