eslint-plugin-promiseparams
v1.0.8
Published
Enforce standard parameter names for Promise constructors
Downloads
84
Maintainers
Readme
eslint-plugin-promiseparams
Enforce standard parameter names for Promise constructors
Deprecated: please use eslint-plugin-promise instead
Rule
promiseparams
Valid
new Promise(function (resolve) { ... })
new Promise(function (resolve, reject) { ... })
Invalid
// incorrect order:
new Promise(function (reject, resolve) { ... })
// non-standard parameter names:
new Promise(function (ok, fail) { ... })
Ensures that new Promise()
is instantiated with the parameter names resolve, reject
to avoid confusion with order such as reject, resolve
. The Promise constructor uses the RevealingConstructor pattern. Using the same parameter names as the language specification makes code more uniform and easier to understand.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-promiseparams
:
$ npm install eslint-plugin-promiseparams --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-promiseparams
globally.
Usage
Add promiseparams
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"promiseparams"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"promiseparams/promiseparams": 2
}
}
Etc
(c) MMXV jden [email protected] - ISC license.