Closed tjx666 closed 4 months ago
🌚 My config problem, just remove extra empty object in options array.
change from:
'return-await': convertRule((await import('./node_modules/@typescript-eslint/eslint-plugin/dist/rules/return-await.js')).default.default, [{}], 0),
to:
'return-await': convertRule((await import('./node_modules/@typescript-eslint/eslint-plugin/dist/rules/return-await.js')).default.default, [], 0),
I found that the following case did not report. Fixed by https://github.com/johnsoncodehk/tsslint/commit/8c74b397cb5f444ad88d8689c3ab4fad9fdf3a22.
// Prints 'starting async work', 'cleanup', 'async work done'.
async function invalidInTryCatch3() {
async function doAsyncWork(): Promise<void> {
console.log('starting async work');
await new Promise(resolve => setTimeout(resolve, 1000));
console.log('async work done');
}
try {
throw new Error('error');
} catch (e) {
// Missing await.
return doAsyncWork();
} finally {
console.log('cleanup');
}
}
I add some more test cases in my fork, most of them works fine except the rule @typescript-eslint/return-await.
eslint playground
test code: