eslint-plugin-undef-init
v0.0.3
Published
Always initialize variables during declaration. Set it explicitly to undefined, if required.
Downloads
259
Maintainers
Readme
eslint-plugin-undef-init
Always initialize variables during declaration. Set it explicitly to undefined, if required.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-undef-init
:
$ npm install eslint-plugin-undef-init --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-undef-init
globally.
Usage
Either extend from the plugin or add the rules explicitly.
A. Extend from plugin
{
"extends": [
// ... other extends here (like airbnb)
"plugin:undef-init/recommended"
]
}
OR
B. Use rule directly
Add undef-init
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"undef-init"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"no-undef-init": 0, // Disable conflicting rule
"undef-init/undef-init": 1,
}
}
Supported Rules
There is only one rule, for now -
undef-init
- Disallow variable declaration without initialization.
There is a built-in conflicting rule no-undef-init
in eslint, so you'll need to disable it if you are using this rule