-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort dependencies #2
Comments
👋 ahoy. really glad you enjoy it! Most of the properties that are alphabetized were chosen because they're ones that frequently see manual editing and are most prone to getting out of sorts. That said, I could see potential for an option which let users specify which additional properties to sort alphabetically. Perhaps something like: {
sortAlpha: ['devDependencies', 'peerDependencies']
} What are your thoughts? |
Hmmm 🤔 Yes, I suppose you’d have to remain compatible with yarn/npm/etc. Having said that, this is the way I’m using your plugin, which includes using Husky to format before each commit, therefore it doesn’t matter what the package managers do with their sorting as this will overwrite it. So I would say this plugin can mimic Prettier’s philosophy and be as opinionated as possible; as long as it stays consistent. |
It might also be possible to use https://github.com/tclindner/npm-package-json-lint API for some this, author format, sorting etc |
This should have been implemented since https://github.com/shellscape/prettier-plugin-package/blob/master/lib/rules/dependencies.js. |
Hi Andrew. Thanks for this plugin! I'm probably gonna add this to all of my projects' pipelines.
Feature Use Case
If a user manually enters a dependency into the
package.json
file, it will not be sorted alphabetically until a dependency is added using theyarn
ornpm
CLI.Feature Proposal
I propose [dev][peer]Dependencies are sorted alphabetically by this Prettier plugin.
The text was updated successfully, but these errors were encountered: