> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# promise-function-async

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/promise-function-async': 'error',
    },
  },
]);
```

## Rule Details

Require any function or method that returns a Promise to be marked async. Ensures that each function is only capable of either returning a rejected promise or throwing an `Error` object. In contrast, non-async Promise-returning functions are technically capable of either. Code that handles both rejected promises and thrown errors simultaneously is often overly complex and hard to maintain.

Examples of **incorrect** code for this rule:

```typescript
function foo(): Promise<string> {
  return Promise.resolve('value');
}
const bar = (): Promise<number> => Promise.resolve(42);
class Baz {
  method(): Promise<void> {
    return Promise.resolve();
  }
}
```

Examples of **correct** code for this rule:

```typescript
async function foo(): Promise<string> {
  return 'value';
}
const bar = async (): Promise<number> => 42;
class Baz {
  async method(): Promise<void> {}
}
```

## Original Documentation

- [typescript-eslint: promise-function-async](https://typescript-eslint.io/rules/promise-function-async)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.29.1/packages/eslint-plugin/src/rules/promise-function-async.ts)
