File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,20 @@ This uses the [swc](https://github.com/swc-project/swc) parser for TypeScript wr
1010
1111See the GitHub [ releases] ( https://github.com/dprint/dprint-plugin-typescript/releases ) .
1212
13+ ## Configuration
14+
15+ Set ` jsx.sortClassNames ` to ` tailwind ` to sort JSX ` class ` and ` className ` values using Tailwind CSS ordering.
16+ Helper calls and tagged templates are sorted only when their leading identifier is listed in ` jsx.sortClassNames.functions ` .
17+
18+ ``` json
19+ {
20+ "typescript" : {
21+ "jsx.sortClassNames" : " tailwind" ,
22+ "jsx.sortClassNames.functions" : [" cn" , " classnames" , " tw" ]
23+ }
24+ }
25+ ```
26+
1327## Development
1428
1529The tests are in the ` ./tests/specs ` folder. To run the tests, run ` cargo test ` .
Original file line number Diff line number Diff line change 7373 }]
7474 },
7575 "jsx.sortClassNames.functions" : {
76- "description" : " Function names whose string arguments should be sorted as Tailwind class names." ,
76+ "description" : " Leading function or tag identifiers whose string arguments and template literals should be sorted as Tailwind class names." ,
7777 "type" : " array" ,
7878 "default" : [],
7979 "items" : {
Original file line number Diff line number Diff line change @@ -130,7 +130,8 @@ impl ConfigurationBuilder {
130130 self . insert ( "jsx.sortClassNames" , value. to_string ( ) . into ( ) )
131131 }
132132
133- /// Function names whose string arguments should be sorted as Tailwind class names.
133+ /// Leading function or tag identifiers whose string arguments and template literals should be sorted as
134+ /// Tailwind class names.
134135 ///
135136 /// Default: `[]`
136137 pub fn jsx_sort_class_names_functions ( & mut self , value : Vec < String > ) -> & mut Self {
You can’t perform that action at this time.
0 commit comments