Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 471 Bytes

no-then.md

File metadata and controls

29 lines (20 loc) · 471 Bytes

No then with promise (jlc/no-then)

💼 This rule is enabled in the ✅ recommended config.

That is bad:

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

promise.then(function(result) {

});

That is good:

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

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