@@ -3,9 +3,9 @@ use std::{env::current_dir, fs, path::Path, str::FromStr};
33use oxc_allocator:: Allocator ;
44use oxc_formatter:: {
55 ArrowParentheses , BracketSameLine , BracketSpacing , FormatOptions , Formatter , IndentStyle ,
6- IndentWidth , LineWidth , QuoteStyle , Semicolons , TrailingCommas ,
6+ IndentWidth , LineWidth , QuoteStyle , Semicolons , TrailingCommas , get_parse_options ,
77} ;
8- use oxc_parser:: { ParseOptions , Parser } ;
8+ use oxc_parser:: Parser ;
99use oxc_span:: SourceType ;
1010
1111type OptionSet = serde_json:: Map < String , serde_json:: Value > ;
@@ -141,14 +141,8 @@ fn format_options_display(json: &OptionSet) -> String {
141141/// Format a source file with given options
142142fn format_source ( source_text : & str , source_type : SourceType , options : FormatOptions ) -> String {
143143 let allocator = Allocator :: default ( ) ;
144- let ret = Parser :: new ( & allocator, source_text, source_type)
145- . with_options ( ParseOptions {
146- parse_regular_expression : false ,
147- allow_v8_intrinsics : true ,
148- allow_return_outside_function : true ,
149- preserve_parens : false ,
150- } )
151- . parse ( ) ;
144+ let ret =
145+ Parser :: new ( & allocator, source_text, source_type) . with_options ( get_parse_options ( ) ) . parse ( ) ;
152146
153147 let formatter = Formatter :: new ( & allocator, options) ;
154148 formatter. build ( & ret. program )
0 commit comments