Skip to content

Repository files navigation

@cldmv/prettier-plugin-jsonv

npm version npm downloads GitHub downloads Last commit npm last update

Contributors Sponsor shinrai

A Prettier plugin for formatting JSONV files.

✨ What's New

Latest: v1.1.4 (October 2026)

  • Header tooling on fix-headers 2.2.0 — the @cldmv/fix-headers dev dependency moves to 2.2.0, so @Last modified by follows content edits only, and @cldmv/configs moves to 1.2.4, which turns off the forced author updates. The header pass was re-run and every file already matched, so nothing was restamped. No plugin code, published file or runtime dependency changed (#51, #54).
  • View full v1.1.4 Changelog

Recent Releases

  • v1.1.3 (October 2026) — the CI ✅ Required PR Check mirror job runs on every path instead of being skipped on in-repo PRs (#49) (Changelog)
  • v1.1.2 (October 2026) — dev-dependency bumps, including @cldmv/vitest-runner 1.5.1 and @cldmv/jsonv 1.1.1 in development (#46, #47) (Changelog)
  • v1.1.1 (October 2026) — uniform file headers from the shared CLDMV fix-headers config, and a skipped PR run no longer satisfies Required PR Check (#44, #45) (Changelog)
  • v1.1.0 (September 2026) — lossless printing from @cldmv/jsonv's source AST (fixing key, comment and number corruption), trailingComma support and a typed plugin (#26, #31, #32) (Changelog)

📚 For complete version history, see docs/changelog/ and the GitHub Releases.

Features

  • Formats .jsonv files 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

Add the plugin to your Prettier configuration:

Using .prettierrc.mjs or prettier.config.mjs:

import jsonv from "prettier-plugin-jsonv";

export default {
	plugins: [jsonv],
	overrides: [
		{
			files: "*.jsonv",
			options: {
				jsonvYear: 2025,
				strictBigInt: false
			}
		}
	]
};

Using .prettierrc or prettier.config.js:

module.exports = {
	plugins: ["prettier-plugin-jsonv"],
	overrides: [
		{
			files: "*.jsonv",
			options: {
				jsonvYear: 2025,
				strictBigInt: false
			}
		}
	]
};

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.

License

GitHub license npm license

Apache-2.0 © Shinrai / CLDMV

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages