Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing newline in script and style blocks #222

Closed
RedHatter opened this issue May 10, 2021 · 4 comments · Fixed by #235
Closed

Trailing newline in script and style blocks #222

RedHatter opened this issue May 10, 2021 · 4 comments · Fixed by #235
Labels
bug Something isn't working

Comments

@RedHatter
Copy link
Contributor

Tailing newlines are being added to the script and style blocks. This is quite annoying.

For example

<script>
  export let name;
</script>

becomes

<script>
  export let name;

</script>

A minimal repository exemplifying the issue can be found here.

git clone https://github.com/RedHatter/prettier-svelte-trailing-newline
cd prettier-svelte-trailing-newline
npm install
npm run
@dummdidumm
Copy link
Member

dummdidumm commented May 10, 2021

Yes this is a result of Prettier 2.3.0, I just committed a fix in #223, release pending. In the meantime you can downgrade to Prettier 2.2.x .

@dummdidumm dummdidumm added the bug Something isn't working label May 10, 2021
@dummdidumm
Copy link
Member

This should be fixed with prettier-plugin-svelte 2.3.0

@dummdidumm dummdidumm pinned this issue Jun 18, 2021
dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Jun 18, 2021
The check for hardline was insufficient. It could happen that one version of Prettier did create the docs, and another version of Prettier was used for strict reference equality of the hardline builder. Therefore do a deep equality check if the reference check fails.
Fixes sveltejs#222
dummdidumm added a commit that referenced this issue Jun 18, 2021
The check for hardline was insufficient. It could happen that one version of Prettier did create the docs, and another version of Prettier was used for strict reference equality of the hardline builder. Therefore do a deep equality check if the reference check fails.
Fixes #222
@dummdidumm
Copy link
Member

dummdidumm commented Jun 18, 2021

Those who use pnpm likely still observe this issue. The reason is that the workspace prettier-plugin-svelte version is likely not found (see #155) and that makes a reference check fail (see #235 for more details). #235 fixes this, release pending.

@dummdidumm
Copy link
Member

Version 2.3.1 which is also incoroprated into the latest Svelte for VS Code extension should fix this issue.

@dummdidumm dummdidumm unpinned this issue Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants