Disallows one-time variables
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-no-one-time-vars
:
npm install eslint-plugin-no-one-time-vars --save-dev
Add no-one-time-vars
to the plugins section of your .eslintrc
configuration
file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["no-one-time-vars"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"no-one-time-vars/rule-name": "error"
}
}
To add an option to the rule configuration do the following:
{
"rules": {
"no-one-time-vars/rule-name": [
"error",
{
"option-name": "option-value"
}
]
}
}
- no-one-time-vars
- ignoredVariables
- type:
Array of strings
- default:
[]
- type:
- allowInsideCallback
- type:
Boolean
- default:
true
- type:
- ignoreFunctionVariables
- type:
Boolean
- default:
true
- type:
- ignoreArrayVariables
- type:
Boolean
,Number
- default:
false
- type:
- ignoreObjectVariables
- type:
Boolean
- default:
false
- type:
- ignoreObjectDestructuring:
- type:
Boolean
- default:
false
- type:
- ignoreExportedVariables:
- type:
Boolean
- default:
true
- type: