# no-dead-store

Rule `sonarjs/no-dead-store`. Unused assignments should be removed

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

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
i = a + b; // Noncompliant; calculation result not used before value is overwritten
i = compute();
```

### Correct: the rule accepts this

```js
i = a + b;
i += compute();
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/no-dead-store": "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-control-regex](https://lintradar.dev/rules/sonarjs/no-control-regex.md): Regular expressions should not contain control characters
- [sonarjs/no-debounce-throttle-in-render](https://lintradar.dev/rules/sonarjs/no-debounce-throttle-in-render.md): Lodash and Underscore.js debounced or throttled functions should not be recreated on every React render
- [sonarjs/no-collection-size-mischeck](https://lintradar.dev/rules/sonarjs/no-collection-size-mischeck.md): Collection size and array length comparisons should make sense
- [sonarjs/no-debug-commands-in-ui-tests](https://lintradar.dev/rules/sonarjs/no-debug-commands-in-ui-tests.md): UI test debug commands should not be committed to version control
- [sonarjs/no-code-after-done](https://lintradar.dev/rules/sonarjs/no-code-after-done.md): Tests should not execute any code after "done()" is called
- [sonarjs/no-default-utility-imports](https://lintradar.dev/rules/sonarjs/no-default-utility-imports.md): Default imports from modular utility libraries should not be used

---

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