Registry / testing / prettier-plugin-curly

prettier-plugin-curly

JSON →
library0.4.1jsnpmunverified

Prettier plugin to enforce consistent brace style for all control statements (for, if, while, etc.), adding curly braces around bodies. Current stable version is 0.4.1, released November 2025. It works alongside Prettier to enforce the equivalent of ESLint's curly 'all' rule, filling a gap where Prettier intentionally avoids modifying code structure. Requires Node >=18 and Prettier ^3. Version 0.4.0 introduced a complete rewrite using wrapped printers.estree. The plugin is actively maintained by JoshuaKGoldberg and the community.

npm install prettier-plugin-curly
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-CU
P
prettier-plugin-curly
testingjavascriptv0.4.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import prettierPluginCurly from 'prettier-plugin-curly'
const prettierPluginCurly = require('prettier-plugin-curly')
ESM-only since v0.4.0; CommonJS require() will fail
default
module.exports = { plugins: ['prettier-plugin-curly'] }
module.exports = { plugins: ['./node_modules/prettier-plugin-curly'] }
String name is preferred; path-based referencing may break with module resolution
prettierPluginCurly
import prettierPluginCurly from 'prettier-plugin-curly'
const { default: prettierPluginCurly } = require('prettier-plugin-curly')
Named export 'default' is not used; default import is correct

Configures Prettier to use prettier-plugin-curly; shows transformation of single-line if to curly brace style.

// .prettierrc { "plugins": ["prettier-plugin-curly"] } // Before: if (x) doSomething(); // After prettier formatting: // if (x) { // doSomething(); // }
Debug
Known issues
breakingDropped support for Prettier 2 in v0.4.1
fix
Upgrade to Prettier 3 and use prettier-plugin-curly ^0.4.1
affects: <0.4.1
breakingComplete rewrite in v0.4.0: plugin now exports a wrapped printers.estree instead of printers.ast
fix
Ensure no custom printer overrides conflict with new internal architecture
affects: >=0.4.0 <0.4.1
deprecatedCommonJS require() no longer works in v0.4.0+
fix
Use ESM imports or upgrade to v0.4.1 which may have limited CJS support (check release notes)
affects: >=0.4.0
gotchaPlugin modifies Prettier output for all control statements unconditionally; cannot be configured to skip certain statements
fix
If selective behavior is needed, consider ESLint's curly rule instead
affects: all
gotchaPlugin may conflict with other Prettier plugins that modify control statement printing
fix
Ensure plugin order in 'plugins' array places prettier-plugin-curly before any conflicting plugins
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-curly'
Package not installed or Node.js cannot resolve it
fix
Run `npm install prettier-plugin-curly --save-dev`
Error: The module 'prettier-plugin-curly' is not a Prettier plugin
Using incorrect import or path configuration
fix
In .prettierrc, use "plugins": ["prettier-plugin-curly"] (string name) not a path
Error [ERR_REQUIRE_ESM]: require() of ES Module
Trying to use require() with ESM-only package (v0.4.0+)
fix
Use import syntax or downgrade to v0.3.x (but note Prettier 3 support may be limited)
TypeError: prettierPluginCurly is not a function
Incorrectly destructuring default export
fix
Use `import prettierPluginCurly from 'prettier-plugin-curly'` (default import) not `{ prettierPluginCurly }`
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
prettierrequiredpeer dependency required to use the plugin
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-curly — npm install prettier-plugin-curly · libregistry