---
url: /docs/guide/usage/linter/rules/eslint/one-var.md
---

### What it does

Enforces variables to be declared either together or separately.

### Why is this bad?

Consistent declaration grouping makes variable lifetimes and initialization patterns easier
to scan. This rule can require one declaration per scope, one declarator per statement, or
grouping only consecutive declarations.

### Examples

Examples of **incorrect** code for this rule:

```js
var foo = 1;
var bar = 2;
```

Examples of **correct** code for this rule:

```js
var foo = 1,
  bar = 2;
```

## Configuration

Enforces consistent grouping of variable declarations.

type: `object`

## How to use

## Version

This rule was added in v1.78.0.

## References
