diff --git a/src/comments.js b/src/comments.js index b1894373..2a938d3b 100644 --- a/src/comments.js +++ b/src/comments.js @@ -168,8 +168,8 @@ function attach(comments, ast, text) { } else if (enclosingNode) { addDanglingComment(enclosingNode, comment); } else { - // TODO: If there are no nodes at all, we should still somehow - // print the comment. + // There are no nodes, let's attach it to the root of the ast + addDanglingComment(ast, comment); } } else { // Otherwise, text exists both before and after the comment on @@ -193,8 +193,8 @@ function attach(comments, ast, text) { } else if (enclosingNode) { addDanglingComment(enclosingNode, comment); } else { - // TODO: If there are no nodes at all, we should still somehow - // print the comment. + // There are no nodes, let's attach it to the root of the ast + addDanglingComment(ast, comment); } } });