You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to wrap my mind around how to get a list of classNames sorted automatically like the .join(' ') string below would be sorted when using https://github.com/tailwindlabs/prettier-plugin-tailwindcss if hardcoded as a normal string.
We should keep the approach simple and simply try to detect the "classNames" substring in any constant name of the array - this should find most use cases like "mainClassNames", "buttonClassNames", "buttonClassNamesActive" etc...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to wrap my mind around how to get a list of classNames sorted automatically like the
.join(' ')
string below would be sorted when using https://github.com/tailwindlabs/prettier-plugin-tailwindcss if hardcoded as a normal string.The
text-blue-600
item would need to move from [0] to [3] in the array on save, like the string changes below:Before format on save:
after format on save:
How to achieve this identical result, but retain the reversed
.split(' ')
of the string in resulting code?We should keep the approach simple and simply try to detect the "classNames" substring in any constant name of the array - this should find most use cases like "mainClassNames", "buttonClassNames", "buttonClassNamesActive" etc...
Beta Was this translation helpful? Give feedback.
All reactions