diff --git a/docs/rules/no-then.md b/docs/rules/no-then.md index f234a28..955fa19 100644 --- a/docs/rules/no-then.md +++ b/docs/rules/no-then.md @@ -1,3 +1,27 @@ # No then with promise (`jlc/no-then`) + +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() +} +```