Open glebcha opened 5 years ago
This works:
return j(file.source).find(j.Comment).forEach(path => path.prune()).toSource();
I was hoping that j(file.source).find(j.Comment).remove().toSource();
but it looks like remove
is only defined for Node
s and a comment is not a Node
. Maybe we can make it work though.
This works:
return j(file.source).find(j.Comment).forEach(path => path.prune()).toSource();
Sorry, but with flow parser it became invalid line like
export type type Notice = {}
If this is still an issue for you, could you provide a concrete flow example for which this breaks?
@fkling
This works:
return j(file.source).find(j.Comment).forEach(path => path.prune()).toSource();
I was hoping that
j(file.source).find(j.Comment).remove().toSource();
but it looks likeremove
is only defined forNode
s and a comment is not aNode
. Maybe we can make it work though.
Although, it is working fine, but there is TS error: Argument of type Type<Comment> is not assignable to parameter of type Type<ASTNode>
, and the interesting moment is when instead of j.Comment I try to use j.CommentBlock/j.CommentLine it doesnt remove comments.
Now I have to iterate comment nodes and modify values, but comment's signature is staying untouched. In:
Modification:
Out:
Expected: