Prettier Plugin Curly and JSDoc
raw JSON → 3.4.0 verified Sat Apr 25 auth: no javascript
Prettier plugin that resolves incompatibilities between prettier-plugin-curly and prettier-plugin-jsdoc, allowing both to be used together without conflicts. Current stable version is 3.4.0. The package is a thin compatibility layer that re-exports and combines the two plugins. It is part of the codestyle-config monorepo and ships TypeScript definitions. Key differentiator: no configuration needed beyond adding it to your Prettier plugins list. Released as needed to keep up with upstream plugin changes.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/prettier-plugin-curly-and-jsdoc/dist/index.js from ... not supported. ↓
cause Using CommonJS require() for an ESM-only package (v3+).
fix
Change to dynamic import() or convert your project to ESM (e.g., use .mjs extension or type: module in package.json).
error Cannot find module 'prettier-plugin-curly-and-jsdoc' ↓
cause The package is not installed when using the string reference in Prettier config (e.g., ".prettierrc" with plugin name).
fix
Install the package: npm install --save-dev prettier-plugin-curly-and-jsdoc. And use the object reference as shown in quickstart.
error Error: Couldn't resolve plugin "prettier-plugin-curly-and-jsdoc" from your Prettier config. Did you mean to import it instead of using the string name? ↓
cause Prettier v3+ requires plugin objects, not strings, when using external ESM plugins.
fix
Change your Prettier config to export a config object that imports the plugin and passes the object in the plugins array.
Warnings
breaking In v3.0.0, the plugin became ESM-only. CommonJS require() will throw. ↓
fix Switch to ESM: use 'import' or ensure your project is ESM (type: module in package.json).
gotcha Do NOT add curly and jsdoc plugins individually in Prettier config if using this plugin; it includes them and adding duplicates may cause conflicts. ↓
fix Only include this plugin in the 'plugins' array; remove 'prettier-plugin-curly' and 'prettier-plugin-jsdoc' from config.
deprecated The package does not follow semantic versioning for the compatibility layer; minor bumps may break due to upstream changes in prettier-plugin-curly or prettier-plugin-jsdoc. ↓
fix Pin exact versions of all three plugins and test after updates.
Install
npm install prettier-plugin-curly-and-jsdoc yarn add prettier-plugin-curly-and-jsdoc pnpm add prettier-plugin-curly-and-jsdoc Imports
- default wrong
const prettierPluginCurlyAndJsdoc = require('prettier-plugin-curly-and-jsdoc')correctimport prettierPluginCurlyAndJsdoc from 'prettier-plugin-curly-and-jsdoc' - plugins wrong
// Adding the plugin name as a string in .prettierrc: {"plugins": ["prettier-plugin-curly-and-jsdoc"]}correct// In prettier.config.mjs: import prettierPluginCurlyAndJsdoc from 'prettier-plugin-curly-and-jsdoc'; export default { plugins: [prettierPluginCurlyAndJsdoc] }; - Plugin wrong
import { Plugin } from 'prettier-plugin-curly-and-jsdoc'correctimport type { Plugin } from 'prettier'; import plugin from 'prettier-plugin-curly-and-jsdoc'; // type is Plugin
Quickstart
// Install the plugin and its dependencies:
// npm install --save-dev prettier prettier-plugin-curly prettier-plugin-jsdoc prettier-plugin-curly-and-jsdoc
// prettier.config.mjs
import prettierPluginCurlyAndJsdoc from 'prettier-plugin-curly-and-jsdoc';
export default {
semi: true,
singleQuote: true,
plugins: [prettierPluginCurlyAndJsdoc],
// No need to add curly or jsdoc plugins separately; this plugin includes them.
};
// Then run: npx prettier --check .