@cldmv/prettier-plugin-jsonv
A Prettier plugin for formatting JSONV files.
✨ What's New
Latest: v1.2.2 (November 2026)
- Tooling release, no plugin changes — the vitest config now uses
devCondition()from@cldmv/configs, so tests really run againstsrc/through theprettier-plugin-jsonv-devexport condition, and the type scripts are split intotypes:checkandtypes:build(#91, #93). Formatting is unchanged. - View full v1.2.2 Changelog
Recent Releases
- v1.2.1 (November 2026) —
engines.nodeback to>=18.0.0; the 22.22.0 development floor moves todevEngines(#88) (Changelog) - v1.2.0 (November 2026) — CommonJS entry, tsup build and a
prettier-plugin-jsonv-devexport condition;engines.noderaised to>=22.22.0; formatting unchanged (#84, #85) (Changelog) - v1.1.4 (October 2026) — dev tooling on
@cldmv/fix-headers2.2.0 and@cldmv/configs1.2.4; no file was restamped and no runtime change (#51, #54) (Changelog) - v1.1.3 (October 2026) — the CI
✅ Required PR Checkmirror job runs on every path instead of being skipped on in-repo PRs (#49) (Changelog)
📚 For complete version history, see docs/changelog/ and the GitHub Releases.
Features
- Formats
.jsonvfiles using the @cldmv/jsonv parser - Supports all ES2015-2025 features (JSON5, binary/octal literals, BigInt, numeric separators, etc.)
- Configurable year-based feature detection
- Proper handling of comments and whitespace
- Integrates with Prettier's configuration system
Installation
npm install --save-dev @cldmv/prettier-plugin-jsonv prettier @cldmv/jsonv
Usage
The plugin needs Node.js 18.0.0 or later and Prettier 3. It ships an ES module entry and a CommonJS entry, so it loads from either kind of Prettier config; require() needs Node.js ^20.19.0 or >=22.13.0.
Developing this package needs Node.js 22.22.0 or later (devEngines).
Using .prettierrc.mjs or prettier.config.mjs:
import jsonv from "@cldmv/prettier-plugin-jsonv";
export default {
plugins: [jsonv],
overrides: [
{
files: "*.jsonv",
options: {
jsonvYear: 2025,
strictBigInt: false
}
}
]
};
Using .prettierrc.cjs or prettier.config.cjs:
module.exports = {
plugins: [require("@cldmv/prettier-plugin-jsonv")],
overrides: [
{
files: "*.jsonv",
options: {
jsonvYear: 2025,
strictBigInt: false
}
}
]
};
require("@cldmv/prettier-plugin-jsonv") returns the plugin object itself. In a JSON .prettierrc, list the plugin by name instead: "plugins": ["@cldmv/prettier-plugin-jsonv"].
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
jsonvYear | number | 2025 | The year to use for JSONV features (2015-2025) |
strictBigInt | boolean | false | Whether to enforce strict BigInt parsing |
Trailing commas
The plugin honours Prettier's trailingComma option the way Prettier's JavaScript printer does for object and array literals:
"all"(Prettier's default) and"es5"put a comma after the last entry of every object or array that breaks across lines. Non-empty objects and arrays are always printed one entry per line, so only empty ones ({ },[]) are printed on a single line, and they never get a comma."none"never adds one.
Trailing commas already in the source are not kept as written: the option normalizes them, adding or removing the comma after the last entry. Every jsonv year (2011-2025) allows trailing commas, so the comma never makes a document invalid, and it never changes the parsed value. Comments next to the last entry stay in place: a: 1, // note keeps the comment after the comma, a: 1 /* note */, keeps it before.
Development
The published package contains only the built dist/ (dist/index.mjs, and dist/index.cjs for require()) plus the generated types/. In a checkout, the prettier-plugin-jsonv-dev export condition points the package at src/ instead:
| Run | Loads |
|---|---|
node app.mjs | dist/index.mjs (run npm run build first) |
node --conditions=prettier-plugin-jsonv-dev app.mjs | src/index.mjs |
require() with --conditions=prettier-plugin-jsonv-dev | src/index.cjs, which loads src/index.mjs |
Set it once per shell with export NODE_OPTIONS=--conditions=prettier-plugin-jsonv-dev. npm test runs the Vitest suite against src/ with the condition, then builds and checks the CommonJS entry in dist/ with node --test.
License
Apache-2.0 © Shinrai / CLDMV