0

For some reason, my format-on-save is giving me different results than when I run the following command:

prettier --write src/pages/file.svelte`

The difference between formats is a new line being inserted with the --write command. Is there anyway to check why this is happening?


.vscode/settings.json

"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",

.prettierrc

{
    "arrowParens": "always",
    "bracketSpacing": true,
    "endOfLine": "lf",
    "htmlWhitespaceSensitivity": "css",
    "insertPragma": false,
    "jsxBracketSameLine": true,
    "jsxSingleQuote": false,
    "proseWrap": "preserve",
    "quoteProps": "as-needed",
    "requirePragma": false,
    "singleQuote": false,
    "useTabs": true,
    "tabWidth": 2,
    "printWidth": 120,
    "semi": true,
    "trailingComma": "all",
    "svelteSortOrder": "styles-scripts-markup",
    "svelteStrictMode": false,
    "svelteBracketNewLine": true,
    "svelteAllowShorthand": false,
    "plugins": ["./node_modules/prettier-plugin-svelte"]
}

bryan
  • 8,879
  • 18
  • 83
  • 166
  • 1
    Which version of `prettier-plugin-svelte` is installed? Prettier did a breaking change to the library and `prettier-plugin-svelte` had to work around that in a newer version. – dummdidumm Aug 27 '21 at 06:42
  • @dummdidumm That did it...upgraded the version worked. Thank you! – bryan Aug 30 '21 at 15:03

1 Answers1

0

Thanks to @dummdidumm for the answer

Prettier did a breaking change to the library and prettier-plugin-svelte had to work around that in a newer version.

Updating prettier-plugin-svelte to ^2.4.0 fixed the issue.

bryan
  • 8,879
  • 18
  • 83
  • 166