Socket
Book a DemoInstallSign in
Socket

prettier-plugin-brace-style

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-brace-style

A Prettier plugin that can apply ESLint's brace-style rules.

0.8.1
latest
Source
npmnpm
Version published
Weekly downloads
11K
-4.97%
Maintainers
1
Weekly downloads
 
Created
Source

prettier-plugin-brace-style

A Prettier plugin that can apply ESLint's brace-style rules.

A use case for this plugin.

Installation1

npm install -D prettier prettier-plugin-brace-style

Configuration

JSON example:

{
  "plugins": ["prettier-plugin-brace-style"]
}

JS example (CommonJS module):

module.exports = {
  plugins: ['prettier-plugin-brace-style'],
  braceStyle: 'stroustrup',
};

JS example (ES module):

export default {
  plugins: ['prettier-plugin-brace-style'],
  braceStyle: 'allman',
};

Options

Brace Style

Enforces consistent brace style for blocks. Same as ESLint, you can select one of 1tbs (default), stroustrup, allman.

  • 1tbs example:

    if (condition) {
      statement1;
    } else {
      statement2;
    }
    
  • stroustrup example:

    if (condition) {
      statement1;
    }
    else {
      statement2;
    }
    
  • allman example:

    if (condition)
    {
      statement1;
    }
    else
    {
      statement2;
    }
    
DefaultCLI OverrideAPI Override
"1tbs"--brace-style <1tbs|stroustrup|allman>braceStyle: "<1tbs|stroustrup|allman>"

Version correlation with sibling plugins

Starting with 0.6.0, when there is a minor release on one side, I plan to reflect that change on the other side as well if possible.

Version correlation.

Compatibility with other Prettier plugins

If more than one Prettier plugin can handle the text you want to format, Prettier will only use the last of those plugins.

In this case, you can configure it as follows by adding prettier-plugin-merge to apply those plugins sequentially.

JSON example:

{
  "plugins": [
    "@trivago/prettier-plugin-sort-imports",
    "prettier-plugin-brace-style",
    "prettier-plugin-merge"
  ],
  "braceStyle": "stroustrup"
}

Footnotes

  • If your version of prettier-plugin-brace-style is less than 0.5.0, you will also need to install @prettier/sync.

Keywords

prettier

FAQs

Package last updated on 27 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.