@@ -22,6 +22,7 @@ Enforce best practices for JavaScript promises.
22
22
* [ ` no-promise-in-callback ` ] ( #no-promise-in-callback )
23
23
* [ ` no-callback-in-promise ` ] ( #no-callback-in-promise )
24
24
* [ ` avoid-new ` ] ( #avoid-new )
25
+ * [ ` no-new-statics ` ] ( #no-new-statics )
25
26
* [ ` no-return-in-finally ` ] ( #no-return-in-finally )
26
27
* [ ` prefer-await-to-then ` ] ( #prefer-await-to-then )
27
28
* [ ` prefer-await-to-callbacks ` ] ( #prefer-await-to-callbacks )
@@ -72,6 +73,7 @@ Then configure the rules you want to use under the rules section.
72
73
"promise/no-promise-in-callback" : " warn" ,
73
74
"promise/no-callback-in-promise" : " warn" ,
74
75
"promise/avoid-new" : " warn" ,
76
+ "promise/no-new-statics" : " warn" ,
75
77
"promise/no-return-in-finally" : " warn"
76
78
}
77
79
}
@@ -98,6 +100,7 @@ or start with the recommended rule set
98
100
| :warning : | ` no-promise-in-callback ` | Avoid using promises inside of callbacks |
99
101
| :warning : | ` no-callback-in-promise ` | Avoid calling ` cb() ` inside of a ` then() ` (use [ nodeify] [ ] instead) |
100
102
| :warning : | ` avoid-new ` | Avoid creating ` new ` promises outside of utility libs (use [ pify] [ ] instead) |
103
+ | :warning : | ` no-new-statics ` | Avoid calling ` new ` on a Promise static method (e.g. ` new Promise.resolve() ` ) |
101
104
| :warning : | ` no-return-in-finally ` | Disallow return statements in ` finally() ` |
102
105
| :seven : | ` prefer-await-to-then ` | Prefer ` await ` to ` then() ` for reading Promise values |
103
106
| :seven : | ` prefer-await-to-callbacks ` | Prefer async/await to the callback pattern |
@@ -304,6 +307,10 @@ Avoid calling `cb()` inside of a `then()` (use [nodeify][] instead)
304
307
305
308
Avoid creating ` new ` promises outside of utility libs (use [ pify] [ ] instead)
306
309
310
+ ### ` no-new-statics `
311
+
312
+ Avoid calling ` new ` on a Promise static method (e.g. ` new Promise.resolve() ` )
313
+
307
314
### ` no-return-in-finally `
308
315
309
316
Disallow return statements inside a callback passed to ` finally() ` , since
0 commit comments