array-bracket-newline
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"array-bracket-newline": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
Enforce linebreaks after opening and before closing array brackets
const a = [];
const b = [1];
const c = [1, 2];
const d = [1,
2];
const e = [function foo() {
dosomething();
}];const a = [
];
const b = [
1
];
const c = [
1, 2
];
const d = [
1,
2
];
const e = [
function foo() {
dosomething();
}
];const a = [1
];
const b = [
1];
const c = [function foo() {
dosomething();
}
]
const d = [
function foo() {
dosomething();
}]const a = [
];
const b = [
1
];
const c = [
1, 2
];
const d = [
1,
2
];
const e = [
function foo() {
dosomething();
}
];const a = [];
const b = [1];
const c = [1, 2];
const d = [1,
2];
const e = [function foo() {
dosomething();
}];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.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
array-bracket-newline
eslint
export default [
{
rules: {
"array-bracket-newline": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce linebreaks after opening and before closing array brackets in <template>