File tree Expand file tree Collapse file tree 2 files changed +26
-28
lines changed Expand file tree Collapse file tree 2 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -32,31 +32,3 @@ myPromise.then(function(val) {
32
32
Pass ` { allowReject: true } ` as an option to this rule to permit wrapping
33
33
returned values with ` Promise.reject ` , such as when you would use it as another
34
34
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.
Original file line number Diff line number Diff line change 1
1
# 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.
You can’t perform that action at this time.
0 commit comments