Skip to content

Commit

Permalink
docs: add no-nesting examples (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianMurphy authored and macklinu committed Apr 19, 2018
1 parent 5956eca commit 0b231da
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/rules/no-nesting.md
@@ -1 +1,30 @@
# Avoid nested `then()` or `catch()` statements (no-nesting)

#### Valid

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

#### Invalid

```js
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)
})
```

0 comments on commit 0b231da

Please sign in to comment.