Skip to content

Commit 47d5c55

Browse files
ota-meshimacklinu
authored andcommitted
docs(param-names): fix incorrect description location (#137)
1 parent 54f1958 commit 47d5c55

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

docs/rules/no-return-wrap.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,3 @@ myPromise.then(function(val) {
3232
Pass `{ allowReject: true }` as an option to this rule to permit wrapping
3333
returned values with `Promise.reject`, such as when you would use it as another
3434
way to reject the promise.
35-
36-
### `param-names`
37-
38-
Enforce standard parameter names for Promise constructors
39-
40-
:wrench: The `--fix` option on the command line can automatically fix some of
41-
the problems reported by this rule.
42-
43-
#### Valid
44-
45-
```js
46-
new Promise(function (resolve) { ... })
47-
new Promise(function (resolve, reject) { ... })
48-
```
49-
50-
#### Invalid
51-
52-
```js
53-
new Promise(function (reject, resolve) { ... }) // incorrect order
54-
new Promise(function (ok, fail) { ... }) // non-standard parameter names
55-
```
56-
57-
Ensures that `new Promise()` is instantiated with the parameter names
58-
`resolve, reject` to avoid confusion with order such as `reject, resolve`. The
59-
Promise constructor uses the
60-
[RevealingConstructor pattern](https://blog.domenic.me/the-revealing-constructor-pattern/).
61-
Using the same parameter names as the language specification makes code more
62-
uniform and easier to understand.

docs/rules/param-names.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
11
# Enforce consistent param names when creating new promises (param-names)
2+
3+
Enforce standard parameter names for Promise constructors
4+
5+
:wrench: The `--fix` option on the command line can automatically fix some of
6+
the problems reported by this rule.
7+
8+
#### Valid
9+
10+
```js
11+
new Promise(function (resolve) { ... })
12+
new Promise(function (resolve, reject) { ... })
13+
```
14+
15+
#### Invalid
16+
17+
```js
18+
new Promise(function (reject, resolve) { ... }) // incorrect order
19+
new Promise(function (ok, fail) { ... }) // non-standard parameter names
20+
```
21+
22+
Ensures that `new Promise()` is instantiated with the parameter names
23+
`resolve, reject` to avoid confusion with order such as `reject, resolve`. The
24+
Promise constructor uses the
25+
[RevealingConstructor pattern](https://blog.domenic.me/the-revealing-constructor-pattern/).
26+
Using the same parameter names as the language specification makes code more
27+
uniform and easier to understand.

0 commit comments

Comments
 (0)