diff --git a/crates/oxc_codegen/tests/integration/tester.rs b/crates/oxc_codegen/tests/integration/tester.rs index 78207e0189949..8379400815490 100644 --- a/crates/oxc_codegen/tests/integration/tester.rs +++ b/crates/oxc_codegen/tests/integration/tester.rs @@ -4,7 +4,7 @@ use oxc_parser::Parser; use oxc_span::SourceType; pub fn test(source_text: &str, expected: &str) { - let source_type = SourceType::default().with_module(true).with_jsx(true); + let source_type = SourceType::jsx(); let allocator = Allocator::default(); let ret = Parser::new(&allocator, source_text, source_type).parse(); let result = CodeGenerator::new() @@ -22,7 +22,7 @@ pub fn test(source_text: &str, expected: &str) { } pub fn test_without_source(source_text: &str, expected: &str) { - let source_type = SourceType::default().with_module(true).with_jsx(true); + let source_type = SourceType::jsx(); let allocator = Allocator::default(); let ret = Parser::new(&allocator, source_text, source_type).parse(); let result = CodeGenerator::new().build(&ret.program).source_text; @@ -33,7 +33,7 @@ pub fn test_without_source(source_text: &str, expected: &str) { } pub fn test_minify(source_text: &str, expected: &str) { - let source_type = SourceType::default().with_module(true).with_jsx(true); + let source_type = SourceType::jsx(); let allocator = Allocator::default(); let ret = Parser::new(&allocator, source_text, source_type).parse(); let result = CodeGenerator::new() diff --git a/crates/oxc_codegen/tests/integration/ts.rs b/crates/oxc_codegen/tests/integration/ts.rs index d8871432b1249..7de69c2551727 100644 --- a/crates/oxc_codegen/tests/integration/ts.rs +++ b/crates/oxc_codegen/tests/integration/ts.rs @@ -7,7 +7,7 @@ use oxc_span::SourceType; fn codegen(source_text: &str) -> String { let allocator = Allocator::default(); - let source_type = SourceType::default().with_typescript(true).with_module(true); + let source_type = SourceType::ts(); let ret = Parser::new(&allocator, source_text, source_type).parse(); CodeGenerator::new() .with_options(CodegenOptions { single_quote: true, ..CodegenOptions::default() }) diff --git a/crates/oxc_isolated_declarations/src/lib.rs b/crates/oxc_isolated_declarations/src/lib.rs index 129c4cb46bef4..37123dc073e3f 100644 --- a/crates/oxc_isolated_declarations/src/lib.rs +++ b/crates/oxc_isolated_declarations/src/lib.rs @@ -55,7 +55,7 @@ impl<'a> IsolatedDeclarations<'a> { /// /// Returns `Vec` if any errors were collected during the transformation. pub fn build(mut self, program: &Program<'a>) -> IsolatedDeclarationsReturn<'a> { - let source_type = SourceType::default().with_module(true).with_typescript_definition(true); + let source_type = SourceType::d_ts(); let directives = self.ast.vec(); let stmts = self.transform_program(program); let program = self.ast.program(SPAN, source_type, None, directives, stmts); diff --git a/crates/oxc_linter/src/partial_loader/astro.rs b/crates/oxc_linter/src/partial_loader/astro.rs index 0c6b897ffbc7d..bf9f5f52b2b7e 100644 --- a/crates/oxc_linter/src/partial_loader/astro.rs +++ b/crates/oxc_linter/src/partial_loader/astro.rs @@ -43,11 +43,7 @@ impl<'a> AstroPartialLoader<'a> { let js_code = Span::new(start + ASTRO_SPLIT.len() as u32, end).source_text(self.source_text); - Some(JavaScriptSource::new( - js_code, - SourceType::default().with_typescript(true).with_module(true), - start as usize, - )) + Some(JavaScriptSource::new(js_code, SourceType::ts(), start as usize)) } /// In .astro files, you can add client-side JavaScript by adding one (or more) `