zht826 / eslint-plugin-import-replace

A Eslint plugin. Change import source by your rules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:MIT License


Languages

Language:JavaScript 100.0%