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
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:
"stroustrup"
Incorrect:
"allman"
Incorrect:
allowSingleLine
Allow opening and closing braces on same line.
Configuration Examples
When Not to Use It
Disable if:- You use Prettier or another formatter
- Your team hasn’t agreed on a brace style
- You don’t want to enforce consistency