Registry / devops / prettier-plugin-pkgjson

prettier-plugin-pkgjson

JSON →
library0.3.0jsnpmunverified

Prettier plugin for clean and meaningful formatting of package.json files. Version 0.3.0 is the latest stable release. It sorts keys in a logical order, formats JSON consistently, and integrates seamlessly with Prettier. No dependencies. Actively maintained as part of the tunnckoCore opensource monorepo.

npm install prettier-plugin-pkgjson
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-PK
P
prettier-plugin-pkgjson
devopsjavascriptv0.3.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

default (plugin)
✓ // In .prettierrc: { "plugins": ["prettier-plugin-pkgjson"] }
✗ // No import needed; Prettier discovers it automatically
Plugin is auto-loaded by Prettier when listed in plugins array. No explicit import in code.

Example .prettierrc configuration to enable the plugin and format package.json files.

{ "semi": false, "singleQuote": true, "tabWidth": 2, "trailingComma": "none", "plugins": ["prettier-plugin-pkgjson"] }
Debug
Known issues
gotchaPlugin requires Prettier v2.x or later; not compatible with Prettier v1.x.
fix
Update Prettier to >=2.0.0.
affects: >=0.1.0
gotchaOnly works on package.json files; other JSON files are unaffected.
fix
Use only for package.json; for other JSON files use other plugins.
affects: >=0.1.0
gotchaPlugin must be explicitly added to Prettier's plugins array; not auto-detected.
fix
Add "prettier-plugin-pkgjson" to plugins array in Prettier config.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-pkgjson'
Plugin not installed or not in node_modules.
fix
Run npm install prettier-plugin-pkgjson --save-dev
Invalid option for rule 'prettier/prettier': Expected a string but received an object
Misconfiguring ESLint with prettier-plugin-pkgjson.
fix
Ensure prettier-plugin-pkgjson is listed in .prettierrc plugins array, not in ESLint config.
Error: Package subpath './package.json' is not defined by "exports" in .../prettier-plugin-pkgjson/package.json
Using older Node.js (<12) or misconfigured imports.
fix
Use Node.js >=10.13; if issue persists, check that Prettier resolves the plugin correctly.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-pkgjson — npm install prettier-plugin-pkgjson · libregistry