[Prettier Plugin] Support sorting class arrays #11223
Replies: 4 comments 2 replies
-
In your JavaScript project, firstly you have to install and configure Prettier, you can do that easily by installing prettier as a dev dependency by running this command. After installing Prettier, we'll create a configuration file at the root of your project called .prettierrc. In that file, you can write JSON to configure prettier fitting to your needs. This is my configuration. MyCCPay Log In |
Beta Was this translation helpful? Give feedback.
-
HI , I properly read your question i am cybersecurity student so i can tell you one thing is that if you face the issue with experiencing is related to sorting class names within an array when using the Tailwind CSS class pattern in code editors like Visual Studio Code (VSCode) with the Tailwind CSS experimental VSCode extension and the Prettier plugin. {"tailwindCSS.experimental.classRegex": [ |
Beta Was this translation helpful? Give feedback.
-
FWIW, I can sort an array that spans a single line. But when I try to make the array of CSS classes spread across multiple lines, prettier isn't able to do the class sorting anymore. Any ideas on how to fix? |
Beta Was this translation helpful? Give feedback.
-
Did we ever get a workaround to this ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Many use cases include putting class names in arrays, take cva for example.
Autocomplete support for arrays works with the experimental vscode extension setting:
When using the prettier plugin, and doing something like:
sorting will only work inside a single string, but not for the array. This problem applies to popular utilities such as
clsx
as well.Beta Was this translation helpful? Give feedback.
All reactions