donnikitos/vite-plugin-html-inject

Syntax Causes Formatting Issues with Prettier

Typogram opened this issue · 4 comments

Description

The syntax introduced by this library:

<load ="src/html/header/branding.html" />

causes Prettier to format it as:

<load=" src/html/header/branding.html" />

However, a more standard syntax like:

<load src="src/html/header/branding.html" />

is formatted correctly by Prettier.

Issue

The unusual syntax <load ="src/html/header/branding.html" /> is causing compatibility issues with Prettier, a widely-used code formatter. This might lead to unexpected behaviors or errors when developers use both this library and Prettier.

Suggestion

Consider revising the syntax or providing guidance on how to handle this with Prettier and other code formatters.

Thanks for opening the issue.
Please share your Prettier config for debugging.

Thanks for opening the issue.

Please share your Prettier config for debugging.
Thanks!

{
  "semi": true,
  "trailingComma": "none",
  "singleQuote": true,
  "printWidth": 80,
  "proseWrap": "never",
  "bracketSameLine": true,
  "svelteSortOrder": "scripts-markup-styles",
  "svelteStrictMode": true,
  "svelteAllowShorthand": false,
  "svelteIndentScriptAndStyle": false
}

For some reason I am not able to reproduce the formatting issue with Prettier...
However I agree a more standardized syntax, like you suggested, is appropriate.
I will add that feature to the plugin.

It might have something to do with the svelte prettier plugin or some obscure setting in my vs code prettier extension I am using. Glad to hear it is less common, but yeah agree that having a more standard syntax can do no harm and provide some benefit! Thanks again for the great plugin!