{"id":19663,"library":"eslint-import-resolver-jest","title":"eslint-import-resolver-jest","description":"An ESLint resolver for eslint-plugin-import that resolves imports according to Jest's moduleNameMapper configuration. Version 3.0.2 is current stable (as of early 2025). Release cadence is irregular. It reads Jest config from package.json or a specified config file, enabling ESLint to understand aliased imports used in test files. Alternative to manual resolution override; integrates directly with eslint-plugin-import.","status":"active","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/JoinColony/eslint-import-resolver-jest","tags":["javascript","eslint","eslintplugin","jest","resolver","eslint-plugin-import"],"install":[{"cmd":"npm install eslint-import-resolver-jest","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-import-resolver-jest","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-import-resolver-jest","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency that supplies the import resolution hooks","package":"eslint-plugin-import","optional":false}],"imports":[{"note":"Plugin is used as an ESLint resolver, not imported in code.","wrong":"import resolver from 'eslint-import-resolver-jest'","symbol":"default resolver","correct":"// In .eslintrc{\"settings\":{\"import/resolver\":{\"jest\":true}}}"},{"note":"TypeScript type only; available since v3 for configuring options.","wrong":"const JestResolverOptions = require('eslint-import-resolver-jest')","symbol":"JestResolverOptions","correct":"import type { JestResolverOptions } from 'eslint-import-resolver-jest'"},{"note":"Use 'jestConfigFile', not 'config'.","wrong":"{\"settings\":{\"import/resolver\":{\"jest\":{\"config\":\"./jest.config.js\"}}}}","symbol":"config via .eslintrc","correct":"{\"settings\":{\"import/resolver\":{\"jest\":{\"jestConfigFile\":\"./jest.config.js\"}}}}"}],"quickstart":{"code":"// .eslintrc\n{\n  \"settings\": {\n    \"import/resolver\": {\n      \"jest\": {\n        \"jestConfigFile\": \"./jest.config.js\"\n      }\n    }\n  }\n}","lang":"javascript","description":"Configures ESLint to resolve imports using Jest's moduleNameMapper by pointing to a separate Jest config file."},"warnings":[{"fix":"Upgrade to v3.0.0 or later.","message":"Resolved versions prior to 3.0.0 did not respect the Jest config file's '__esModule' option, leading to incorrect resolution.","severity":"gotcha","affected_versions":"<3.0.0"},{"fix":"Explicitly set 'jestConfigFile' to your Jest config file path.","message":"If no jestConfigFile is specified, the resolver looks for a 'jest' key in package.json. It does NOT support jest.config.js or jest.config.ts by default.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure Jest config includes testRegex or testMatch.","message":"The resolver uses 'testRegex' and 'testMatch' from Jest config; if those are missing, it may resolve all files incorrectly.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Update .eslintrc to include 'jestConfigFile' if you were relying on auto-detection from v1.","message":"Version 2.x changed the default behavior to require explicit 'jestConfigFile' if not using package.json config.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install eslint-import-resolver-jest and configure in .eslintrc settings as shown in quickstart.","cause":"Jest moduleNameMapper maps 'utils/helper' to '<rootDir>/src/utils/helper', but ESLint doesn't know about that mapping without this resolver.","error":"Unable to resolve path to module 'utils/helper'."},{"fix":"Run: npm install eslint-import-resolver-jest --save-dev","cause":"The resolver package is not installed or not listed in dependencies.","error":"Settings: Unknown resolver 'jest'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}