eslint-plugin-magic-variables
prevent variables that are the number representation of a magic number from being used
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-magic-variables
:
npm install eslint-plugin-magic-variables --save-dev
Usage
Add magic-variables
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"magic-variables"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"magic-variables/rule-name": 2
}
}
Rules