@matthesketh/prettier-plugin-utopia
v0.8.2
Published
Prettier plugin for .utopia single-file components
Maintainers
Readme
@matthesketh/prettier-plugin-utopia
A Prettier plugin for UtopiaJS .utopia single-file components.
The plugin splits a component into its top-level blocks and hands each block's body to Prettier's own well-tested formatter:
<template>→ thehtmlformatter (directives such as:bind,@on,u-forand{{ }}interpolations are preserved verbatim);<script>/<test>→ thetypescriptformatter;<style>→css, orscss/lesswhenlangsays so.
Blocks are kept in source order, separated by a blank line. Formatting is idempotent, and a block Prettier cannot parse is left untouched (only re-indented) rather than failing the whole file.
Install
pnpm add -D prettier @matthesketh/prettier-plugin-utopiaprettier (>= 3) is a peer dependency.
Usage
// .prettierrc
{
"plugins": ["@matthesketh/prettier-plugin-utopia"]
}Then prettier --write '**/*.utopia'.
