Skip to main content

brace-style

Brace style determines where opening and closing braces are placed relative to control statements and code blocks.
Rule Type: Layout
Fixable: Yes (automatically fixable)
Deprecated: Consider using Prettier

Rule Details

This rule enforces consistent brace style for blocks.

Brace Styles

One True Brace Style (1tbs)

Opening brace on same line as statement:

Stroustrup

else, catch, finally on own line:

Allman

All braces on their own lines:

Options

"1tbs" (default)

Enforce one true brace style. Incorrect:
Correct:

"stroustrup"

Incorrect:
Correct:

"allman"

Incorrect:
Correct:

allowSingleLine

Allow opening and closing braces on same line.

Configuration Examples

When Not to Use It

Most modern projects use Prettier for formatting. If you use Prettier, disable this rule.
Disable if:
  • You use Prettier or another formatter
  • Your team hasn’t agreed on a brace style
  • You don’t want to enforce consistency

Further Reading