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

Package detail

eslint-import-resolver-babel-module

tleunen704.3kMIT5.3.2

babel-plugin-module-resolver resolver for eslint-plugin-import

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

readme

eslint-import-resolver-babel-module

npm Build Status Coverage Status

A babel-plugin-module-resolver resolver for eslint-plugin-import

Installation

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

Usage

Inside your .eslintrc file, pass this resolver to eslint-plugin-import:

"settings": {
  "import/resolver": {
    "babel-module": {}
  }
}

And see babel-plugin-module-resolver to know how to configure your aliases.

Example

{
  "extends": "airbnb",
  "rules": {
    "comma-dangle": 0
  },
  "settings": {
    "import/resolver": {
      "babel-module": {}
    }
  }
}

Directory Imports

Some babel plugins like babel-plugin-import-directory or babel-plugin-wildcard allow to import directories (i.e. each file inside a directory) as an object. In order to support this, you can activate the allowExistingDirectories option as follows:

"settings": {
  "import/resolver": {
    "babel-module": { allowExistingDirectories: true }
  }
}

Now when you import a directory like this, the ESLint plugin won't complain and recognize the existing directory:

import * as Items from './dir';

License

MIT, see LICENSE.md for details.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

5.3.2 (2023-01-16)

5.3.1 (2021-04-26)

Bug Fixes

5.3.0 (2021-04-19)

⚠ BREAKING CHANGES

  • Now requires Node 10

Features

  • Allow early exit on existing directories (#115) (f5f205e)
  • Update dev dependencies (6376546)

5.2.0 (2020-10-19)

Features

  • Add support for passing babelOptions to OptionsManager#init (#113) (c23f28d)

5.1.2 (2020-01-23)

Bug Fixes

  • Add support for custom resolvePath from babel plugin (#109) (5708051)

5.1.1 (2020-01-07)

5.1.0 (2019-04-25)

Features

5.0.1 (2019-01-29)

Bug Fixes

  • Fix bad babel compilation & compile the spread operator with Object.assign (a2d8712), closes #98

5.0.0 (2019-01-22)

5.0.0-beta.1 (2018-08-14)

5.0.0-beta.0 (2017-12-11)

Bug Fixes

  • babel: Support latest babel 7 only (#78) (f2804c5)

BREAKING CHANGES

  • babel: This resolver now requires babel 7

4.0.0 (2017-12-11)

Bug Fixes

4.0.0-beta.5 (2017-10-12)

4.0.0-beta.4 (2017-10-12)

Features

  • Add support for Babel 7.0.0 (#63) (1ffa7f5)
  • Allow the resolver options to be set in the eslint file (#68) (8ee7c08)

4.0.0-beta.3 (2017-07-10)

Bug Fixes

  • Use new resolvePath function from module-resolver 3.0.0-beta.4 (f731792)

4.0.0-beta.2 (2017-05-17)

Features

  • Strip the webpack loaders and query string from the source before resolving the file (#60) (21c37f2), closes #59

4.0.0-beta.1 (2017-04-25)

Bug Fixes

  • Fix resolution when using a custom cwd (#55) (188f338), closes #43
  • Fix the custom babel cwd in an editor (#56) (b13ffd9)

4.0.0-beta.0 (2017-04-23)

Bug Fixes

  • Fix build (91029b8)
  • Fix lib to support babel plugin v3 (#54) (731ab8c)
  • Prevents options.extensions from failing when options is null (#47) (5d297a7)

BREAKING CHANGES

  • Not compatible with babel-plugin-module-resolver v2.x

3.0.0 (2017-02-05)

Bug Fixes

  • Fix support for custom extensions from babel (#39) (fa885e8)

Features

  • Use babel's built-in option manager for loading configs (#34) (c526927)

Fix

  • Fix linting when using a root glob config (#38) (45a78be)

BREAKING CHANGES

  • Now requires babel-plugin-module-resolver >= 2.5.0
  • The root config and alias must be relative to the project root, not relative to the babelrc file.

2.2.1 (2016-11-11)

Reverts

  • "Use babel's built-in option manager for loading configs." (#31) (6d1add0)

2.2.0 (2016-11-09)

Features

  • Add support for having the babel plugin configured in a preset (#28) (952863e)

2.1.1 (2016-11-07)

Bug Fixes

2.1.0 (2016-11-06)

Features

  • Add support for the custom cwd option from babel-resolver (0a0d42c)

2.0.1 (2016-08-14)

Bug Fixes

  • Remove deconstructuring to fix build on Node < 6 (9649b9a)

2.0.0 (2016-08-14)

Features

  • Support for new version of babel-plugin-module-resolver v2 (f2fc1f3)

BREAKING CHANGES

  • This removes the support for babel-plugin-module-alias v1

1.5.1 (2016-08-09)

Bug Fixes

  • Fix config lookup with specific environment (50f4f6e), closes #22

1.5.0 (2016-08-06)

Bug Fixes

  • resolver: Add cascading support (#17) (dd94f0a), closes #15
  • Also search config with 'babel-plugin-' prefix name (c7633d6)

Features

1.4.2 (2016-07-10)

Bug Fixes

  • mapping: Fix mapping again in editors (3b3bc98)

1.4.1 (2016-07-10)