@@ -197,10 +197,12 @@ pub struct FormatConfig {
197197 /// Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
198198 /// For details, see each field's documentation.
199199 ///
200+ /// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
201+ ///
200202 /// - Default: Disabled
201203 #[ serde( skip_serializing_if = "Option::is_none" ) ]
202204 #[ serde( alias = "experimentalSortImports" ) ]
203- pub sort_imports : Option < SortImportsConfig > ,
205+ pub sort_imports : Option < SortImportsUserConfig > ,
204206
205207 /// Sort `package.json` keys.
206208 ///
@@ -219,30 +221,32 @@ pub struct FormatConfig {
219221 /// Option names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).
220222 /// For details, see each field's documentation.
221223 ///
224+ /// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
225+ ///
222226 /// - Default: Disabled
223227 #[ serde( skip_serializing_if = "Option::is_none" ) ]
224228 #[ serde( alias = "experimentalTailwindcss" ) ]
225- pub sort_tailwindcss : Option < SortTailwindcssConfig > ,
229+ pub sort_tailwindcss : Option < SortTailwindcssUserConfig > ,
226230
227231 /// Enable JSDoc comment formatting.
228232 ///
229233 /// When enabled, JSDoc comments are normalized and reformatted:
230234 /// tag aliases are canonicalized, descriptions are capitalized,
231235 /// long lines are wrapped, and short comments are collapsed to single-line.
232236 ///
233- /// Pass an object (`jsdoc: {}`) to enable with defaults, or omit to disable.
237+ /// Pass `true` or an object to enable with defaults, or omit/set `false` to disable.
234238 ///
235239 /// - Default: Disabled
236240 #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
237- pub jsdoc : Option < JsdocConfig > ,
241+ pub jsdoc : Option < JsdocUserConfig > ,
238242}
239243
240244impl FormatConfig {
241245 /// Resolve relative tailwind paths (`config`, `stylesheet`) to absolute paths.
242246 /// Otherwise, the plugin tries to resolve the Prettier's configuration file, not Oxfmt's.
243247 /// <https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/125a8bc77639529a5a0c7e4e8a02174d7ed2d70b/src/config.ts#L50-L54>
244248 pub fn resolve_tailwind_paths ( & mut self , base_dir : & Path ) {
245- let Some ( ref mut tw) = self . sort_tailwindcss else {
249+ let Some ( SortTailwindcssUserConfig :: Object ( ref mut tw) ) = self . sort_tailwindcss else {
246250 return ;
247251 } ;
248252
@@ -340,6 +344,23 @@ pub enum HtmlWhitespaceSensitivityConfig {
340344
341345// ---
342346
347+ #[ derive( Debug , Clone , Deserialize , Serialize , JsonSchema ) ]
348+ #[ serde( untagged) ]
349+ pub enum SortImportsUserConfig {
350+ Bool ( bool ) ,
351+ Object ( SortImportsConfig ) ,
352+ }
353+
354+ impl SortImportsUserConfig {
355+ pub fn into_config ( self ) -> Option < SortImportsConfig > {
356+ match self {
357+ Self :: Bool ( true ) => Some ( SortImportsConfig :: default ( ) ) ,
358+ Self :: Bool ( false ) => None ,
359+ Self :: Object ( config) => Some ( config) ,
360+ }
361+ }
362+ }
363+
343364#[ derive( Debug , Clone , Default , Deserialize , Serialize , JsonSchema ) ]
344365#[ serde( rename_all = "camelCase" , default ) ]
345366pub struct SortImportsConfig {
@@ -579,6 +600,23 @@ impl SortPackageJsonConfig {
579600
580601// ---
581602
603+ #[ derive( Debug , Clone , Deserialize , Serialize , JsonSchema ) ]
604+ #[ serde( untagged) ]
605+ pub enum SortTailwindcssUserConfig {
606+ Bool ( bool ) ,
607+ Object ( SortTailwindcssConfig ) ,
608+ }
609+
610+ impl SortTailwindcssUserConfig {
611+ pub fn into_config ( self ) -> Option < SortTailwindcssConfig > {
612+ match self {
613+ Self :: Bool ( true ) => Some ( SortTailwindcssConfig :: default ( ) ) ,
614+ Self :: Bool ( false ) => None ,
615+ Self :: Object ( config) => Some ( config) ,
616+ }
617+ }
618+ }
619+
582620#[ derive( Debug , Clone , Default , Deserialize , Serialize , JsonSchema ) ]
583621#[ serde( rename_all = "camelCase" , default ) ]
584622pub struct SortTailwindcssConfig {
@@ -628,6 +666,23 @@ pub struct SortTailwindcssConfig {
628666
629667// ---
630668
669+ #[ derive( Debug , Clone , Deserialize , Serialize , JsonSchema ) ]
670+ #[ serde( untagged) ]
671+ pub enum JsdocUserConfig {
672+ Bool ( bool ) ,
673+ Object ( JsdocConfig ) ,
674+ }
675+
676+ impl JsdocUserConfig {
677+ pub fn into_config ( self ) -> Option < JsdocConfig > {
678+ match self {
679+ Self :: Bool ( true ) => Some ( JsdocConfig :: default ( ) ) ,
680+ Self :: Bool ( false ) => None ,
681+ Self :: Object ( config) => Some ( config) ,
682+ }
683+ }
684+ }
685+
631686#[ derive( Debug , Clone , Default , Serialize , Deserialize , JsonSchema ) ]
632687#[ serde( rename_all = "camelCase" ) ]
633688pub struct JsdocConfig {
0 commit comments