eslint-plugin-promiseparams v1.0.8
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-devNext, install eslint-plugin-promiseparams:
$ npm install eslint-plugin-promiseparams --save-devNote: 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 jason@denizac.org - ISC license.