Helps migrate a large codebase from underscore to lodash
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-underscore-to-lodash
:
$ npm install eslint-plugin-underscore-to-lodash --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-underscore-to-lodash
globally.
Add underscore-to-lodash
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"underscore-to-lodash"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"underscore-to-lodash/prefer-import-lodash": 2
}
}
prefer-import-lodash Lints when you have imported underscore instead of lodash. This is very handy for a large codebase migration, as it means all new files will have to use lodash, and existing underscore ones can be slowly migrated over.