---
url: https://scruple.dev/rules/async/require-abort-listener-cleanup.md
description: Require cleanup of abort listeners.
---

# async/require-abort-listener-cleanup

Require cleanup of abort listeners.

## What it checks

Abort listeners should be one-shot or visibly removed or disposed so they do not outlive the operation they monitor.

## Rule metadata

* Package: `@scruple/async`
* Category: Cancellation
* Tags: abort-signal, listeners, cleanup
* Default threshold: `plugin default`
* Minimum confidence: `plugin default`

## Examples

### Reported

```ts
signal.addEventListener("abort", cancel);
```

### Accepted

```ts
signal.addEventListener("abort", cancel, { once: true });
```
