# no-setter-return

Rule `eslint/no-setter-return`. Disallow returning values from setters

- Source: eslint
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 270.1M weekly downloads of presets that enable it
- Trend: +46.6% last quarter
- Rank: #45 by reach, #872 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-setter-return` | yes | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-setter-return) |
| Oxlint | `no-setter-return` | yes | no | plugin `eslint`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-setter-return.html) |
| Biome | `correctness/noSetterReturn` | yes | no | group correctness, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-setter-return/) |

## Code examples

### Incorrect: the rule reports this

```js
const foo = {
    set a(value) {
        this.val = value;
        return value;
    }
};

class Foo {
    set a(value) {
        this.val = value * 2;
        return this.val;
    }
}

const Bar = class {
    static set a(value) {
        if (value < 0) {
            this.val = 0;
            return 0;
        }
        this.val = value;
    }
};

Object.defineProperty(foo, "bar", {
    set(value) {
        if (value < 0) {
            return false;
        }
        this.val = value;
    }
});
```

### Correct: the rule accepts this

```js
const foo = {
    set a(value) {
        this.val = value;
    }
};

class Foo {
    set a(value) {
        this.val = value * 2;
    }
}

const Bar = class {
    static set a(value) {
        if (value < 0) {
            this.val = 0;
            return;
        }
        this.val = value;
    }
};

Object.defineProperty(foo, "bar", {
    set(value) {
        if (value < 0) {
            throw new Error("Negative value.");
        }
        this.val = value;
    }
});
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "no-setter-return": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-setter-return": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "correctness": {
        "noSetterReturn": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [ESLint recommended](https://lintradar.dev/presets/eslint-recommended.md) | ESLint | `@eslint/js` | 64 | 178.8M | +25.9% |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/no-unsafe-optional-chaining](https://lintradar.dev/rules/eslint/no-unsafe-optional-chaining.md): Disallow use of optional chaining in contexts where the `undefined` value is not allowed
- [eslint/no-unused-private-class-members](https://lintradar.dev/rules/eslint/no-unused-private-class-members.md): Disallow unused private class members
- [eslint/no-nonoctal-decimal-escape](https://lintradar.dev/rules/eslint/no-nonoctal-decimal-escape.md): Disallow `\8` and `\9` escape sequences in string literals
- [eslint/no-dupe-else-if](https://lintradar.dev/rules/eslint/no-dupe-else-if.md): Disallow duplicate conditions in if-else-if chains
- [eslint/for-direction](https://lintradar.dev/rules/eslint/for-direction.md): Enforce `for` loop update clause moving the counter in the right direction
- [eslint/no-import-assign](https://lintradar.dev/rules/eslint/no-import-assign.md): Disallow assigning to imported bindings

---

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