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

🐛 BUG: prettier-ignore destroys the contents #338

Open
hyvyys opened this issue Apr 3, 2023 · 3 comments
Open

🐛 BUG: prettier-ignore destroys the contents #338

hyvyys opened this issue Apr 3, 2023 · 3 comments
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) ecosystem: compiler Issue is caused by a bug in the Astro compiler

Comments

@hyvyys
Copy link

hyvyys commented Apr 3, 2023

Describe the Bug

Before save:

obraz

After save:
obraz

Code:

              <!-- prettier-ignore -->
              <div
                class:list={[
                  sizeLogo,
                  'mb-[-.24em] font-display font-black text-[var(--color-logo)] logo leading-1.2 light ---text-fg',
                ]}
              >
              {
                font.name.split('').map((char, i) => <span class="char" style={{ '--i': i }}>{char}</span>)
              }
              </div>

Steps to Reproduce

  1. npm init astro using default template
  2. Add prettier-plugin-astro and prettier-plugin-tailwindcss
  3. Format contents as above
  4. Error! Code gets swallowed into oblivion
@Princesseuh Princesseuh added bug ecosystem: compiler Issue is caused by a bug in the Astro compiler labels May 18, 2023
@Princesseuh Princesseuh added - P4: important Violate documented behavior or significantly improves performance (priority) and removed bug labels Nov 28, 2023
@ony3000
Copy link

ony3000 commented Mar 1, 2024

I think this issue may be related to #411.

When I applied Prettier to the following code, the beginning of the second prettier-ignore comment disappeared.

<!-- prettier-ignore -->
<script>
if (condition1) {
  foo
} else if (condition2) {
  bar
}
else
{
  baz
}
</script>

<!-- prettier-ignore -->
<script>
if (condition1) {
  foo
} else if (condition2) {
  bar
}
else
{
  baz
}
</script>

@Kobreros
Copy link

I have the same bug, which makes using prettier-ignore impossible in some files. Especially annoying when inserting svg.

Before

<!-- prettier-ignore -->
<a href="" class="btn btn--primary">Get your free proposal</a>
<!-- prettier-ignore -->
<Image class="cta__image" src={CtaImg} alt="" />

After

<!-- prettier-ignore -->
 href="" class="btn btn--primary">Get your free proposal</a>

<!-- prettier-ignore -->
mage cla

@Bvngee
Copy link

Bvngee commented Aug 23, 2024

Same issue here - at least I think. Correct me if Im wrong.

Before

<!-- prettier-ignore -->
<nav id="nav-links">
    <a id="home" href="/"><span class="icon" id="home-logo"></span>Home</a>
    <a id="about" href="/about/"><span class="icon" id="about-logo"></span>About</a>
    <a id="blog" href="/blogs/"><span class="icon" id="blog-logo">󱀂 </span>Blogs</a>
</nav>

<style>
    #nav-links {
        height: 50px;
...

After

<!-- prettier-ignore -->
<nav id="nav-links">
    <a id="home" href="/"><span class="icon" id="home-logo"></span>Home</a>
    <a id="about" href="/about/"><span class="icon" id="about-logo"></span>About</a>
    <a id="blog" href="/blogs/"><span class="icon" id="blog-logo">󱀂 </span>Blogs</a>
</nav>

<sty

<style>
    #nav-links {
        height: 50px;
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) ecosystem: compiler Issue is caused by a bug in the Astro compiler
Projects
None yet
Development

No branches or pull requests

5 participants