A Prettier plugin that applies ESLint's brace-style rules (1tbs, stroustrup, allman) to code formatting. Current stable version is 0.10.1, released on 2025-04-02. It supports JavaScript, TypeScript, JSX, TSX, Flow, CSS, SCSS, Less, Vue, Svelte, Angular, and HTML via Prettier's parsers. It requires Prettier >=3 and Node >=18. Key differentiators: directly enforces brace style as a Prettier plugin, works across multiple languages, and can be combined with other plugins using prettier-plugin-merge. It uses @prettier/plugin-oxc for oxc parser support, and optionally integrates with prettier-plugin-astro and prettier-plugin-svelte for those frameworks.
npm install prettier-plugin-brace-styleVerified import paths — ran on the pinned version, not inferred.
Demonstrates installation, configuration with braceStyle option, and formatting a JavaScript file. Shows how the plugin transforms code to the 'stroustrup' style.
Upgrade to Prettier >=3.0.0 and Node >=18. For legacy projects, stay on v0.7.x (which supports Prettier v2).
If using v0.4.x or earlier, remove @prettier/sync and upgrade the plugin. Or better, upgrade to the latest version.
Add 'prettier-plugin-merge' as the last plugin in the list to apply plugins sequentially. See the README for an example.
Use Prettier overrides to disable the plugin for Markdown and MDX files, as shown in the README.
Install @prettier/plugin-oxc to ensure optimal performance and consistency: npm install -D @prettier/plugin-oxc
If using enum declarations, ensure Prettier is updated to v3.6 or later.
Run: npm install -D prettier-plugin-brace-style (or yarn add --dev prettier-plugin-brace-style)
Add 'prettier-plugin-brace-style' to the plugins array in your Prettier config: { plugins: ['prettier-plugin-brace-style'] }Ensure Prettier >=3 is installed. If the issue persists, check that the plugin is listed after other conflicting plugins in the plugins array.
Check supported parsers: babel, typescript, flow, espree, meriyah, css (including SCSS/Less), vue, svelte, angular, html, or use overrides to exclude unsupported files.