-
Notifications
You must be signed in to change notification settings - Fork 26
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
Bring in a "require-*"/"no-*" kind of rule #51
Comments
If I am understanding correctly, this way I can lint against adding useless properties for private apps, like author, name, version etc. Is this correct? I am basically trying to come up with the smallest possible package.json scheme for an app. |
Yup! You'd have to configure the list yourself, as what constitutes as "useless" changes depending on the context. |
Maybe one rule called |
Coming back to the Also relevant, JoshuaKGoldberg/package-json-validator#80: splitting up I think that leans this package to a nice direction for this issue:
For the cc @michaelfaith - thoughts? |
What criteria do we use for whether a property should have its own rule vs be configurable in the single umbrella rule? It feels a little odd to have some properties be broken out as dedicated rules while others are configured as part of one big rule. The importance of a property is such a relative thing, where to draw that line becomes challenging. I do agree that granular rules feels a bit more natural, but having some be granular and some not be could be confusing. |
Agreed, having some be granular and some not would be confusing. Proposal: how about we put all properties in their own rules? That's my preference more and more. |
That sounds good to me. Then there's the other part of the question: should there be separate |
I think the latter, just checking that if it does exist, it's valid. 👍 otherwise they duplicate the |
I think that's right. I can definitely see a case where someone would want to use |
I've talked myself into agreeing that So yeah, tl;dr, I think we're both aligned on the following
Does that sound right? |
💯 🤝 We're in alignment. This is great! Looking forward to making progress on this. |
OK! I split out a few dozen Closing this issue out as resolved discussion. Cheers! |
https://npmpackagejsonlint.org/docs/rules#require-node-rules has a bunch of
require-*
rules for requiring properties to exist, such asrequire-author
,require-bin
.This seems like it'd do well as a general-purpose ESLint rule. It could:
Maybe,
package-json/require-properties
orpackage-json/require-package-properties
as a name? The latter seems a little overly specific, so I'm leaning towardsrequire-properties
maybe?But, what about https://npmpackagejsonlint.org/docs/rules/#disallowed-node-rules? Should we unify into one big rule for requiring which properties do or don't exist?
I also think that https://npmpackagejsonlint.org/docs/rules/required-node/require-scripts can be treated as a subset of https://npmpackagejsonlint.org/docs/rules/scripts/prefer-scripts for this rule. As in, this same rule can require both that
scripts
exists and what values it contains. Someone please yell at me if that's not ideal.Blocked on #40, but once that PR is merged this will be good to go.✅The text was updated successfully, but these errors were encountered: