mohammadsiyou / prettier-plugin-twin.macro

Sort Tailwind and Twin classes based on recommended class order of Tailwind using Prettier.
11 stars 1 forks source link

Incorrect formatting with calc #10

Closed AlexanderArvidsson closed 1 year ago

AlexanderArvidsson commented 1 year ago

Great plugin, really helps keep things consistent!

I've strumbled upon a problem after upgrading, the formatting is breaking the classes.

Example: inset-y-0 right-0 w-[80rem] max-w-[100vw] sm:max-w-[calc(100vw - 10rem)]

Auto-formatted to: 100vw - 10rem ] inset-y-0 right-0 w-[80rem] max-w-[100vw] sm:max-w-[calc

It seems to strip away the parenthesis in the calc, and then formats it as if it's its own classes? I'd expect it to not touch it at all since it's already sorted.

mohammadsiyou commented 1 year ago

Sorry for inconvenience we are working on fixing it.

FFGFlash commented 1 year ago

To add to this any css value that requires parenthesis doesn't get formatted correctly. w-[calc(100% + 5rem)] or p-[var(--padding)] either throw a prettier error, or get formatted completely wrong.

mohammadsiyou commented 1 year ago

@AlexanderArvidsson @FFGFlash New version is released and bugs are fixed.