eslint-import-resolver-jsconfig
raw JSON → 1.1.0 verified Sat Apr 25 auth: no javascript
Resolver for eslint-plugin-import that resolves import aliases defined in jsconfig.json. Version 1.1.0 is current; the package is stable and updated irregularly. It enables ESLint to understand path aliases in jsconfig (common in Create React App projects) without Webpack configuration. Unlike eslint-import-resolver-webpack or eslint-import-resolver-alias, this resolver directly reads jsconfig.json and is lightweight with no heavy dependencies.
Common errors
error Error: Cannot find module 'eslint-import-resolver-jsconfig' ↓
cause Package not installed or not in node_modules.
fix
Run 'npm install eslint-import-resolver-jsconfig --save-dev'.
error Error: Unable to resolve path to module 'components/Button' ↓
cause Alias not defined in jsconfig.json or resolver not configured properly.
fix
Check that jsconfig.json includes 'compilerOptions.paths' with the alias mapping, and that the resolver settings key is 'jsconfig'.
Warnings
gotcha The resolver key in settings must be 'jsconfig', not the full package name. Common mistake: using 'eslint-import-resolver-jsconfig' as key. ↓
fix Use 'jsconfig' as the key in settings.import/resolver.
gotcha Requires jsconfig.json to be present and valid. If config path is wrong or file missing, resolver fails silently. ↓
fix Ensure jsconfig.json exists and path is correct (default: './jsconfig.json').
deprecated Package has not been updated since 2020; may not support newer ESLint or eslint-plugin-import versions. ↓
fix Consider alternative resolvers like eslint-import-resolver-typescript or eslint-import-resolver-alias if compatibility issues arise.
Install
npm install eslint-import-resolver-jsconfig yarn add eslint-import-resolver-jsconfig pnpm add eslint-import-resolver-jsconfig Imports
- jsconfig resolver wrong
settings: { 'import/resolver': { 'eslint-import-resolver-jsconfig': { config: 'jsconfig.json' } } }correctsettings: { 'import/resolver': { jsconfig: { config: 'jsconfig.json' } } } - extensions option
settings: { 'import/resolver': { jsconfig: { extensions: ['.js', '.jsx', '.ts', '.tsx'] } } }
Quickstart
// Install: npm install eslint-import-resolver-jsconfig --save-dev
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
jsconfig: {
config: 'jsconfig.json',
},
},
},
rules: {
'import/no-unresolved': 'error',
},
};