1.0.8 • Published 8 years ago

eslint-plugin-promiseparams v1.0.8

Weekly downloads
15
License
ISC
Repository
github
Last release
8 years ago

eslint-plugin-promiseparams

Enforce standard parameter names for Promise constructors

js-standard-style travis-ci npm version

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 jason@denizac.org - ISC license.

1.0.8

8 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago