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
12 changes: 10 additions & 2 deletions crates/oxc_transformer/src/jsx/jsx_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,18 @@ impl<'a> JsxImpl<'a, '_> {
JSXAttributeItem::Attribute(attr) => {
let JSXAttribute { span, name, value } = attr.unbox();
match &name {
JSXAttributeName::Identifier(ident) if ident.name == "__self" => {
JSXAttributeName::Identifier(ident)
if self.options.development
&& self.options.jsx_self_plugin
&& ident.name == "__self" =>
{
self.jsx_self.report_error(ident.span);
}
JSXAttributeName::Identifier(ident) if ident.name == "__source" => {
JSXAttributeName::Identifier(ident)
if self.options.development
&& self.options.jsx_source_plugin
&& ident.name == "__source" =>
{
self.jsx_source.report_error(ident.span);
}
JSXAttributeName::Identifier(ident) if ident.name == "key" => {
Expand Down
3 changes: 2 additions & 1 deletion tasks/transform_conformance/snapshots/oxc.snap.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
commit: 578ac4df

Passed: 148/241
Passed: 150/243

# All Passed:
* babel-plugin-transform-class-static-block
Expand All @@ -15,6 +15,7 @@ Passed: 148/241
* babel-plugin-transform-exponentiation-operator
* babel-plugin-transform-arrow-functions
* babel-preset-typescript
* babel-plugin-transform-react-jsx-self
* babel-plugin-transform-react-jsx-source
* regexp

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div __self={this} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["transform-react-jsx", "transform-react-jsx-self"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var _reactJsxRuntime = require("react/jsx-runtime");
/* @__PURE__ */ _reactJsxRuntime.jsx("div", { __self: this }, this);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div __source="custom" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["transform-react-jsx", "transform-react-jsx-source"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var _reactJsxRuntime = require("react/jsx-runtime");
var _jsxFileName = "<CWD>/tests/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/duplicate-source-prop/input.jsx";
/* @__PURE__ */ _reactJsxRuntime.jsx("div", { __source: "custom" }, {
fileName: _jsxFileName,
lineNumber: 1,
columnNumber: 1
});
Loading