A babel-plugin-root-import resolver for eslint-plugin-import.
This is a fork of eslint-import-resolver-babel-root-import that works with latest version of babel plugin.
npm install --save-dev eslint-plugin-import eslint-import-resolver-babel-plugin-root-import
Inside your .eslintrc
file, pass this resolver to eslint-plugin-import
:
"settings": {
"import/resolver": "babel-plugin-root-import"
}
And see babel-plugin-root-import to know how to configure your prefix/suffix.
Configuration will be parsed down from .babelrc
file
{
"extends": "airbnb",
"rules": {},
"settings": {
"import/resolver": {
"babel-plugin-root-import": {}
}
}
}
Or if you don't use .babelrc
and keep your babel configuration in, say, webpack
config you can pass those options to resolver directly through .eslintrc
file:
{
"extends": "airbnb",
"rules": {},
"settings": {
"import/resolver": {
"babel-plugin-root-import": {
"rootPathPrefix": "@",
"rootPathSuffix": "src/js"
}
}
}
}
MIT, see LICENSE.md for details.