Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 567 Bytes

no-nesting.md

File metadata and controls

24 lines (15 loc) · 567 Bytes

Disallow nested then() or catch() statements (promise/no-nesting)

⚠️ This rule warns in the following configs: ✅ flat/recommended, ✅ recommended.

Valid

myPromise.then(doSomething).then(doSomethingElse).catch(errors)

Invalid

myPromise.then((val) => doSomething(val).then(doSomethingElse))

myPromise.then((val) => doSomething(val).catch(errors))

myPromise.catch((err) => doSomething(err).then(doSomethingElse))

myPromise.catch((err) => doSomething(err).catch(errors))