/prettier-plugin-package-json

A `prettier` plugin to make `package.json` prettier

Primary LanguageJavaScriptMIT LicenseMIT

@nice-move/prettier-plugin-package-json

A prettier plugin to make package.json prettier.

npm github node

Read about npm-package.json.

Installation

npm install prettier @nice-move/prettier-plugin-package-json --save-dev

Usage

// .prettierrc.json
{
  "overrides": [
    {
      "files": "package.json",
      "options": {
        "parser": "package-json"
      }
    }
  ]
}
prettier --write **/package.json

Feature

  • Normalize by normalize-package-data and normalize-package-bin
  • Sort package.json fields in a preset order
  • Expand author and contributors fields into objects
  • Remove deprecated fields like preferGlobal, engineStrict
  • Merge bundleDependencies into bundledDependencies
  • Rename esnext / jsnext to module, rename typings to types
  • Differentiate UNLICENSED and Unlicense license by private
  • Remove leading ./ from main / files[n]
  • Normalize engines.* versions
  • Normalize repository fields
  • Set version when needed
  • More ...

Related