> 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.

# no-floating-promises

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

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


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

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

## Rule Details

Requires Promise-like statements to be handled appropriately. A "floating" promise is one that is created without any code to handle potential errors. Floating promises can cause unexpected behavior because errors in them will be silently ignored. This rule reports on promises in expression statements that are not awaited, not chained with `.catch()` or `.then()` with a rejection handler, and not explicitly ignored with the `void` operator.

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

```typescript
async function fetchData() {
  fetch('https://example.com');
}

const promise = new Promise(resolve => resolve('value'));
promise;

async function run() {
  doAsyncWork();
}
```

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

```typescript
async function fetchData() {
  await fetch('https://example.com');
}

const promise = new Promise(resolve => resolve('value'));
await promise;

promise.catch(handleError);

void promise;
```

## Original Documentation

- [typescript-eslint: no-floating-promises](https://typescript-eslint.io/rules/no-floating-promises)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-floating-promises.ts)
