prettier-plugin-nix-js
v1.1.0
Published
Prettier plugin for Nix.js html`` tagged templates
Maintainers
Readme
prettier-plugin-nix-js
Prettier plugin for Nix.js html\`` tagged templates.
Formats the HTML content inside html\`tagged template literals in JS/TS files.
Works withprettier --write` in CLI, CI, pre-commit hooks, and any editor with
Prettier integration.
Install
npm install -D prettier prettier-plugin-nix-jsUsage
// .prettierrc
{
"plugins": ["prettier-plugin-nix-js"],
"tabWidth": 2
}# Format all files
npx prettier --write "src/**/*.{ts,tsx}"
# Check in CI
npx prettier --check "src/**/*.{ts,tsx}"Formatting rules
- Void elements (
br,img,input, etc.): self-closing<br /> - Inline elements (
span,a,strong, etc.): kept on one line when short - Block elements (
div,p,ul, etc.): indented on separate lines - Attributes: 0-1 attrs inline, 2 attrs inline if ≤80 chars, 3+ attrs multi-line
- Expressions (
${...}): inline if simple, block-level if function call / arrow / multiline - Pre elements (
pre,script,style,textarea): content preserved verbatim - Event bindings (
@click.prevent.stop): modifiers preserved as-is
Development
npm install
npm run typecheck
npm test
npm run buildLicense
MIT
