Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions crates/oxc_transformer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,20 @@ impl<'a> Transformer<'a> {

self.ctx.source_type = program.source_type;
self.ctx.source_text = program.source_text;
jsx::update_options_with_comments(
&program.comments,
&mut self.typescript,
&mut self.jsx,
&self.ctx,
);

// Update options from comments when source type is JSX or TypeScript which has enabled `only_remove_type_imports`.
// Because if `only_remove_type_imports` is enabled, no imports will be removed, so that we don't care about
// TypeScript's `jsx_pragma` and `jsx_pragma_frag` options.
if program.source_type.is_jsx()
&& (!program.source_type.is_typescript() || !self.typescript.only_remove_type_imports)
{
jsx::update_options_with_comments(
&program.comments,
&mut self.typescript,
&mut self.jsx,
&self.ctx,
);
}

let mut transformer = TransformerImpl {
common: Common::new(&self.env, &self.ctx),
Expand Down
4 changes: 2 additions & 2 deletions tasks/transform_conformance/snapshots/oxc.snap.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
commit: 578ac4df

Passed: 141/233
Passed: 143/235

# All Passed:
* babel-plugin-transform-class-static-block
Expand Down Expand Up @@ -43,7 +43,7 @@ after transform: SymbolId(0): [ReferenceId(0), ReferenceId(2), ReferenceId(6), R
rebuilt : SymbolId(0): [ReferenceId(0), ReferenceId(2), ReferenceId(6), ReferenceId(10)]


# babel-plugin-transform-typescript (2/15)
# babel-plugin-transform-typescript (4/17)
* class-property-definition/input.ts
Unresolved references mismatch:
after transform: ["const"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @jsx JSX
import JSX from "module"

() => <div></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import JSX from "module";
() => <div></div>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @jsx JSX
import JSX from "module"

() => <div></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["transform-typescript", { "onlyRemoveTypeImports": true }]]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import JSX from "module";
() => <div></div>;
Loading