# array-bracket-newline

Rule `eslint/array-bracket-newline`. Enforce linebreaks after opening and before closing array brackets

- 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: #1857 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
const a = [];
const b = [1];
const c = [1, 2];
const d = [1,
    2];
const e = [function foo() {
    dosomething();
}];
```

```js
const a = [
];
const b = [
    1
];
const c = [
    1, 2
];
const d = [
    1,
    2
];
const e = [
    function foo() {
        dosomething();
    }
];
```

```js
const a = [1
];
const b = [
    1];
const c = [function foo() {
    dosomething();
}
]
const d = [
    function foo() {
        dosomething();
    }]
```

### Correct: the rule accepts this

```js
const a = [
];
const b = [
    1
];
const c = [
    1, 2
];
const d = [
    1,
    2
];
const e = [
    function foo() {
        dosomething();
    }
];
```

```js
const a = [];
const b = [1];
const c = [1, 2];
const d = [1,
    2];
const e = [function foo() {
    dosomething();
}];
```

```js
const a = [];
const b = [
];
const c = [1];
const d = [
    1
];
const e = [function foo() {
    dosomething();
}];
const f = [
    function foo() {
        dosomething();
    }
];
```

Examples from the ESLint documentation.

## Enable it

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

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

## Related rules

- [vue/array-bracket-newline](https://lintradar.dev/rules/vue/array-bracket-newline.md): Enforce linebreaks after opening and before closing array brackets in `<template>`
- [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

---

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