Skip to content

Prettier plugin to enforce consistent brace style for all control statements. πŸ₯Œ

License

Notifications You must be signed in to change notification settings

JoshuaKGoldberg/prettier-plugin-curly

Folders and files

NameName
Last commit message
Last commit date
Oct 11, 2024
Oct 10, 2024
Mar 16, 2024
Oct 11, 2024
Oct 11, 2024
Sep 5, 2023
Jun 11, 2023
Jun 11, 2023
Oct 11, 2024
Oct 2, 2023
Oct 2, 2023
Oct 2, 2023
Oct 11, 2024
Jun 11, 2023
Oct 11, 2024
Oct 10, 2024
Oct 10, 2024
Oct 10, 2024
Oct 19, 2024
Oct 22, 2024
Jun 11, 2023
Oct 2, 2023
Jul 17, 2024
Sep 5, 2023

Repository files navigation

prettier-plugin-curly

Prettier plugin to enforce consistent brace style for all control statements. πŸ₯Œ

All Contributors: 8 πŸ‘ͺ Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict npm package version Contributor Covenant

Usage

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;
+ }

But Why?

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.

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! πŸ’–

Contributors

Dan Vanderkam
Dan Vanderkam

πŸ›
Holger Jeromin
Holger Jeromin

πŸ›
Josh Goldberg
Josh Goldberg

πŸ”§ 🚧 πŸ’» πŸš‡ πŸ€” πŸ›
Navin Moorthy
Navin Moorthy

πŸ›
Robin Heidenis
Robin Heidenis

πŸ”§ πŸ’»
Stephen Zhou
Stephen Zhou

πŸ›
tawpie
tawpie

πŸ›
ʀᴀʏ
ʀᴀʏ

πŸ“– πŸ’» πŸ›

πŸ’™ This package is based on @JoshuaKGoldberg's create-typescript-app.