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