merge-prettier-plugins

raw JSON →
1.0.3 verified Sat Apr 25 auth: no javascript deprecated

Temporary package to merge multiple Prettier plugin configurations, working around Prettier issue #12807 where using multiple plugins via plugins array causes conflicts. Current stable version is 1.0.3. The package is a short-term patch with no active development; users are advised to migrate to Prettier's built-in merge functionality once the issue is resolved. Key differentiator: simple merge of plugin exports without complex configuration.

error TypeError: mergePluginConfigs is not a function
cause Using named import instead of default import.
fix
Use import mergePluginConfigs from 'merge-prettier-plugins' (no braces) or const mergePluginConfigs = require('merge-prettier-plugins')
error Cannot find module 'merge-prettier-plugins'
cause Package not installed or missing from dependencies.
fix
Run npm install merge-prettier-plugins or yarn add merge-prettier-plugins
deprecated Package is a temporary patch and may be abandoned once Prettier fixes issue #12807.
fix Monitor Prettier releases and remove this dependency when native multi-plugin support is available.
gotcha Function expects Prettier plugin objects (with printers and parsers), not plugin names or paths.
fix Require the plugin modules directly and pass their exports.
gotcha No error handling for non-object or conflicting plugins; may produce unexpected merged config.
fix Ensure plugins are compatible and have no overlapping printer/parser names.
npm install merge-prettier-plugins
yarn add merge-prettier-plugins
pnpm add merge-prettier-plugins

Shows how to import and use mergePluginConfigs to combine multiple Prettier plugin objects.

import mergePluginConfigs from 'merge-prettier-plugins';
import * as prettierPluginBabel from 'prettier/plugins/babel';
import * as prettierPluginEstree from 'prettier/plugins/estree';

const mergedConfig = mergePluginConfigs(prettierPluginBabel, prettierPluginEstree);

// Use mergedConfig with prettier.format or prettier.check
console.log(mergedConfig);