Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ignatiusmb/prettier-plugin-sort-package-json

Prettier plugin to sort package.json
https://github.com/ignatiusmb/prettier-plugin-sort-package-json

Last synced: 25 days ago
JSON representation

Prettier plugin to sort package.json

Awesome Lists containing this project

README

        

# prettier-plugin-sort-package-json

A [Prettier](https://prettier.io/) plugin to sort the `package.json` file in a consistent and opinionated way, this ensures that your `package.json` file is always well-organized and easy to read.

- ๐ŸŒŸ Set and forget
- ๐Ÿ”Œ Zero-dependency
- ๐Ÿ”ง Zero-configuration
- ๐Ÿ› ๏ธ Auto-fix with Prettier
- ๐Ÿš€ No extra commands needed
- ๐Ÿงน Lint together with Prettier

## Usage

To install `prettier-plugin-sort-package-json`, run the following command:

```bash
pnpm add -D prettier-plugin-sort-package-json
```

To use `prettier-plugin-sort-package-json` with the CLI, use the `--plugin` parameter:

```diff
- prettier --write .
+ prettier --write . --plugin=prettier-plugin-sort-package-json
```

If you have a configuration file, you can also add this to the `"plugins"` list:

```json
{
"plugins": ["prettier-plugin-sort-package-json"]
}
```

You can then run Prettier as usual, and your `package.json` files will be sorted automatically.