question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

svelteBracketNewLine: false not working

See original GitHub issue

After the update to v2, I added svelteBracketNewLine: false to my Prettier config as I prefer the previous formatting. This setting seems to be ignored though. Prettier now closes multiline tags on a new line regardless. Here’s my full config:

# .prettierrc.yml
semi: false
singleQuote: true
svelteBracketNewLine: false
overrides:
  - files: '*.svelte'
    options:
      printWidth: 90

diff

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dummdidummcommented, Jan 8, 2021

After I slept over it, I think you are right that closing tags should also be printed in the same line if possible. Possible means: There’s whitespace after the >, or it’s the last child inside a block element where whitespace doesn’t matter at the outer edges. This will be fixed with 2.0.3.

1reaction
janoshcommented, Jan 7, 2021

Thanks for the clarification. So this closing bracket on new line behavior is non-configurable?

I think it adds unnecessary vertical space and also confuses VS Code syntax highlighting as you can see in the screenshot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier plugin does not format *.svelte files, even ... - YouTrack
If I make a change to the file such as adding "semi": false to remove semicolons, ... "Run for files" is not working...
Read more >
prettier-plugin-svelte - npm
Start using prettier-plugin-svelte in your project by running `npm i ... after formatting, svelteBracketNewLine false --> <span > ...
Read more >
Errors with Svelte, TypeScript, ESLint, & Prettier Together
To clarify, ESLint works fine on its own. Prettier works fine on its own. However, when I combine them is when the problem...
Read more >
Format Your Svelte Components using Prettier - Morioh
Setting this to false will have no effect for whitespace-sensitive tags (inline elements) when there's no whitespace between the > of the start...
Read more >
@dylanvann/prettier-plugin-svelte - npm package | Snyk
Option to enable/disable component attribute shorthand if attribute name and expression are same. svelteBracketNewLine. Default: false; Put the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found