--- title: Prettier's style, at native speed summary: tidy is a code formatter written in Rust. One binary prints what Prettier prints, for JavaScript, TypeScript, HTML, CSS, Markdown, YAML, JSON, TOML and more. --- {{#var bench = $data.bench}} {{#var claims = [ [ "Matches Prettier", "Every release is checked against Prettier " + $data.release.prettier + " over a 12,000-file corpus: 100% of 3,906 JavaScript files and 3,308 of 3,309 TypeScript files.", ], [ "Formats the code inside your code", "Styles and scripts in HTML and Vue. Markdown code blocks and front matter. CSS, GraphQL, HTML and Markdown in JS template literals.", ], [ "Configurable, if you need it", "Reads tidy.json, tidy.jsonc or tidy.toml, on top of .editorconfig. The defaults are Prettier’s.", ], [ "Stable output", "Where Prettier would change its mind on the next run, tidy prints where it settles, so tidy check stays green in CI.", ], ]}} {{#var langs = [ ["JavaScript, TypeScript, JSX", "Prettier"], ["HTML, Vue, Handlebars, MJML", "Prettier"], ["CSS, SCSS, Less", "Prettier"], ["JSON, JSONC, JSON5", "Prettier"], ["YAML, GraphQL, Markdown", "Prettier"], ["XML, SVG", "@prettier/plugin-xml"], ["TOML", "taplo"], ["Dockerfiles", "dprint-plugin-dockerfile"], ["INI, .editorconfig, .npmrc", "prettier-plugin-ini"], ]}}

00

Prettier's style, at native speed.

tidy is a code formatter written in Rust. One binary prints what Prettier prints, for every language below. It does not shell out to Node — though there is a Node binding if you want one.

~/project
$curl -fsSL https://tidy.lukeed.com | sh

or build it with cargo — every way to install

01 / Speed

18.5s → 280msA {{ $utils.num(bench.total.files) }}-file corpus of every language, checked end to end.
{{#each bench.featured as row}}
{{ row.corpus }}{{ $utils.num(row.files) }} files
{{#each $utils.bars(row) as bar}}
{{ bar.who }} {{#if bar.off}}{{ bar.times }}× slower{{/if}} {{ $utils.ms(bar.ms) }}
{{/each}}
{{/each}}

{{ bench.machine }}, all cores, mean of both run orders. Bars compare the three native tools; Prettier is off that scale. every corpus and the method →

02 / Output

Byte for byte what Prettier prints

Not a lookalike style. tidy's tests run Prettier over the same corpus and compare the bytes, so a difference is a bug — unless it is one of the documented deviations.

routes.tsas written

{{{ $data.sample.input }}}

routes.tstidy up

{{{ $data.sample.output }}}

03 / Why

{{#each claims as claim}}
{{ claim[0] }}

{{{ claim[1] }}}

{{/each}}

04 / Languages

Every language Prettier formats

Plus the ones its plugins cover, built into the same binary. Nothing to install, nothing to register.

    {{#each langs as lang}}
  • {{ lang[0] }}{{ lang[1] }}
  • {{/each}}

05 / Config

Configurable, if you need it

Each file takes the nearest tidy.json, tidy.jsonc or tidy.toml, on top of .editorconfig. Shared keys apply everywhere, and a language section overrides them. See every option.

tidy.json
{{{ $data.sample.config }}}

Then run it:

Shell
{{{ $data.sample.usage }}}