Skip to content

zht826/eslint-plugin-import-replace

Repository files navigation

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 🔧

About

A Eslint plugin. Change import source by your rules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published