Liquidsoap Prettier

raw JSON →
1.8.3 verified Sat Apr 25 auth: no javascript

A Prettier plugin and CLI tool for formatting Liquidsoap scripts (`.liq` files). Current stable version is 1.8.3. The package provides both a command-line utility for direct formatting and a Prettier plugin that integrates into existing workflows. It uses a JSON parser exported via js_of_ocaml from the Liquidsoap codebase. Regularly updated to match Liquidsoap language changes.

error Error: Cannot find module 'liquidsoap-prettier'
cause Package not installed or not in node_modules.
fix
Run npm install -D liquidsoap-prettier in your project.
error SyntaxError: Unexpected token '#'
cause Liquidsoap parser cannot parse file with unsupported syntax.
fix
Ensure the Liquidsoap version matches the parser version; update parser via npm run dev:prepare.
error Error: Package subpath './package.json' is not defined by "exports"
cause Using an outdated Node version or incorrect import path.
fix
Use Node >=14 and import from 'liquidsoap-prettier' only.
gotcha The package does not bundle the Liquidsoap parser; must run `npm run dev:prepare` or have opam installed for parser updates.
fix Run `npm run dev:prepare` or install Liquidsoap via opam.
deprecated Using require() to import the plugin is deprecated in favor of ESM imports.
fix Use ESM import syntax or configure Prettier to handle ESM.
breaking Plugin API changed; old import paths no longer work.
fix Update to v1.0+ and use proper plugin registration in .prettierrc.
npm install liquidsoap-prettier
yarn add liquidsoap-prettier
pnpm add liquidsoap-prettier

Installation and basic usage of liquidsoap-prettier as both a Prettier plugin and standalone CLI.

// Install dependencies
npm install -D prettier liquidsoap-prettier

// Create a .prettierrc file with:
{
  "plugins": ["liquidsoap-prettier"]
}

// Run Prettier on a Liquidsoap file
npx prettier --write path/to/file.liq

// Alternatively, use the CLI directly
npx liquidsoap-prettier -w path/to/file.liq

// Check formatting (CI)
npx liquidsoap-prettier -c path/to/file.liq