Nice attempt, but currently wrong. For example, it pretty-formats this code:
function makeComponent() {
return /*test*/ { a: 1
};
}
into function makeComponent() {
return /*test*/
{ a: 1 };
}
From my own experience writing a formatter, comments are very difficult (if one wants to preserve them). I guess the author should reparse the generated code to ensure the AST hasn't changed.