@@ -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 < TailwindcssConfig > ,
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 ) ;
@@ -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" ) ]
@@ -1019,9 +1022,7 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10191022 // Add Tailwind plugin flag and map options
10201023 // See: https://github.com/tailwindlabs/prettier-plugin-tailwindcss#options
10211024 if use_tailwind {
1022- if let Some ( tailwind) =
1023- obj. get ( "experimentalTailwindcss" ) . and_then ( |v| v. as_object ( ) ) . cloned ( )
1024- {
1025+ if let Some ( tailwind) = obj. get ( "sortTailwindcss" ) . and_then ( |v| v. as_object ( ) ) . cloned ( ) {
10251026 for ( src, dst) in [
10261027 ( "config" , "tailwindConfig" ) ,
10271028 ( "stylesheet" , "tailwindStylesheet" ) ,
@@ -1058,8 +1059,8 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10581059 "arrowParens" ,
10591060 "quoteProps" ,
10601061 "jsxSingleQuote" ,
1061- "experimentalSortImports " ,
1062- "experimentalTailwindcss " ,
1062+ "sortImports " ,
1063+ "sortTailwindcss " ,
10631064 ] {
10641065 if let Some ( value) = obj. get ( key) {
10651066 oxfmt_plugin_options. insert ( key. to_string ( ) , value. clone ( ) ) ;
@@ -1076,9 +1077,9 @@ pub fn finalize_external_options(config: &mut Value, strategy: &FormatFileStrate
10761077
10771078 // To minimize payload size, remove Prettier unaware options
10781079 for key in [
1079- "experimentalSortImports " ,
1080- "experimentalTailwindcss " ,
1081- "experimentalSortPackageJson " ,
1080+ "sortImports " ,
1081+ "sortTailwindcss " ,
1082+ "sortPackageJson " ,
10821083 "insertFinalNewline" ,
10831084 "overrides" ,
10841085 "ignorePatterns" ,
@@ -1504,7 +1505,7 @@ mod tests_sync_external_options {
15041505 { "files": ["*.test.js"], "options": { "tabWidth": 4 } }
15051506 ],
15061507 "ignorePatterns": ["*.min.js"],
1507- "experimentalSortImports ": { "order": "asc" }
1508+ "sortImports ": { "order": "asc" }
15081509 }"# ;
15091510 let mut raw_config: Value = serde_json:: from_str ( json_string) . unwrap ( ) ;
15101511
@@ -1518,7 +1519,7 @@ mod tests_sync_external_options {
15181519 // oxfmt extensions are removed by finalize_external_options
15191520 assert ! ( !obj. contains_key( "overrides" ) ) ;
15201521 assert ! ( !obj. contains_key( "ignorePatterns" ) ) ;
1521- assert ! ( !obj. contains_key( "experimentalSortImports " ) ) ;
1522+ assert ! ( !obj. contains_key( "sortImports " ) ) ;
15221523 }
15231524}
15241525
0 commit comments