mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
refactor(transformer/react-jsx): improve SpreadChildrenAreNotSupported error implementation (#1235)
This commit is contained in:
parent
1dd321e021
commit
47ba874f4f
1 changed files with 2 additions and 8 deletions
|
|
@ -375,12 +375,6 @@ impl<'a> ReactJsx<'a> {
|
||||||
|
|
||||||
let children = e.children();
|
let children = e.children();
|
||||||
|
|
||||||
if children.len() == 1 {
|
|
||||||
if let Some(JSXChild::Spread(s)) = children.get(0) {
|
|
||||||
self.ctx.error(SpreadChildrenAreNotSupported(s.span));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append children to object properties in automatic mode
|
// Append children to object properties in automatic mode
|
||||||
if is_automatic {
|
if is_automatic {
|
||||||
let allocator = self.ast.allocator;
|
let allocator = self.ast.allocator;
|
||||||
|
|
@ -656,8 +650,8 @@ impl<'a> ReactJsx<'a> {
|
||||||
},
|
},
|
||||||
JSXChild::Element(e) => Some(self.transform_jsx(&JSXElementOrFragment::Element(e))),
|
JSXChild::Element(e) => Some(self.transform_jsx(&JSXElementOrFragment::Element(e))),
|
||||||
JSXChild::Fragment(e) => Some(self.transform_jsx(&JSXElementOrFragment::Fragment(e))),
|
JSXChild::Fragment(e) => Some(self.transform_jsx(&JSXElementOrFragment::Fragment(e))),
|
||||||
JSXChild::Spread(_) => {
|
JSXChild::Spread(e) => {
|
||||||
// Babel: Spread children are not supported in React.
|
self.ctx.error(SpreadChildrenAreNotSupported(e.span));
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue