Name: Promise constructor allows for Promises that never resolve.
Consider the following code
;(new Promise(() => {})).then(() => console.log('a executed'))
;(Promise.resolve('x')).then(() => console.log('b executed'))
// outputs
// b executed
The first Promise (new Promise(() => {})
) will never resolve or reject.
It is possible to create a Promise using the Promise constructor which does not resolve or reject (by never calling resolve()
or reject()
)
- Provide a warning when neither
resolve
orreject
are referenced in the promise constructor. - Optionally provide a warning when a Promise remains alive for more than N seconds and was neither resolved nor rejected.