I don't like the following style of code
const flag = Math.random() > 0.5;
if (flag) console.log('A');
else console.log('B');
for (let index = 0; index < 999; index++) console.log(index);
I hope to restrict their behavior through eslint, so that if statements and for statements must have parentheses and newlines
const flag = Math.random() > 0.5;
if (flag) {
console.log('A');
} else {
console.log('B');
}
for (let index = 0; index < 999; index++) {
console.log(index);
}
How should I configure my eslint?
The curly rule is what you are searching for: