ony3000 / prettier-plugin-merge

A Prettier plugin that sequentially merges the formatting results of other Prettier plugins.
MIT License
23 stars 1 forks source link

Adds double newline when `endOfLine: crlf` is configured in prettier #31

Closed n2k3 closed 3 weeks ago

n2k3 commented 1 month ago

Dependency information

WebStorm (with "run prettier on save" enabled) on Windows

Steps to reproduce

I have this prettier config in package.json:

  "prettier": {
    "printWidth": 120,
    "endOfLine": "crlf",
    "plugins": ["prettier-plugin-merge"]
  }

Note: usually prettier-plugin-tailwindcss and prettier-plugin-classnames are in the included at the start of the array, but I omitted them as the issue is causes by the prettier-plugin-merge plugin.

The current behavior

image

The expected behavior

image

ony3000 commented 1 month ago

Hello! Thanks for reporting the issue!

Unfortunately, I've only used Webstorm a little bit, so it's difficult to reproduce this issue with Webstorm.

Can you confirm that this is reproduced in VSCode with the same Prettier settings and code? If setting up VSCode is difficult, can you provide me with the minimum repository to reproduce the issue?

osh6006 commented 1 month ago

I got the same bug. Below is my .pretierrc.json file.

{
  "endOfLine": "auto",
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "singleAttributePerLine": true,
  "bracketSpacing": true,
  "arrowParens": "always",
  "trailingComma": "es5",
  "plugins": [
    "prettier-plugin-tailwindcss",
    "prettier-plugin-classnames",
    "@trivago/prettier-plugin-sort-imports",
    "prettier-plugin-merge"
  ],
  "importOrder": [
    "^react",
    "^next",
    "^lucide-react",
    "<THIRD_PARTY_MODULES>",

    "^~/service/(.*)$",
    "^~/hooks/(.*)$",
    "^~/provider/(.*)$",
    "^~/components/(.*)$",
    "^~/utils/(.*)$",

    "^[./]"
  ],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true
}
ony3000 commented 3 weeks ago

@n2k3 @osh6006 Fixed in v0.7.1, check it out!