Prettier plugin to enforce consistent brace style for all control statements. π₯
First install this package as a dev dependency in your package manager of choice:
npm i prettier-plugin-curly -D
You'll then be able to list it as a Prettier plugin in your Prettier config:
{
"plugins": ["prettier-plugin-curly"]
}
As a result, Prettier will add {}
curly brackets to control flow statements such as for
, if
, and while
:
- if (abc) def;
+ if (abc) {
+ def;
+ }
Prettier generally does not modify the structure of code: which includes not enforcing curly brackets to match ESLint's curly
rule.
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 at the Prettier level.
See The Blurry Line Between Formatting and Style for more details.
See .github/CONTRIBUTING.md
, then .github/DEVELOPMENT.md
.
Thanks! π
Dan Vanderkam π |
Holger Jeromin π |
Josh Goldberg π§ π§ π» π π€ π |
Navin Moorthy π |
Robin Heidenis π§ π» |
Stephen Zhou π |
tawpie π |
Κα΄Κ π π» π |
π This package is based on @JoshuaKGoldberg's create-typescript-app.