mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(transformer/react-jsx): undetectable comments in multiline comments (#1211)
This commit is contained in:
parent
57d24e569b
commit
3e15fa624b
2 changed files with 6 additions and 5 deletions
|
|
@ -69,9 +69,11 @@ impl ReactJsxOptions {
|
|||
/// This behavior is aligned with babel.
|
||||
pub(crate) fn with_comments(mut self, semantic: &Semantic) -> Self {
|
||||
for (_, span) in semantic.trivias().comments_spans() {
|
||||
let comment = span.source_text(semantic.source_text());
|
||||
let mut comment = span.source_text(semantic.source_text()).trim_start();
|
||||
// strip leading jsdoc comment `*` and then whitespaces
|
||||
let comment = comment.strip_prefix('*').unwrap_or(comment).trim_start();
|
||||
while let Some(cur_comment) = comment.strip_prefix('*') {
|
||||
comment = cur_comment.trim_start();
|
||||
}
|
||||
// strip leading `@`
|
||||
let Some(comment) = comment.strip_prefix('@') else { continue };
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Passed: 263/1113
|
||||
Passed: 264/1113
|
||||
|
||||
# All Passed:
|
||||
* babel-plugin-transform-numeric-separator
|
||||
|
|
@ -852,7 +852,7 @@ Passed: 263/1113
|
|||
* regression/11061/input.mjs
|
||||
* variable-declaration/non-null-in-optional-chain/input.ts
|
||||
|
||||
# babel-plugin-transform-react-jsx (128/170)
|
||||
# babel-plugin-transform-react-jsx (129/170)
|
||||
* autoImport/after-polyfills-compiled-to-cjs/input.mjs
|
||||
* autoImport/auto-import-react-source-type-script/input.js
|
||||
* autoImport/complicated-scope-module/input.js
|
||||
|
|
@ -864,7 +864,6 @@ Passed: 263/1113
|
|||
* react/handle-spread-with-proto-babel-7/input.js
|
||||
* react/optimisation.react.constant-elements/input.js
|
||||
* react/should-add-quotes-es3/input.js
|
||||
* react/should-allow-jsx-docs-comment-with-pragma/input.js
|
||||
* react/should-disallow-spread-children/input.js
|
||||
* react/should-disallow-valueless-key/input.js
|
||||
* react/should-disallow-xml-namespacing/input.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue