Menu
New tool forces JavaScript code correctness

New tool forces JavaScript code correctness

The Prettier formatting tool ensures outputted JavaScript conforms to a consistent style

With a tool called Prettier, JavaScript formatting will get a consistent style.

An opinionated JavaScript formatter inspired by the refmt tool for formatting code, Prettier removes original styling and ensures outputted JavaScript conforms to a consistent style.

"Prettier gets rid of all original styling and guarantees consistency by parsing JavaScript into an AST (abstract syntax tree) and pretty-printing the AST," developer James Long said. He noted that the tool makes it easier to write code however a developer wants because it can be instantly formatted correctly afterward.

Prettier takes JavaScript as input and outputs formatted JavaScript. Still in beta, Prettier tries to support all JavaScript language features, including those that are not standardized. It uses the Babylon parser by default with all language features enabled, but it will also work with the Facebook Flow parser with the useFlowParser API or --flow-parser CLI option. Prettier has advanced support for language features from ECMAScript 2017, JSX, and Flow.

Subscribe here for up-to-date channel news

Follow Us

Join the ARN newsletter!

Error: Please check your email address.
Show Comments