Categories
Code Quality JavaScript Tools

Prettier: Ending Code Style Debates by Removing Choices

Prettier is spreading through JavaScript projects rapidly. It's a code formatter that automatically formats your code and gives you almost no configuration options. This sounds terrible—who wants a tool that doesn't respect their preferences? But in practice, teams love it because it ends code style arguments forever.

What Prettier Does

Prettier takes your JavaScript (and CSS, HTML, Markdown, etc.) and rewrites it according to its own style rules. You save a file, Prettier reformats it. No arguments, no configuration, no debates.

// Before
function foo(x,y,z){return x+y+z;}

// After
function foo(x, y, z) {
  return x + y + z;
}

It handles: