Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

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

unconfident42.7kMIT1.1.1

fork of eslint-import-resolver-babel-root-import that works

eslint, eslint-plugin-import, eslint-import-resolver, babel, babel-plugin, module, babel-root-import, babel-plugin-root-import, rewrite, resolve, rename, mapping, require, import

readme

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.