fix(transformer/react-jsx): missing import jsxs in nested fragment (#1218)

This commit is contained in:
Dunqing 2023-11-11 10:45:42 +08:00 committed by GitHub
parent a0f40cb058
commit 48242367bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -158,7 +158,12 @@ impl<'a> ReactJsx<'a> {
}
JSXElementOrFragment::Element(_) if need_jsxs => self.add_import_jsxs(),
JSXElementOrFragment::Element(_) => self.add_import_jsx(),
JSXElementOrFragment::Fragment(_) => self.add_import_fragment(),
JSXElementOrFragment::Fragment(_) => {
self.add_import_fragment();
if need_jsxs {
self.add_import_jsxs();
}
}
}
}

View file

@ -875,7 +875,6 @@ Passed: 266/1113
* react-automatic/arrow-functions/input.js
* react-automatic/optimisation.react.constant-elements/input.js
* react-automatic/should-add-quotes-es3/input.js
* react-automatic/should-allow-nested-fragments/input.js
* react-automatic/should-disallow-spread-children/input.js
* react-automatic/should-disallow-valueless-key/input.js
* react-automatic/should-disallow-xml-namespacing/input.js