eslint-import-resolver-babel-module

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

MIT 25 个版本
安装
npm install eslint-import-resolver-babel-module
yarn add eslint-import-resolver-babel-module
pnpm add eslint-import-resolver-babel-module
bun add eslint-import-resolver-babel-module
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.

版本列表
5.3.2 2023-01-16
5.3.1 2021-04-26
5.3.0 2021-04-19
5.2.0 2020-10-19
5.1.2 2020-01-23
5.1.1 2020-01-07
5.1.0 2019-04-25
5.0.1 2019-01-29
5.0.0-beta.1 2018-08-14
5.0.0-beta.0 2017-12-11
5.0.0 2019-01-22
4.0.0-beta.5 2017-10-12
4.0.0-beta.3 2017-07-10
4.0.0-beta.2 2017-05-17
4.0.0-beta.1 2017-04-25
4.0.0-beta.0 2017-04-23
4.0.0 2017-12-11
3.0.0-beta.1 2016-10-10
3.0.0 2017-02-05
2.2.1 2016-11-11
2.2.0 2016-11-09
2.1.1 2016-11-07
2.1.0 2016-11-06
2.0.1 2016-08-14
2.0.0 2016-08-14