shufo / prettier-plugin-blade

Format your blade template using Prettier
https://www.npmjs.com/package/@shufo/prettier-plugin-blade
MIT License
325 stars 8 forks source link

Gigantic css line after reformatting (PHPstorm) #146

Closed Blinks44 closed 2 years ago

Blinks44 commented 2 years ago

Hello! Thank you for an awesome plugin. Can you help me to understand maybe i'm doing something wrong? When i typing tailwind classes, phpstorm automatically transfer classes to a new line after i reach 120 symbols, but then prettier blade plugin starts to sorting tailwind classes and moves all classes from several lines to a gigantic one. If i disable sortTailwindcssClasses in .prettierrc, then everything works as expected, of course without tailwind sorting :(

Maybe i am doing something wrong?

Before prettier 2022-09-13_22-45-19

After prettier 2022-09-13_22-45-30

shufo commented 2 years ago

Hi @Blinks44. Thanks for trying out. The reason for this behaviour is that since Prettier 2.5, the classes are now combined into a single line, so this plugin follows that behaviour too.

Blinks44 commented 2 years ago

Hi @Blinks44. Thanks for trying out. The reason for this behaviour is that since Prettier 2.5, the classes are now combined into a single line, so this plugin follows that behaviour too.

For what reason they did it, absolutely unreadable...?) Don't you know is it possible to disable this behaviour?

shufo commented 2 years ago

@Blinks44 Perhaps this issue helps you understand why they changed the behaviour. https://github.com/prettier/prettier/issues/10918

I think single-line approach is not bad because other html attribute will be more recognizable and increase consistency for team development. Also if we use ruler-based line breaking, a small change could cause a large line changes.

Disabling this behavior does not seem to be currently supported by Prettier either.

Blinks44 commented 2 years ago

Ok, thank you one more time! Your plugin is awesome anyway