tidy's options are Prettier's options. That is the whole policy, and it decides every question about adding one.
The rule
An option exists in tidy if and only if Prettier has it, or a plugin tidy absorbed has it.
That gives three groups:
- Prettier's own options, under their own names:
widthforprintWidth,quoteforsingleQuote, and so on. See Options for the mapping. - The options of plugins tidy built in.
toml.*is taplo's set,dockerfile.*is dprint-plugin-dockerfile's,xml.*is@prettier/plugin-xml's,ini.spaceAroundEqualsisprettier-plugin-ini's. They keep their own names, under their language. markdown.*. Prettier has one Markdown option; tidy has nine. This is the one real departure, and it exists because Prettier's Markdown printer normalises markers with no way to opt out.markdown.preset: "preserve"keeps them as written. The default,"prettier", is Prettier's behaviour exactly.
Why not more
Prettier's option philosophy argues that a formatter with many options is a formatter you argue about. tidy inherits that argument, plus one of its own: every option is a branch in the printer, and every branch is a place where tidy and Prettier can drift apart. The test suite compares tidy against Prettier over a corpus; an option Prettier does not have is an output no test can check.
So tidy will not grow an option for a style Prettier does not support. If you want that style, the place to ask is Prettier.
Defaults
Every default is Prettier's default, with two exceptions, both visible and both reversible:
- JSDoc comments are formatted, as
prettier-plugin-jsdocdoes. Turn it off with"js": { "jsdoc": false }. - Imports are not sorted. Turn it on with
js.sortImports, or by listing a sorting plugin injs.plugins. See Options.
Anything else that differs from Prettier's output is a bug or a listed deviation, not a default.
On --width
The width is 80, and 120 for Dockerfiles, because those are Prettier's and dprint's. It is not a hard limit: it is the width the printer tries to fit lines into. Long strings, long identifiers and some comments will exceed it, exactly as they do in Prettier.