by tomp · 9y ago · 0 comments
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.There are a very few subtle bugs like the one you mentioned above. As noted in the readme, this is a beta. It's certainly more than an attempt.
function doSomething() : int {
return myPromise
.then(() => {
// ...do thing
/* what */
})
.catch(() => {
// ..do other thing
/* the heck */
});
}
becomes function doSomething(): int {
return myPromise
.then(() => {})
.catch(() => {});
}
Still a very nice pretty printer, though. JSX is<strong>supported</strong>
Note the lack of space after the word "is".This will add semicolons all over your code depending on some rules, for example, if you write a return, and write the value you want to return in the next line, it adds a semicolon after the return AND after the value, effectively ignoring the value in the end.
return
myValue;
becomes return;
myValue;
It's a bit meh, because you have to remember these rules even if you use semicolons.