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

Whitespace removal breaks on ternary conditions #285

Closed
mary-ext opened this issue Jun 6, 2024 · 2 comments · Fixed by #288
Closed

Whitespace removal breaks on ternary conditions #285

mary-ext opened this issue Jun 6, 2024 · 2 comments · Fixed by #288
Assignees

Comments

@mary-ext
Copy link

mary-ext commented Jun 6, 2024

What version of prettier-plugin-tailwindcss are you using?

v0.6.1

What version of Tailwind CSS are you using?

v3.4.4

What version of Node.js are you using?

Node.js v22.0.0 / Bun v1.1.12

What package manager are you using?

Bun 1.1.12

What operating system are you using?

Linux (Arch Linux 6.9.3-1-cachyos-bore-lto)

Reproduction URL

https://github.com/mary-ext/repro-prettier-tailwindcss-whitespace/blob/trunk/index.tsx

Describe your issue

The whitespace removal introduced in recent releases doesn't take ternary conditions into account.

jsx = <div class={'h-full w-full overflow-hidden' + (!isMobile ? ' bg-black/90' : '')}></div>;

// This gets transformed into
jsx = <div class={'h-full w-full overflow-hidden' + (!isMobile ? 'bg-black/90' : '')}></div>;
jsx = <div class={'object-cover' + (standalone ? ' aspect-square w-full' : ' min-h-0 grow basis-0')}></div>

// This gets transformed to
jsx = <div class={'object-cover' + (standalone ? 'aspect-square w-full' : 'min-h-0 grow basis-0')}></div>

// It should at least be
jsx = <div class={'object-cover ' + (standalone ? 'aspect-square w-full' : 'min-h-0 grow basis-0')}></div>
@thecrypticace
Copy link
Contributor

I've merged a fix for this in #288 — I'm doing some final testing on the insiders build before I tag a patch release but it'll be out later today!

@thecrypticace
Copy link
Contributor

Released as v0.6.3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants