Promise
Promise correctness and style rules from eslint-plugin-promise. Checks the chain shape of Promise-using code: every chain ends with catch, no callback inside a then, no nested .then().then(), and so on. AST-local only, type-aware Promise checks belong with typescript/* checker rules.
Source: eslint-plugin-promise (ISC).
promise/always-return: Require everythen()callback to eitherreturna value orthrow.promise/avoid-new: Reject everynew Promise(...)construction.promise/catch-or-return: Require unreturned promise chains to terminate withcatch()so unhandled rejections cannot escape.promise/no-callback-in-promise: Reject direct invocation of an error-first callback inside athen()orcatch()handler.promise/no-multiple-resolved: Detect Promise executor bodies with more than one resolve/reject call.promise/no-native: Require every file that usesPromiseto import or require the implementation explicitly, instead of reaching the native global.promise/no-nesting: Reject nestedthen()/catch()calls inside the body of a Promise callback.promise/no-new-statics: Rejectnewapplied to Promise statics such asnew Promise.resolve(x),new Promise.all([...]), ornew Promise.race([...]).promise/no-promise-in-callback: Reject building a promise chain inside the body of an error-first callback.promise/no-return-in-finally: Rejectreturnfrom inside afinally()callback.promise/no-return-wrap: Rejectreturn Promise.resolve(x)andreturn Promise.reject(x)inside promise callbacks; return the bare value orthrowinstead.promise/param-names: Enforce canonical parameter names (resolve,reject) on Promise executor functions.promise/prefer-await-to-callbacks: Flag continuation-passing callback shapes (last parameter is a function and an error-first invocation pattern is detected), suggesting anasync/awaitrewrite.promise/prefer-await-to-then: Preferawaitover explicit.then()/.catch()/.finally()chains insideasyncfunctions.promise/prefer-catch: Prefer.catch(handler)over the two-argument form.then(onFulfilled, onRejected).promise/spec-only: Reject non-standardPromisestatics such asPromise.done,Promise.spread, or library-specific extensions shimmed onto the global.promise/valid-params: Enforce the argument counts the Promise spec defines for each method,Promise.all/Promise.racetake exactly one argument,Promise.resolve/Promise.rejecttake zero or one,.thentakes one or two,.catch/.finallytake exactly one.
Last updated on