Today, I discovered that this plugin uses a different sorting priority of hyphens and underscores than what npm uses, which was unexpected for me.
Steps to reproduce:
mkdir test
cd test
npm init --yes
npm install --save-dev prettier prettier-plugin-packagejson @types/eslint-config-prettier @types/eslint__js
cat package.json
# Notice that "@types/eslint__js" comes before "@types/eslint-config-prettier".
npx prettier package.json --plugin prettier-plugin-packagejson --write
cat package.json
# Notice that "@types/eslint-config-prettier" comes before "@types/eslint__js".
This mismatch is particularly painful because whenever I install a new dependency with npm (e.g. npm install --save-dev foo), it automatically breaks CI, because now Prettier fails to pass the package.json file, which then requires someone to explicitly go and format the package.json file again.
Can we fix this so that this plugin and npm have parity?
Hello, and thanks for the excellent plugin!
Today, I discovered that this plugin uses a different sorting priority of hyphens and underscores than what npm uses, which was unexpected for me.
Steps to reproduce:
This mismatch is particularly painful because whenever I install a new dependency with npm (e.g.
npm install --save-dev foo
), it automatically breaks CI, because now Prettier fails to pass the package.json file, which then requires someone to explicitly go and format the package.json file again.Can we fix this so that this plugin and npm have parity?