Skip to content
Edit this page View source of this page

Migrating from Prettier

Import the YAML settings first (a successful import exits 0; inspect warnings):

ryl --migrate-configs --migrate-from prettier --migrate-stdout
ryl --migrate-configs --migrate-from prettier --migrate-write

Follow After migrating to verify formatting, convert comments and update CI, or use the manual profile below.

For YAML files, run ryl format . to write changes and ryl format --check . in CI. Keep Prettier for other file types. The settings below follow Prettier 3.9.10's YAML output on the same inputs used with ryl format -. Prettier's general options can alter the starting profile.

The config importer applies supported YAML-only overrides in source order and imports .prettierignore, including negations. Unsupported override scopes still warn; inspect the generated configuration before replacing Prettier.

ryl defaults to indent width 2. Set top-level indent-width explicitly to keep another width.

Manual configuration

# .ryl.toml
indent-width = 2

[format]
quote-style = "double"
brace-spacing = true
comment-spacing = 1
max-blank-lines = 1
sequence-expand = "auto"
mapping-expand = "auto"
property-order = "tag-first"

brace-spacing = true produces { a: 1 } while leaving {} tight. comment-spacing = 1 matches inline comments; max-blank-lines = 1 matches the tested collapse of a longer blank run. Both tools indent nested sequences by two spaces and write LF in the tested profile.

Option mapping

Prettier option (default) ryl equivalent
tabWidth: 2 top-level indent-width = 2
singleQuote: false [format] quote-style = "double"; see quotes
bracketSpacing: true [format] brace-spacing = true
endOfLine: "lf" [format] line-ending = "lf" (default)
printWidth: 80 top-level line-length = 80 plus [format] fold-long-lines = true is only an approximation; see long lines

Deliberate differences

Quotes

Prettier keeps the quotes around "hello"; ryl removes them when the scalar can be plain, even with quote-style = "double". The setting chooses double quotes only for strings that still need quoting. Use quote-style = "preserve" if retaining existing quotes matters more than normalizing their style.

Long lines

Prettier expands a long flow sequence into multiple lines at its print width. ryl preserves the flow sequence by default; sequence-expand = "auto" and mapping-expand = "auto" write Prettier's layout instead, including its move of a value that fits alone on the line after its key and its key: [ form for a collection followed by a comment. Two things differ. ryl keeps that comment on the [ line, where Prettier puts it after the ], so the comment stays beside the data it followed. And the columns follow ryl's indentation rule: in a sequence entry (- [) and before a trailing comment, entries sit two past the start of the line rather than past the [ or the key, and the ] one past it. fold-long-lines = true folds eligible scalar text at line-length, and may fold scalars that Prettier keeps on one line.

Layout and markers

Prettier reprints the document. ryl retains existing --- and ... markers, flow or block collection style, comments, and anchors unless a safe formatting pass changes them. Prettier also retains markers in the tested input, but the two formatters may choose different whitespace around the same YAML value.