Reading code you did not write
The common case is a bundle: one line, thousands of characters, no way to see where a function begins. Formatting gives you back the structure — nesting, branches, loop bodies — which is enough to follow what a script is doing to your page.
What it cannot give back is naming. Minification is one-way for identifiers: the
original names are not in the file. Expect to read a, b and n and to work
out meaning from context.
Why a real parser
Formatting by inserting newlines after semicolons and braces breaks on the first string containing a brace, the first regular expression containing a quote, and every template literal. Prettier parses to a syntax tree and prints from that, so those cases are structurally impossible to get wrong.
Consistency over preference
The value of a formatter is not that its style is best; it is that it is the same every time. Diffs show changed logic instead of re-wrapped lines, and code review stops spending time on where the brace goes.
Questions
Can I read minified code with this?+
Formatting restores the structure — indentation, line breaks, block boundaries — so control flow becomes visible. It cannot restore names: a minifier renamed your variables to a, b, c and that information is gone. You get readable shape, not readable meaning.
Does formatting ever change behaviour?+
Prettier reprints the parsed syntax tree, so semantics are preserved. The one thing to know is automatic semicolon insertion: code that relied on it is parsed the way the engine parses it, then printed with explicit semicolons. The behaviour is the same, the text is clearer.
Does it support JSX and modern syntax?+
Yes — the babel parser handles JSX, optional chaining, nullish coalescing, class fields, top-level await and decorators.
It says it cannot parse my code.+
Then it is not valid JavaScript as written. TypeScript annotations are the usual cause here, as is a fragment cut out of the middle of a file. A formatter refusing to guess is the correct behaviour — guessing produces code that looks right and is not.