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

Broken change for div with class #146

Closed
robhudson opened this issue Sep 24, 2020 · 4 comments · Fixed by #148
Closed

Broken change for div with class #146

robhudson opened this issue Sep 24, 2020 · 4 comments · Fixed by #148
Labels
bug Something isn't working

Comments

@robhudson
Copy link

Testing v1.3.0 with previous formatting on v1.2.1 resulted in this change:

-    <div class="met-ex metropolis02">
-      Growth <b>&</b> Usage
+    <divclass="met-ex metropolis02">
+      Growth
+      <b>&</b>
+      Usage
@Conduitry Conduitry added the bug Something isn't working label Sep 25, 2020
@dummdidumm
Copy link
Member

I cannot reproduce this given your snippet. What's your prettier config, and give a minimum reproducible?

@Conduitry
Copy link
Member

(I should note that I didn't actually try to reproduce this before adding the bug label, sorry if that was misleading!)

@robhudson
Copy link
Author

Here's my .prettierrc.js and a full file example that reproduces the issue for me...

File: .prettierrc.js

module.exports = {
  singleQuote: true,

  // Hard-wrap Markdown
  proseWrap: 'always',
};

File: Test.svelte

<style>
  .metropolis {
    font-family: 'Metropolis';
  }

  .met-ex {
    margin-top: var(--space-8x);
    margin-bottom: var(--space-12x);
  }

  .metropolis02 {
    font-family: 'Metropolis';
    font-size: var(--text-08);
    font-weight: 400;
    color: white;
    background-color: var(--pantone-red-700);
    padding: var(--space-2x);
    padding-left: var(--space-4x);
    /* padding-right: calc(var(--space-4x) - 11px); */
    padding-right: var(--space-4x);
    width: max-content;
    border-radius: var(--space-base);
    box-shadow: 8px 8px 0px var(--pantone-red-600),
      16px 16px 0px var(--pantone-red-500), 24px 24px 0px var(--pantone-red-400),
      32px 32px 0px var(--pantone-red-300), 40px 40px 0px var(--pantone-red-200);
  }

  .metropolis02 b {
    font-weight: black;
    font-size: 0.7em;
  }
</style>

<div>
  <h1>Fonts</h1>
  <div>
    <h2 class="metropolis">
      Metropolis
    </h2>
    <div>
      Metropolis is a geometric typeface used for page & app title elements,
      primarily – think of it as the "brand font". As such, try to only use it
      for logos and dashboard titles.
    </div>
    <div class="met-ex metropolis02">
      Growth <b>&</b> Usage
      <!-- <span>α</span> -->
    </div>
  </div>
</div>

@dummdidumm
Copy link
Member

dummdidumm commented Sep 25, 2020

I narrowed this down to this minimum reproducible:

<div class="met-ex metropolis02">
        <!--  -->
</div>

It seems the comment is messing something up.

This issue also occurs in previous versions, so it's not related to 1.3.0

dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Sep 26, 2020
Will have strange behavior if there's a comment inside which will then ignore the wrong next node
Fixes sveltejs#146
dummdidumm added a commit that referenced this issue Sep 26, 2020
Will have strange behavior if there's a comment inside which will then ignore the wrong next node
Fixes #146

Also added support for running only dedicated tests
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.

3 participants