# require-proxy-trap-boolean-return

Rule `unicorn/require-proxy-trap-boolean-return`. Require boolean-returning Proxy traps to return booleans.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #1009 by reach, #1264 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/require-proxy-trap-boolean-return` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/require-proxy-trap-boolean-return.md) |

## Code examples

### Incorrect: the rule reports this

```js
new Proxy(target, {
  set(target, property, value) {
    target[property] = value;
  }
});
```

```js
new Proxy(target, {
  deleteProperty() {
    return 1;
  }
});
```

### Correct: the rule accepts this

```js
new Proxy(target, {
  set(target, property, value) {
    target[property] = value;
    return true;
  }
});
```

```js
new Proxy(target, {
  deleteProperty() {
    return true;
  }
});
```

```js
new Proxy(target, {
  set(target, property, value) {
    return Reflect.set(target, property, value);
  }
});
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/require-proxy-trap-boolean-return": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/require-passive-events](https://lintradar.dev/rules/unicorn/require-passive-events.md): Require passive event listeners for high-frequency events.
- [unicorn/require-text-decoder-streaming](https://lintradar.dev/rules/unicorn/require-text-decoder-streaming.md): Require streaming decoding of fetch-body chunks with `TextDecoder`.
- [unicorn/require-css-escape](https://lintradar.dev/rules/unicorn/require-css-escape.md): Require `CSS.escape()` for interpolated values in CSS selectors.
- [unicorn/explicit-length-check](https://lintradar.dev/rules/unicorn/explicit-length-check.md): Enforce explicitly comparing the `length` or `size` property of a value.
- [unicorn/prefer-url-search-parameters](https://lintradar.dev/rules/unicorn/prefer-url-search-parameters.md): Prefer `URLSearchParams` over manually splitting query strings.
- [unicorn/no-nested-ternary](https://lintradar.dev/rules/unicorn/no-nested-ternary.md): Disallow nested ternary expressions.

---

Web page: https://lintradar.dev/rules/unicorn/require-proxy-trap-boolean-return. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
