Skip to content

Prettier plugin for package.json

License

Notifications You must be signed in to change notification settings

matzkoh/prettier-plugin-packagejson

Repository files navigation

npm-badge downloads-badge actions-badge renovate-badge codecov-badge

prettier-plugin-packagejson

A Prettier plugin to sort the keys of a package.json file using sort-package-json.

Installation

npm i -D prettier prettier-plugin-packagejson

For prettier v3+ you need to configure

module.exports = {
  // add this
  plugins: ['prettier-plugin-packagejson'],
}

Options

packageSortOrder

Custom ordering array for package.json fields. This option is passed to sort-package-json's sortOrder option.

Type: string[] Default: [] (uses default sort order from sort-package-json)

Example (.prettierrc):

{
  "packageSortOrder": ["name", "version", "description", "main"]
}

About

Prettier plugin for package.json

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 14