Home

Awesome

eslint-import-resolver-babel-plugin-root-import

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.

Installation

npm install --save-dev eslint-plugin-import eslint-import-resolver-babel-plugin-root-import

Usage

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

Example

{
  "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"
      }
    }
  }
}

License

MIT, see LICENSE.md for details.