-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: commentsarea: flowoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
Current Behavior
@babel/plugin-transform-flow-comments change order of comments at beginning of file when the file starts with a comment followed by a flow statement
/*:: import type {A} from 'a';*/
/**/
X;Input Code
REPL link
/**/
import type {A} from 'a';
XExpected behavior/code
/**/
/*:: import type {A} from 'a';*/
X;Environment
- Babel version(s): v7.5.5
- How you are using Babel: Online REPL
Possible Solution
//...
function attachComment(path, comment) {
let attach = path.getPrevSibling();
let where = "trailing";
if (!attach.node) {
attach = path.getNextSibling();
where = "leading";
}
if (!attach.node) {
attach = path.parentPath;
where = "inner";
}
attach.addComment(where, comment);
path.remove();
}
//...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: commentsarea: flowoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue