eslint-plugin-let-and-var
v0.2.4
Published
Use block scopes and let while retaining function scopes and var
Maintainers
Readme
eslint-plugin-let-and-var
Use block scopes and let while retaining function scopes and var.
Useful in retaining a function-first methodology in reasoning while keeping the strengths of let: while functions can be considered a type of block scope there is power in thinking in functions over blocks (ex: Array.prototype methods).
See For and against let for other arguments and details.
Couple this with prefer-const. This is an alternative to the (extreme) no-var.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-devNext, install eslint-plugin-let-and-var:
$ npm install eslint-plugin-let-and-var --save-devNote: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-let-and-var globally.
Usage
Add let-and-var to the plugins section of your .eslintrc.* configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"let-and-var"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"prefer-const": 2,
"no-var": 0,
"let-and-var/scopes": 2
}
}Supported Rules
scopes
Use
letin block scopes andvarin function scopes.
