{"id":19670,"library":"eslint-import-resolver-root-import","title":"eslint-import-resolver-root-import","description":"ESLint resolver for babel-plugin-root-import that enables custom root-based module import aliases (e.g., '~/components/MyComponent'). Version 1.0.4 is stable and maintained. It works with babel-plugin-root-import >=5.1.0 and eslint-plugin-import >=1.9.2. Key differentiator: it uses babel.config.js for automatic configuration of rootPathSuffix and rootPathPrefix, unlike the original fork which required separate .babelrc settings. This package is tailored for React Native and other Babel projects that rely on root imports for cleaner import paths.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/diego3g/eslint-import-resolver-root-import","tags":["javascript","eslint","eslint-plugin-import","eslint-import-resolver","babel","babel-plugin","module","babel-root-import","babel-plugin-root-import"],"install":[{"cmd":"npm install eslint-import-resolver-root-import","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-import-resolver-root-import","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-import-resolver-root-import","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - the resolver uses the same root import prefix/suffix configuration from this Babel plugin.","package":"babel-plugin-root-import","optional":false},{"reason":"Peer dependency - the resolver hooks into eslint-plugin-import's resolver system.","package":"eslint-plugin-import","optional":false}],"imports":[{"note":"The package exports a single function that acts as the resolver. It is used internally by eslint-plugin-import, not normally imported directly by user code.","wrong":"","symbol":"default","correct":"import resolver from 'eslint-import-resolver-root-import'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  settings: {\n    'import/resolver': {\n      'root-import': {\n        rootPathPrefix: '~',\n        rootPathSuffix: 'src',\n        extensions: ['.js', '.jsx', '.ts', '.tsx']\n      }\n    }\n  },\n  rules: {\n    'import/no-unresolved': 'error'\n  }\n};\n\n// babel.config.js\nmodule.exports = {\n  plugins: [\n    ['babel-plugin-root-import', {\n      rootPathPrefix: '~',\n      rootPathSuffix: 'src'\n    }]\n  ]\n};","lang":"javascript","description":"Configure ESLint and Babel to resolve root imports with '~' prefix pointing to './src' directory."},"warnings":[{"fix":"Ensure babel-plugin-root-import is installed and configured in babel.config.js.","message":"The resolver requires babel-plugin-root-import configuration to be present; otherwise root imports will not be resolved.","severity":"gotcha","affected_versions":"1.0.4"},{"fix":"Either remove conflicting settings from .eslintrc or ensure they match babel.config.js.","message":"Settings in .eslintrc override the configuration from babel.config.js. If both are provided, .eslintrc takes precedence.","severity":"gotcha","affected_versions":"1.0.4"},{"fix":"Use babel.config.js (project-wide) instead of .babelrc.","message":"This package is a fork of an older resolver that used .babelrc. Newer versions of Babel use babel.config.js.","severity":"deprecated","affected_versions":"1.0.4"},{"fix":"Avoid using unsupported options in resolver settings.","message":"The resolver only supports rootPathPrefix and rootPathSuffix; other babel-plugin-root-import options like rootPathStrategy are ignored.","severity":"gotcha","affected_versions":"1.0.4"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install babel-plugin-root-import and add rootPathPrefix/suffix to babel.config.js.","cause":"babel-plugin-root-import is not installed or babel.config.js is missing required config.","error":"Error: No configuration found for root-import resolver. Please ensure babel-plugin-root-import is installed and configured."},{"fix":"Check that rootPathSuffix points to the correct directory relative to project root. Verify file extensions are included in the resolver settings.","cause":"The root-import resolver is not properly configured or the path does not exist.","error":"Unable to resolve path to module '~/components/MyComponent'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}