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.
Examples
Section titled “Examples”async function processData() { console.log("processing"); return 42;}const fetchUser = async () => { return { name: "Alice" };};class DataService { async getData() { return this.cache.get("data"); }}async function fetchData() { const response = await fetch("/api/data"); return response.json();}async function processItems() { for await (const item of asyncIterable) { console.log(item); }}async function wrapInPromise(): Promise<number> { return Promise.resolve(42);}function regularFunction() { return 42;}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
useAwait - Deno:
require-await - ESLint:
require-await@typescript-eslint/require-await - Oxlint:
eslint/require-awaittypescript/require-await