Registry / devops / prettier-plugin-package-perfection

prettier-plugin-package-perfection

JSON →
library1.1.0jsnpmunverified

A Prettier plugin that formats package.json files using the prettier-package-json library for consistent ordering and styling. Version 1.1.0 is the latest stable version, released August 2022 with limited update activity. It requires Prettier ≥2.x and Node.js ≥14.18.0. Differentiators include automatic key sorting, customizable order via options, and seamless integration with Prettier workflows, unlike standalone formatters.

npm install prettier-plugin-package-perfection
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-PA
P
prettier-plugin-package-perfection
devopsjavascriptv1.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
No explicit import needed; Prettier auto-loads plugins
None
This is a Prettier plugin; you do not import it directly in your code. Install it and add to Prettier config.
options
// .prettierrc { "plugins": ["prettier-plugin-package-perfection"] }
{"plugins": ["prettier-plugin-package-perfection"] }
Ensure plugin is listed in the 'plugins' array of your Prettier configuration file.
types
import type { PackagePerfectionOptions } from 'prettier-plugin-package-perfection'
const { PackagePerfectionOptions } = require('prettier-plugin-package-perfection')
TypeScript types are bundled; import type for option interfaces.

Install the plugin, configure it in .prettierrc, and format your package.json with Prettier.

// Install dependencies // npm install --save-dev prettier prettier-plugin-package-perfection // .prettierrc (JSON) { "plugins": ["prettier-plugin-package-perfection"], "packagePerfection": { "sortAz": true, "sortScripts": false } } // Run Prettier on package.json // npx prettier --write package.json
Debug
Known issues
breakingRequires Node.js >=14.18.0; older versions will fail to load the plugin.
fix
Update Node.js to >=14.18.0.
affects: <1.0.0
deprecatedPlugin uses prettier-package-json v2 which may deprecate some options; refer to their docs.
fix
Check prettier-package-json documentation for option changes.
affects: >=1.0.0
gotchaThe plugin only runs on files named 'package.json'. Other files matching the pattern will not be affected.
fix
Ensure your target file is exactly named 'package.json'.
affects: >=1.0.0
gotchaSome custom Prettier config formats (e.g., YAML) may not parse the plugin correctly; stick to JSON or JS config.
fix
Use JSON or JavaScript Prettier configuration files.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-package-perfection'
Plugin not installed or not in node_modules.
fix
Run 'npm install --save-dev prettier-plugin-package-perfection' and ensure it's in devDependencies.
Error: Invalid plugin configuration: 'packagePerfection' option not recognized
Plugin not added to Prettier's plugins array.
fix
Add '"plugins": ["prettier-plugin-package-perfection"]' to your .prettierrc file.
Error: Unknown option 'packagePerfection.sortAz'
Option name typo or not supported in this version.
fix
Check the plugin's README for supported options; correct spelling.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
prettierrequiredPeer dependency required for the plugin to function.
prettier-package-jsonrequiredCore library used to format the package.json content.
Agent activity
2 hits · last 30 days
node
2
Resources
prettier-plugin-package-perfection — npm install prettier-plugin-package-perfection · libregistry