Registry / devops / purs-tidy

purs-tidy

JSON →
library0.11.1jsnpmunverified

A syntax formatter for PureScript, version 0.11.1. It formats PureScript source code in place or via STDIN/STDOUT, and supports checking if files are already formatted (useful for CI). It is the primary formatter for the PureScript ecosystem, offering configurable indentation, arrow style, and operator precedence via a pre-baked table or custom generation. Editor integrations for Spacemacs, Vim, and VS Code are available. Releases are stable with a maintenance focus.

npm install purs-tidy
INSTALL
IMPORT
SIG · PURS-TIDY
P
purs-tidy
devopsjavascriptv0.11.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

format
✓ import { format } from 'purs-tidy'
✗ const format = require('purs-tidy')
purs-tidy is primarily a CLI tool; the programmatic API is not officially documented and may change. Use the CLI directly for reliability.
check
✓ import { check } from 'purs-tidy'
✗ const check = require('purs-tidy').check
Same as format; programmatic API is experimental.
formatInPlace
✓ import { formatInPlace } from 'purs-tidy'
✗ const formatInPlace = require('purs-tidy').formatInPlace
Same as above.

Installs purs-tidy globally, creates a simple PureScript file, and formats it via STDIN.

npm install -g purs-tidy && echo "module Main where\nmain = do\n log \"Hello, World!\"" > MyFile.purs && purs-tidy format < MyFile.purs
Debug
Known issues
gotchapurs-tidy uses a pre-baked operator precedence table that may not match local operator definitions. Use the generate-operators command to create a project-specific table.
fix
Run `spago sources | xargs purs-tidy generate-operators > .tidyoperators` and configure with --operators .tidyoperators.
affects: >=0.1.0
gotchaThe programmatic API (import { format } from 'purs-tidy') is not officially supported and may break without notice. Prefer CLI usage.
fix
Use the CLI via child_process.exec or similar instead of direct imports.
affects: >=0.1.0
deprecatedThe `--arrow-last` option is deprecated in favor of `--arrow-first` (which is the default).
fix
Do not use --arrow-last; instead remove it or use --arrow-first.
affects: >=0.10.0
gotchaFormatting with `format-in-place` modifies files directly without creating backups. Ensure version control or backups are in place.
fix
Use version control (git) before running `purs-tidy format-in-place`.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'purs-tidy'
purs-tidy is not installed globally or locally.
fix
Run: npm install -g purs-tidy
purs-tidy: command not found
Global npm bin directory is not in PATH.
fix
Add `$(npm root -g)/bin` to your PATH or install locally with npx.
purs-tidy: unrecognized option '--arrow-last'
The --arrow-last option was removed in a newer version.
fix
Use --arrow-first or omit the option (default is arrow-first).
Upgrade
Version history
0.11.1latest on npm
Audit
Dependencies
pursoptionalRequired to compile the PureScript source after formatting; purs-tidy itself is a formatting tool that expects valid PureScript syntax.
Agent activity
4 hits · last 30 days
node
4
Resources
purs-tidy — npm install purs-tidy · libregistry