# prettier-plugin-merge

> A Prettier plugin that sequentially merges the formatting results of other Prettier plugins.

Latest version **0.10.1** (published 2026-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install prettier-plugin-merge
pnpm add prettier-plugin-merge
yarn add prettier-plugin-merge
bun add prettier-plugin-merge
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.10.1 |
| Published | 2026-03-26 |
| First published | 2023-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 66 |
| Author | Hyeonjong |
| Maintainers | ony3000 |
| Keywords | prettier, plugin, merge, sequential, formatting, multiple |

## Links

- npm: https://www.npmjs.com/package/prettier-plugin-merge
- Repository: https://github.com/ony3000/prettier-plugin-merge
- Homepage: https://github.com/ony3000/prettier-plugin-merge#readme
- Issues: https://github.com/ony3000/prettier-plugin-merge/issues
- npm.io page: https://npm.io/package/prettier-plugin-merge

## Dependencies (1)

- [diff](https://npm.io/package/diff.md) 5.2.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.10.1 (latest) — 2026-03-26
- 0.10.0 — 2026-03-02
- 0.9.1 — 2026-02-14
- 0.9.0 — 2026-01-18
- 0.8.0 — 2025-06-27
- 0.7.4 — 2025-05-18
- 0.7.3 — 2025-03-23
- 0.7.2 — 2024-12-10
- 0.7.1 — 2024-08-17
- 0.7.0 — 2024-06-08
- 0.6.0 — 2024-02-04
- 0.5.1 — 2024-01-13
- 0.4.0 — 2023-12-08
- 0.3.1 — 2023-10-19
- 0.3.0 — 2023-10-10
- … 6 more at https://npm.io/package/prettier-plugin-merge/versions

## README

# prettier-plugin-merge

A Prettier plugin that sequentially merges the formatting results of other Prettier plugins.

![Schematic diagram of how formats are merged.](.github/banner.png)

## Why prettier-plugin-merge?

Prettier has its limitations. If two or more plugins are configured to format a particular language, Prettier will only use the last of those plugins.

So, for example, if you configure it like this for JavaScript formatting, only `prettier-plugin-classnames` will be used.

<!-- prettier-ignore -->
```jsonc
{
  "plugins": [
    "prettier-plugin-tailwindcss",
    "prettier-plugin-classnames" // Prettier only uses this
  ]
}
```

However, you can overcome this limitation by adding `prettier-plugin-merge` as the last plugin.

```diff
 {
   "plugins": [
     "prettier-plugin-tailwindcss",
-    "prettier-plugin-classnames"
+    "prettier-plugin-classnames",
+    "prettier-plugin-merge"
   ]
 }
```

As mentioned above, Prettier uses the last of the plugins that can format a particular language (in this case JavaScript), so `prettier-plugin-merge` is used in the changed configuration.

<!-- prettier-ignore -->
```jsonc
{
  "plugins": [
    "prettier-plugin-tailwindcss",
    "prettier-plugin-classnames",
    "prettier-plugin-merge" // Prettier only uses this
  ]
}
```

`prettier-plugin-merge` uses plugins written before this one in order, merging as much as possible the differences in formatting results depending on the presence of the plugin.

So you can combine as many plugins as you want.

## Installation

```sh
npm install -D prettier prettier-plugin-merge
```

## Configuration

**Note**: This plugin MUST come last. Other plugins usually have no order constraints. However, if there are multiple plugins formatting the same area, the output may vary depending on the order of those plugins.

JSON example:

<!-- prettier-ignore -->
```json
{
  "plugins": [
    "prettier-plugin-tailwindcss",
    "prettier-plugin-classnames",
    "prettier-plugin-merge"
  ]
}
```

JS example (CommonJS module):

```javascript
module.exports = {
  plugins: [
    '@trivago/prettier-plugin-sort-imports',
    'prettier-plugin-brace-style',
    'prettier-plugin-merge',
  ],
  braceStyle: 'stroustrup',
};
```

JS example (ES module):

```javascript
export default {
  plugins: [
    'prettier-plugin-brace-style',
    '@trivago/prettier-plugin-sort-imports',
    'prettier-plugin-merge',
  ],
  importOrder: ['<THIRD_PARTY_MODULES>', '^@[^/]+/(.*)$', '^@/(.*)$', '^[./]'],
  importOrderSeparation: true,
};
```

### Markdown/MDX Override

This plugin does not support Markdown and MDX, but if this plugin supports a language inside code blocks (e.g. Vue), unintended formatting may occur inside the code blocks.

To prevent unintended formatting, you can use configuration overrides for Markdown and MDX.

JSON example:

```json
{
  "plugins": [
    "prettier-plugin-brace-style",
    "@trivago/prettier-plugin-sort-imports",
    "prettier-plugin-merge"
  ],
  "braceStyle": "stroustrup",
  "importOrder": ["<THIRD_PARTY_MODULES>", "^@[^/]+/(.*)$", "^@/(.*)$", "^[./]"],
  "importOrderSeparation": true,
  "overrides": [
    {
      "files": ["*.md", "*.mdx"],
      "options": {
        "plugins": []
      }
    }
  ]
}
```

## Version correlation with sibling plugins

Starting with `0.6.0`, when there is a minor release on one side, I plan to reflect that change on the other side as well if possible.

![Version correlation.](.github/correlation.png)

## Compatibility with other Prettier plugins

All other plugins used with this plugin must be compatible with your version of Prettier.

## Stargazers over time

[![Stargazers over time](https://starchart.cc/ony3000/prettier-plugin-merge.svg?variant=adaptive)](https://starchart.cc/ony3000/prettier-plugin-merge)

---
_Source: https://npm.io/package/prettier-plugin-merge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
