Skip to content

asyncFunctionAwaits

Reports async functions that do not use await.

✅ This rule is included in the ts logicalStrict presets.

Functions can be marked as async to allow await expressions used inside of them. The async keyword adds a small amount of conceptual and runtime overhead. An async function without await expressions may indicate incomplete implementation or leftover code after refactoring.

This rule reports on any function that is marked as async but neither includes an await nor returns a Promise.

async function processData() {
console.log("processing");
return 42;
}
const fetchUser = async () => {
return { name: "Alice" };
};
class DataService {
async getData() {
return this.cache.get("data");
}
}

This rule is not configurable.

If you intentionally use async functions without await to ensure thrown errors are wrapped in rejected Promises, you may want to disable this rule. This pattern can be useful when you want consistent error handling through Promise rejection rather than thrown exceptions. You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.

Some projects that manually manage their Promises prefer to write functions that return Promises regardless of whether they’re using await. Additionally, if you are writing prototype code where many functions intentionally can be missing their implementation, this rule may get in your way.

Made with ❤️‍🔥 around the world by the Flint team and contributors.