eslint-plugin-import-replace

1.0.0 • Public • Published

eslint-plugin-import-replace

Change import source

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-import-replace:

npm install eslint-plugin-import-replace --save-dev

Usage

Add import-replace to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "import-replace"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "import-replace/import-replace": ["error", [
            {
                "from": "lodash",
                "to": "lodash-es"
            }
        ]]
    }
}

then run eslint on your project.

if your code is

import { get } from 'lodash';

then it will be autofixed to

import { get } from 'lodash-es';

Configurations

TODO: Run eslint-doc-generator to generate the configs list (or delete this section if no configs are offered).

Rules

🔧 Automatically fixable by the --fix CLI option.

Name 🔧
import-replace 🔧

Package Sidebar

Install

npm i eslint-plugin-import-replace

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

8.15 kB

Total Files

9

Last publish

Collaborators

  • zht826