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.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Brand Post

How to become the best IT MSP

This article provides guidance for managed service providers (MSPs) that want to grow their business. It is also useful for any IT service provider looking to move from the break-fix model to managed IT services.

Show Comments