Skip to content

Commit

Permalink
docs(param-names): fix incorrect description location (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored and macklinu committed Jul 7, 2018
1 parent 54f1958 commit 47d5c55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
28 changes: 0 additions & 28 deletions docs/rules/no-return-wrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,3 @@ myPromise.then(function(val) {
Pass `{ allowReject: true }` as an option to this rule to permit wrapping
returned values with `Promise.reject`, such as when you would use it as another
way to reject the promise.

### `param-names`

Enforce standard parameter names for Promise constructors

:wrench: The `--fix` option on the command line can automatically fix some of
the problems reported by this rule.

#### Valid

```js
new Promise(function (resolve) { ... })
new Promise(function (resolve, reject) { ... })
```

#### Invalid

```js
new Promise(function (reject, resolve) { ... }) // incorrect order
new Promise(function (ok, fail) { ... }) // non-standard parameter names
```

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](https://blog.domenic.me/the-revealing-constructor-pattern/).
Using the same parameter names as the language specification makes code more
uniform and easier to understand.
26 changes: 26 additions & 0 deletions docs/rules/param-names.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# Enforce consistent param names when creating new promises (param-names)

Enforce standard parameter names for Promise constructors

:wrench: The `--fix` option on the command line can automatically fix some of
the problems reported by this rule.

#### Valid

```js
new Promise(function (resolve) { ... })
new Promise(function (resolve, reject) { ... })
```

#### Invalid

```js
new Promise(function (reject, resolve) { ... }) // incorrect order
new Promise(function (ok, fail) { ... }) // non-standard parameter names
```

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](https://blog.domenic.me/the-revealing-constructor-pattern/).
Using the same parameter names as the language specification makes code more
uniform and easier to understand.

0 comments on commit 47d5c55

Please sign in to comment.