prettier-plugin-svelte icon indicating copy to clipboard operation
prettier-plugin-svelte copied to clipboard

svelte template pug format remove line break ( and add 2 indent )

Open i18nsite opened this issue 10 months ago • 0 comments

svelte template pug format remove line break ( and add 2 init indent )

how to add the line break add remove init indent?

❯ cat Test2.svelte
<template lang="pug">
h1(b="1" x="x") 33
+if name
  button(@click=add) Hello {name}
</template>

->

❯ bun x prettier ./Test2.svelte
<template lang="pug">
  h1(b="1" x="x") 33
  +if name
    button(@click=add) Hello {name}</template>

<script lang="coffee">
> svelte > tick

name = 1

add = =>
  ++name
  return
</script>

<style>
button {
  color: #ff3e00;
}
h3 {
  color: #000;
}
</style>

❯ cat ../../package.json
{
  "type": "module",
  "dependencies": {
    "$": "link:../srv/gen/js",
    "@3-/svelte-com": "link:../../i18n/lib/svelte-com",
    "@3-/coffee_plus": "^0.1.15",
    "@3-/jsext": "^0.0.7",
    "@3-/loader": "^0.0.2",
    "svelte": "^5.19.3",
    "vite": "^6.0.11",
    "zx": "^8.3.0"
  },
  "devDependencies": {
    "@prettier/plugin-pug": "^3.2.0",
    "prettier-plugin-svelte": "^3.3.3",
    "prettier-plugin-toml": "^2.0.1"
  }
}
❯ cat ../../.prettierrc.yml
endOfLine: lf
pugAttributeSeparator: none
pugEmptyAttributes: none
pugSortAttributes: asc
svelteAllowShorthand: true
svelteIndentScriptAndStyle: false
svelteSortOrder: options-markup-scripts-styles
plugins:
  - prettier-plugin-svelte
  - "@prettier/plugin-pug"
overrides:
  - files: "*.svelte"
    options:
      parser: svelte

i18nsite avatar Jan 26 '25 17:01 i18nsite