-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
New Rule: package-json-sorted-keys / package-json-key-order #37
Comments
Thanks for the suggestion @kachkaev, this sounds like an interesting rule. My feeling is that such a rule would not fit well in the standard ESLint JSON plugin, because its usage is limited to Node.js. For reference, other built-in Node.js-specific rules like Any other thought about this suggestion @eslint/eslint-tsc? cc @eslint/eslint-community. |
Just leaving this here but not really having much to add. This would need to be a bit careful as well since sorting can affect some keys like |
Rule details
The rule would normalize
package.json
keys by following a convention in sort-package-json (or similar).What type of rule is this?
Suggests an alternate way of doing something
Example code
↓
Participation
Additional comments
I am using
sort-package-json
viaprettier-plugin-packagejson
and it works well. Automatic key sorting is especially useful in monorepos with lots ofpackage.json
files and contributors. The problem withprettier-plugin-packagejson
is that it goes outside the scope of Prettier:Now that ESLint supports JSON parsing, it’d be great to achieve the value of
sort-package-json
via a rule. Conceptually it is similar to sorting imports in JS files, so I believe that it fits the scope. WDYT?UPD Maybe this should be done elsewhere because the rule would be
package.json
specific. There is a discussion in keithamus/sort-package-json#322.The text was updated successfully, but these errors were encountered: