# prettier-plugin-curly

> Prettier plugin to enforce consistent brace style for all control statements. 🥌

Latest version **0.4.1** (published 2025-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install prettier-plugin-curly
pnpm add prettier-plugin-curly
yarn add prettier-plugin-curly
bun add prettier-plugin-curly
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2025-11-26 |
| First published | 2023-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 25.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 72 |
| Author | JoshuaKGoldberg |
| Maintainers | joshuakgoldberg |

## Links

- npm: https://www.npmjs.com/package/prettier-plugin-curly
- Repository: https://github.com/JoshuaKGoldberg/prettier-plugin-curly
- Homepage: https://github.com/JoshuaKGoldberg/prettier-plugin-curly#readme
- Issues: https://github.com/JoshuaKGoldberg/prettier-plugin-curly/issues
- npm.io page: https://npm.io/package/prettier-plugin-curly

## Recent versions

- 0.4.1 (latest) — 2025-11-26
- 0.4.0 — 2025-10-22
- 0.3.2 — 2025-04-03
- 0.3.1 — 2024-10-11
- 0.3.0 — 2024-10-10
- 0.2.2 — 2024-07-17
- 0.2.1 — 2024-03-16
- 0.2.0 — 2024-03-16
- 0.1.4 — 2024-02-20
- 0.1.3 — 2023-09-05
- 0.1.2 — 2023-07-17
- 0.1.1 — 2023-06-13
- 0.0.3 — 2023-06-13
- 0.0.2 — 2023-06-11
- 0.0.1 — 2023-06-11

## README

<h1 align="center">prettier-plugin-curly</h1>

<p align="center">
	Prettier plugin to enforce consistent brace style for all control statements.
	🥌
</p>

<p align="center">
	<!-- prettier-ignore-start -->
	<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
	<a href="#contributors" target="_blank"><img alt="👪 All Contributors: 9" src="https://img.shields.io/badge/%F0%9F%91%AA_all_contributors-9-21bb42.svg" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
	<!-- prettier-ignore-end -->
	<a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a>
	<a href="https://codecov.io/gh/JoshuaKGoldberg/prettier-plugin-curly" target="_blank"><img alt="🧪 Coverage" src="https://img.shields.io/codecov/c/github/JoshuaKGoldberg/prettier-plugin-curly?label=%F0%9F%A7%AA%20coverage" /></a>
	<a href="https://github.com/JoshuaKGoldberg/prettier-plugin-curly/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a>
	<a href="http://npmjs.com/package/prettier-plugin-curly" target="_blank"><img alt="📦 npm version" src="https://img.shields.io/npm/v/prettier-plugin-curly?color=21bb42&label=%F0%9F%93%A6%20npm" /></a>
	<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>

## Usage

First install this package as a dev dependency in your package manager of choice:

```shell
npm i prettier-plugin-curly -D
```

You'll then be able to list it as a [Prettier plugin](https://prettier.io/docs/en/plugins.html) in your [Prettier config](https://prettier.io/docs/en/configuration.html):

```json
{
	"plugins": ["prettier-plugin-curly"]
}
```

As a result, Prettier will add `{}` curly brackets to control flow statements such as `for`, `if`, and `while`:

```diff
- if (abc) def;
+ if (abc) {
+   def;
+ }
```

### But Why?

Prettier generally does not modify the structure of code: which includes [not enforcing curly brackets](https://github.com/prettier/prettier/issues/7659) to match [ESLint's `curly` rule](https://eslint.org/docs/latest/rules/curly).
However, enforcing `curly` generally does not modify code runtime behavior, and is often desirable for code consistency and to avoid accidental bugs.
This plugin enforces the equivalent of [`curly`'s `all` option](https://eslint.org/docs/latest/rules/curly#all) at the Prettier level.

> See [The Blurry Line Between Formatting and Style](https://blog.joshuakgoldberg.com/the-blurry-line-between-formatting-and-style) for more details.

## Development

See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md).
Thanks! 🥌

---
_Source: https://npm.io/package/prettier-plugin-curly · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
