Closed hyoban closed 5 months ago
Please see the readme for an explanation (https://github.com/keithamus/sort-package-json?tab=readme-ov-file#i-would-like-this-tool-to-be-configurable-with-a-config-file-or-command-line-arguments):
I would like this tool to be configurable with a config file or command line arguments.
The lack of configuration here is a feature, not a bug. The intent of this tool is that a user can open a package json and always expect to see keys in a particular order. If we add a configuration for this tool, then that promise is broken, as users will first need to look at the configuration for each project to learn the ways in which this tool will change the
package.json
. The structure of thepackage.json
should always be predictable & deterministic from project to project. I think the reason why this project is well used is because it is not another "tool" you have to set up with yet another JSON file and more cruft in your project to support it. You run a command and it does what it says on the tin.A lot of people who ask for configuration cite the use case that they simply don't like the given order that exists and want to make sweeping changes. To me this seems far better suited to simply making a fork of this project as then you can go far further than specifying configuration.
Thanks for your reply, and sorry for my noise issue. I will provide this option from my side.
In eslint-plugin-package-json, we use
sort-package-json
to auto-fixorder-properties
rule. However,sort-package-json
also sort sub-keys too. This resulted in an issue https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/80.Would you like to have an option to allow don't sort sub-keys? I am willing to submit a pull request for this change.