1. prettier-plugin-curly
Prettier plugin to enforce consistent brace style for all control statements. 🥌
prettier-plugin-curly
Package: prettier-plugin-curly
Created by: JoshuaKGoldberg
Last modified: Sat, 16 Mar 2024 16:48:23 GMT
Version: 0.2.1
License: MIT
Downloads: 101,741
Repository: https://github.com/JoshuaKGoldberg/prettier-plugin-curly

Install

npm install prettier-plugin-curly
yarn add prettier-plugin-curly

prettier-plugin-curly

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

All Contributors: 5 👪 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

🐛
ʀᴀʏ
ʀᴀʏ

📖 💻 🐛

💙 This package is based on @JoshuaKGoldberg's create-typescript-app.

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code