# newline-after-var

Rule `eslint/newline-after-var`. Require or disallow an empty line after variable declarations

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Deprecated: yes
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1866 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `newline-after-var` | no | safe | package `eslint` | [docs](https://eslint.org/docs/latest/rules/newline-after-var) |

## Code examples

### Incorrect: the rule reports this

```js
var greet = "hello,",
    name = "world";
console.log(greet, name);

let hello = "hello,",
    world = "world";
console.log(hello, world);

var greet = "hello,";
const NAME = "world";
console.log(greet, NAME);

var greet = "hello,";
var name = "world";
// var name = require("world");
console.log(greet, name);
```

```js
var greet = "hello,",
    name = "world";

console.log(greet, name);

let hello = "hello,",
    world = "world";

console.log(hello, world);

var greet = "hello,";
const NAME = "world";

console.log(greet, NAME);

var greet = "hello,";
var name = "world";
// var name = require("world");

console.log(greet, name);
```

### Correct: the rule accepts this

```js
var greet = "hello,",
    name = "world";

console.log(greet, name);

let hello = "hello,",
    world = "world";

console.log(hello, world);

var greet = "hello,";
const NAME = "world";

console.log(greet, NAME);

var greet = "hello,";
var name = "world";
// var name = require("world");

console.log(greet, name);
```

```js
var greet = "hello,",
    name = "world";
console.log(greet, name);

let hello = "hello,",
    world = "world";
console.log(hello, world);

var greet = "hello,";
const NAME = "world";
console.log(greet, NAME);

var greet = "hello,";
var name = "world";
// var name = require("world");
console.log(greet, name);
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "newline-after-var": "error",
    },
  },
];
```

## Related rules

- [eslint/sort-keys](https://lintradar.dev/rules/eslint/sort-keys.md): Require object keys to be sorted
- [eslint/sort-imports](https://lintradar.dev/rules/eslint/sort-imports.md): Enforce sorted `import` declarations within modules
- [eslint/no-undefined](https://lintradar.dev/rules/eslint/no-undefined.md): Disallow the use of `undefined` as an identifier
- [eslint/id-length](https://lintradar.dev/rules/eslint/id-length.md): Enforce minimum and maximum identifier lengths
- [eslint/no-ternary](https://lintradar.dev/rules/eslint/no-ternary.md): Disallow ternary operators
- [eslint/no-magic-numbers](https://lintradar.dev/rules/eslint/no-magic-numbers.md): Disallow magic numbers

---

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