Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/promise-function-async/
Description
I am finding cases in my code where it accidentally is returning undefined or some other guard type (null, etc) from a function that we expected to be async, but the rule promise-function-async is not flagging those as I expected it to (allowing us to catch those mistakes).
Please add an option to promise-function-async that will allow it to flag any function that returns promises at all, either as the main return type, or as a union containing promises.
Fail
function getSomething(id?: string) {
if (!id) {
return undefined
}
return db.getByID(id)
}
Pass
async function getSomething(id?: string) {
if (!id) {
return undefined
}
return db.getByID(id)
}
Additional Info
There is an issue for the opposite of my request, #1005. I’d like that feature back (probably behind an option, seeing as it was designated as a bug before).
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/promise-function-async/
Description
I am finding cases in my code where it accidentally is returning undefined or some other guard type (null, etc) from a function that we expected to be async, but the rule promise-function-async is not flagging those as I expected it to (allowing us to catch those mistakes).
Please add an option to
promise-function-asyncthat will allow it to flag any function that returns promises at all, either as the main return type, or as a union containing promises.Fail
Pass
Additional Info
There is an issue for the opposite of my request, #1005. I’d like that feature back (probably behind an option, seeing as it was designated as a bug before).