# no-late-event-control

Rule `unicorn/no-late-event-control`. Disallow event-control method calls after the synchronous event dispatch has finished.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 40.5M weekly downloads of presets that enable it
- Trend: +81.2% last quarter
- Rank: #449 by reach, #441 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-late-event-control` | no | no | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-late-event-control.md) |
| Biome | `nursery/noLateEventControl` | yes | no | group nursery, since 2.6.5 | [docs](https://biomejs.dev/linter/rules/no-late-event-control/) |

## Code examples

### Incorrect: the rule reports this

```js
element.addEventListener('click', async event => {
  await save();
  event.preventDefault();
});
```

```js
element.addEventListener('click', event => {
  setTimeout(() => {
    event.stopPropagation();
  });
});
```

### Correct: the rule accepts this

```js
element.addEventListener('click', async event => {
  event.preventDefault();
  await save();
});
```

```js
element.addEventListener('click', event => {
  event.stopPropagation();
  setTimeout(() => {
    update();
  });
});
```

```js
function prevent(event) {
  event.preventDefault();
}

element.addEventListener('click', event => {
  setTimeout(prevent, 1, event);
});
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-late-event-control": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noLateEventControl": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-late-current-target-access](https://lintradar.dev/rules/unicorn/no-late-current-target-access.md): Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.
- [unicorn/no-return-array-push](https://lintradar.dev/rules/unicorn/no-return-array-push.md): Disallow using the return value of `Array#push()` and `Array#unshift()`.
- [unicorn/no-duplicate-loops](https://lintradar.dev/rules/unicorn/no-duplicate-loops.md): Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.
- [unicorn/no-unnecessary-splice](https://lintradar.dev/rules/unicorn/no-unnecessary-splice.md): Disallow `Array#splice()` when simpler alternatives exist.
- [unicorn/no-confusing-array-splice](https://lintradar.dev/rules/unicorn/no-confusing-array-splice.md): Disallow confusing uses of `Array#{splice,toSpliced}()`.
- [unicorn/prefer-while-loop-condition](https://lintradar.dev/rules/unicorn/prefer-while-loop-condition.md): Prefer putting the condition in the while statement.

---

Web page: https://lintradar.dev/rules/unicorn/no-late-event-control. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
