@@ -201,42 +201,45 @@ pub struct FormatConfig {
201201 #[ serde( skip_serializing_if = "Option::is_none" ) ]
202202 pub insert_final_newline : Option < bool > ,
203203
204- /// Experimental: Sort import statements.
204+ /// Sort import statements.
205205 ///
206206 /// Using the similar algorithm as [eslint-plugin-perfectionist/sort-imports](https://perfectionist.dev/rules/sort-imports).
207207 /// For details, see each field's documentation.
208208 ///
209209 /// - Default: Disabled
210210 #[ serde( skip_serializing_if = "Option::is_none" ) ]
211- pub experimental_sort_imports : Option < SortImportsConfig > ,
211+ #[ serde( alias = "experimentalSortImports" ) ]
212+ pub sort_imports : Option < SortImportsConfig > ,
212213
213- /// Experimental: Sort `package.json` keys.
214+ /// Sort `package.json` keys.
214215 ///
215216 /// The algorithm is NOT compatible with [prettier-plugin-sort-packagejson](https://github.com/matzkoh/prettier-plugin-packagejson).
216217 /// But we believe it is clearer and easier to navigate.
217218 /// For details, see each field's documentation.
218219 ///
219220 /// - Default: `true`
220221 #[ serde( skip_serializing_if = "Option::is_none" ) ]
221- pub experimental_sort_package_json : Option < SortPackageJsonUserConfig > ,
222+ #[ serde( alias = "experimentalSortPackageJson" ) ]
223+ pub sort_package_json : Option < SortPackageJsonUserConfig > ,
222224
223- /// Experimental: Sort Tailwind CSS classes.
225+ /// Sort Tailwind CSS classes.
224226 ///
225227 /// Using the same algorithm as [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss).
226228 /// Option names omit the `tailwind` prefix used in the original plugin (e.g., `config` instead of `tailwindConfig`).
227229 /// For details, see each field's documentation.
228230 ///
229231 /// - Default: Disabled
230232 #[ serde( skip_serializing_if = "Option::is_none" ) ]
231- pub experimental_tailwindcss : Option < TailwindcssConfig > ,
233+ #[ serde( alias = "experimentalTailwindcss" ) ]
234+ pub sort_tailwindcss : Option < SortTailwindcssConfig > ,
232235}
233236
234237impl FormatConfig {
235238 /// Resolve relative tailwind paths (`config`, `stylesheet`) to absolute paths.
236239 /// Otherwise, the plugin tries to resolve the Prettier's configuration file, not Oxfmt's.
237240 /// <https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/125a8bc77639529a5a0c7e4e8a02174d7ed2d70b/src/config.ts#L50-L54>
238241 pub fn resolve_tailwind_paths ( & mut self , base_dir : & Path ) {
239- let Some ( ref mut tw) = self . experimental_tailwindcss else {
242+ let Some ( ref mut tw) = self . sort_tailwindcss else {
240243 return ;
241244 } ;
242245
@@ -393,7 +396,7 @@ impl FormatConfig {
393396
394397 // Below are our own extensions
395398
396- if let Some ( config) = self . experimental_sort_imports {
399+ if let Some ( config) = self . sort_imports {
397400 let mut sort_imports = SortImportsOptions :: default ( ) ;
398401
399402 if let Some ( v) = config. partition_by_newline {
@@ -511,7 +514,7 @@ impl FormatConfig {
511514 format_options. sort_imports = Some ( sort_imports) ;
512515 }
513516
514- if let Some ( config) = self . experimental_tailwindcss {
517+ if let Some ( config) = self . sort_tailwindcss {
515518 format_options. sort_tailwindcss = Some ( TailwindcssOptions {
516519 config : config. config ,
517520 stylesheet : config. stylesheet ,
@@ -525,7 +528,7 @@ impl FormatConfig {
525528 // Currently, there is a no options for TOML formatter
526529 let toml_options = build_toml_options ( & format_options) ;
527530
528- let sort_package_json = self . experimental_sort_package_json . map_or_else (
531+ let sort_package_json = self . sort_package_json . map_or_else (
529532 || Some ( SortPackageJsonConfig :: default ( ) . to_sort_options ( ) ) ,
530533 |c| c. to_sort_options ( ) ,
531534 ) ;
@@ -864,7 +867,7 @@ impl SortPackageJsonConfig {
864867
865868#[ derive( Debug , Clone , Default , Deserialize , Serialize , JsonSchema ) ]
866869#[ serde( rename_all = "camelCase" , default ) ]
867- pub struct TailwindcssConfig {
870+ pub struct SortTailwindcssConfig {
868871 /// Path to your Tailwind CSS configuration file (v3).
869872 ///
870873 /// NOTE: Paths are resolved relative to the Oxfmt configuration file.
@@ -1006,7 +1009,7 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10061009 } ;
10071010
10081011 // Determine if Tailwind plugin should be used based on config and strategy
1009- let use_tailwind = obj. contains_key ( "experimentalTailwindcss " )
1012+ let use_tailwind = obj. contains_key ( "sortTailwindcss " )
10101013 && match strategy {
10111014 FormatFileStrategy :: OxcFormatter { .. } => true ,
10121015 #[ cfg( feature = "napi" ) ]
@@ -1020,7 +1023,7 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10201023 // See: https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options
10211024 if use_tailwind {
10221025 if let Some ( tailwind) =
1023- obj. get ( "experimentalTailwindcss " ) . and_then ( |v| v. as_object ( ) ) . cloned ( )
1026+ obj. get ( "sortTailwindcss " ) . and_then ( |v| v. as_object ( ) ) . cloned ( )
10241027 {
10251028 for ( src, dst) in [
10261029 ( "config" , "tailwindConfig" ) ,
@@ -1058,8 +1061,8 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10581061 "arrowParens" ,
10591062 "quoteProps" ,
10601063 "jsxSingleQuote" ,
1061- "experimentalSortImports " ,
1062- "experimentalTailwindcss " ,
1064+ "sortImports " ,
1065+ "sortTailwindcss " ,
10631066 ] {
10641067 if let Some ( value) = obj. get ( key) {
10651068 oxfmt_plugin_options. insert ( key. to_string ( ) , value. clone ( ) ) ;
@@ -1076,9 +1079,9 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10761079
10771080 // To minimize payload size, remove Prettier unaware options
10781081 for key in [
1079- "experimentalSortImports " ,
1080- "experimentalTailwindcss " ,
1081- "experimentalSortPackageJson " ,
1082+ "sortImports " ,
1083+ "sortTailwindcss " ,
1084+ "sortPackageJson " ,
10821085 "insertFinalNewline" ,
10831086 "overrides" ,
10841087 "ignorePatterns" ,
@@ -1504,7 +1507,7 @@ mod tests_sync_external_options {
15041507 { "files": ["*.test.js"], "options": { "tabWidth": 4 } }
15051508 ],
15061509 "ignorePatterns": ["*.min.js"],
1507- "experimentalSortImports ": { "order": "asc" }
1510+ "sortImports ": { "order": "asc" }
15081511 }"# ;
15091512 let mut raw_config: Value = serde_json:: from_str ( json_string) . unwrap ( ) ;
15101513
@@ -1518,7 +1521,7 @@ mod tests_sync_external_options {
15181521 // oxfmt extensions are removed by finalize_external_options
15191522 assert ! ( !obj. contains_key( "overrides" ) ) ;
15201523 assert ! ( !obj. contains_key( "ignorePatterns" ) ) ;
1521- assert ! ( !obj. contains_key( "experimentalSortImports " ) ) ;
1524+ assert ! ( !obj. contains_key( "sortImports " ) ) ;
15221525 }
15231526}
15241527
0 commit comments