@essence-lang/formatter
v0.2.0
Published
esfmt — the Essence source formatter.
Maintainers
Readme
@essence-lang/formatter
esfmt — the source formatter for the
Essence programming language.
Command line
esfmt File.es # format in place
esfmt --check 'src/*.es' # exit non-zero if anything would change
cat File.es | esfmt --stdin # read stdin, write the result to stdoutessence format runs the same formatter from the main CLI. Style is not
configurable: tabs, a width of 80, and the rules the standard library itself
is written in.
API
import { format } from "@essence-lang/formatter"
let result = format(sourceText, { documentPath: "File.es" })
result.text // the formatted source
result.changed // whether it differs from the input
result.refusal // null, or why the formatter would not touch the fileA refusal is the safety gate speaking: the formatter re-parses its own output and compares comment anchors, and if reprinting would change what the file means, it declines and says so rather than writing.
