We are your Digital Ally™
Code formatters battle – who is nicer?
tech

Code formatters battle – who is nicer?

A head-to-head comparison of Prettier and StandardJS — two popular JavaScript code formatters — to help your team stop arguing about style and focus on functionality.

Stanislav MiklikSeptember 8, 2017

Why Do I Need One?

Every programmer has their own coding style. While it's polite to honor the style of a file you're editing, starting new files often involves applying personal conventions. Code copying from external sources, colleague preferences, and team indentation rules create formatting inconsistencies. Most teams establish common conventions (semicolons, spacing, etc.), but manual adherence is inefficient.

It is really not that important to have the best possible coding style (as nothing like that will ever exist). Using a formatter allows teams to focus on functionality rather than style debates.

Contestants

The comparison examined two prominent JavaScript formatters: Prettier and StandardJS.

StandardJS enforces strict, non-configurable rules, preventing colleague disputes and offering maturity. However, it occasionally struggles with edge cases.

Prettier permits customization (single quotes, semicolons, etc.), supports multiple file types (JavaScript, CSS, inline styles, GraphQL), and offers more comprehensive formatting rules.

npm download trends favor Prettier.

Fight!

Spacing

Input:

const obj = { a: 0, b: 1, c: 2, d: 3}

StandardJS:

const obj = { a: 0, b: 1, c: 2, d: 3}

Prettier:

const obj = { a: 0, b: 1, c: 2, d: 3 };

StandardJS partially addressed spacing inconsistencies but remained unsuccessful. Prettier consistently fixed all spacing issues.

Long Lines

Input:

console.log('very long text', 'anddd even longer texttttt', 'hahahahahahahahahahah')

StandardJS: No change or warning.

Prettier:

console.log(
  "very long text",
  "anddd even longer texttttt",
  "hahahahahahahahahahah"
);

StandardJS ignores line length entirely. Prettier offers two modes: fit arguments on one line or place one per line. Conversely, Prettier joins arguments fitting on one line — maintaining consistency throughout codebases, though some prefer coder discretion regarding line length.

Conclusion

Prettier emerged as the superior choice. It handles diverse file types, performs faster, and produces cleaner code. While disagreements about specific decisions occur, the trade-off enables focusing on functionality rather than formatting.

Implementation approaches include save-on-format or pre-commit hooks.

© 2026