eslint-plugin-promise icon indicating copy to clipboard operation
eslint-plugin-promise copied to clipboard

no-callback-in-async-function rule?

Open xjamundx opened this issue 5 years ago • 2 comments

Putting callback code inside of async functions like this can lead to a lot of trouble:

async function bigProbs() {
    doSomething(function(err) {
        if (err) throw err; // won't be caught by the parent
        // ...
    })
}

xjamundx avatar Jan 16 '19 19:01 xjamundx

Would something like this address the issue:

async function bigProbs() {
	try
	{
		doSomething(function(err) {
			if (err) throw err; // won't be caught by the parent
			// ...
		})
	}
	catch(e)
	{
		throw(e);
	}
}

If so, can you not warn when the try catch is throwing to the parent?

Lonniebiz avatar Jul 25 '20 11:07 Lonniebiz