# no-ignored-return

Rule `sonarjs/no-ignored-return`. Return values from functions without side effects should not be ignored

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: yes
- Autofix: no
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1284 by reach, #585 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/no-ignored-return` | yes | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-2201/) |

## Code examples

### Incorrect: the rule reports this

```js
'hello'.lastIndexOf('e'); // Noncompliant
```

### Correct: the rule accepts this

```js
let char = 'hello'.lastIndexOf('e');
```

Examples from the ESLint documentation.

## Enable it

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/no-ignored-exceptions](https://lintradar.dev/rules/sonarjs/no-ignored-exceptions.md): Exceptions should not be ignored
- [sonarjs/no-implicit-global](https://lintradar.dev/rules/sonarjs/no-implicit-global.md): Variables should be declared explicitly
- [sonarjs/no-identical-functions](https://lintradar.dev/rules/sonarjs/no-identical-functions.md): Functions should not have identical implementations
- [sonarjs/no-in-misuse](https://lintradar.dev/rules/sonarjs/no-in-misuse.md): "in" should not be used on arrays
- [sonarjs/no-identical-expressions](https://lintradar.dev/rules/sonarjs/no-identical-expressions.md): Identical expressions should not be used on both sides of a binary operator
- [sonarjs/no-incompatible-assertion-types](https://lintradar.dev/rules/sonarjs/no-incompatible-assertion-types.md): Assertions comparing incompatible types should not be made

---

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