Comment

Comment by tomp

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.
parent tomp 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton