Skip to content

Commit

Permalink
Update no-then.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zengxiaoluan authored Aug 1, 2024
1 parent 9651e86 commit fed7f73
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/rules/no-then.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# No then with promise (`jlc/no-then`)

<!-- end auto-generated rule header -->

That is bad:

```js
let promise = new Promise(function(resolve, reject) {
setTimeout(() => resolve(1), 1000);
});

promise.then(function(result) {

});
```

That is good:

```js
let promise = new Promise(function(resolve, reject) {
setTimeout(() => resolve(1), 1000);
});

async function timeout(ms) {
await promise()
}
```

0 comments on commit fed7f73

Please sign in to comment.