brace-style
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"brace-style": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
function foo()
{
return true;
}
if (foo)
{
bar();
}
try
{
somethingRisky();
} catch(e)
{
handleError();
}
if (foo) {
bar();
}
else {
baz();
}
class C
{
static
{
foo();
}
}function foo()
{
return true;
}
if (foo)
{
bar();
}
try
{
somethingRisky();
} catch(e)
{
handleError();
}
class C
{
static
{
foo();
}
}
if (foo) {
bar();
} else {
baz();
}function foo() {
return true;
}
if (foo)
{
bar(); }
try
{
somethingRisky();
} catch(e)
{
handleError();
}
class C {
static {
foo();
}
}
if (foo) {
bar();
} else {
baz();
}function foo() {
return true;
}
if (foo) {
bar();
}
if (foo) {
bar();
} else {
baz();
}
try {
somethingRisky();
} catch(e) {
handleError();
}
class C {
static {
foo();
}
}
// when there are no braces, there are no problems
if (foo) bar();
else if (baz) boom();function foo() {
return true;
}
if (foo) {
bar();
}
if (foo) {
bar();
}
else {
baz();
}
try {
somethingRisky();
}
catch(e) {
handleError();
}
class C {
static {
foo();
}
}
// when there are no braces, there are no problems
if (foo) bar();
else if (baz) boom();function nop() { return; }
if (foo) { bar(); }
if (foo) { bar(); }
else { baz(); }
try { somethingRisky(); }
catch(e) { handleError(); }
class C {
static { foo(); }
}
class D { static { foo(); } }Examples from the ESLint documentation.
brace-style
eslint
export default [
{
rules: {
"brace-style": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce consistent brace style for blocks in <template>
Disallow the use of alert, confirm, and prompt
Disallow certain properties on certain objects