A Prettier plugin for formatting JSONV files.
- CI configuration only, no package changes —
dependabot.ymltakes the CLDMV/.github v4.47.0 groups, so the CLDMV dev tools arrive in one Dependabot PR (#111). The published package is the same as v1.2.3. - View full v1.2.4 Changelog
- v1.2.3 (November 2026) — the CommonJS entry is the generic CLDMV shim, with
require()unchanged; the suite also runs againstdist/; CI cancels superseded runs; dev toolchain on@cldmv/vitest-runner1.11.3 (Changelog) - v1.2.2 (November 2026) — tooling release: tests run against
src/through theprettier-plugin-jsonv-devcondition viadevCondition(), and the type scripts are split intotypes:checkandtypes:build; formatting unchanged (Changelog) - 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)
📚 For complete version history, see docs/changelog/ and the GitHub Releases.
- 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
npm install --save-dev @cldmv/prettier-plugin-jsonv prettier @cldmv/jsonvThe 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).
import jsonv from "@cldmv/prettier-plugin-jsonv";
export default {
plugins: [jsonv],
overrides: [
{
files: "*.jsonv",
options: {
jsonvYear: 2025,
strictBigInt: false
}
}
]
};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"].
| 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 |
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.
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. npm run test:dist builds and runs the Vitest suite against dist/ instead.
Apache-2.0 © Shinrai / CLDMV