-
Notifications
You must be signed in to change notification settings - Fork 28
feat: new restrict-dependency-ranges
rule
#998
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #998 +/- ##
==========================================
+ Coverage 99.50% 99.58% +0.07%
==========================================
Files 19 20 +1
Lines 1223 1451 +228
Branches 142 193 +51
==========================================
+ Hits 1217 1445 +228
Misses 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0ecb0f7
to
7269e63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 The core logic seems very reasonable and good to me, really nice job! I think it makes sense to go in order like this and check the first (last, reversed) matching dependency.
Mainly requesting changes on:
- Docs: adding some more examples to make usage more clear
- Testing: some of the lines don't fail any tests for me when removed locally
- Some suggestions around refactors
WDYT?
1332d62
to
92325bc
Compare
This change adds a new rule that allows you to restrict usage of semver ranges on dependencies using any of the following matching options: - by dependency name or regex pattern - by version - by dependency type
test: add more unit test coverage
201916f
to
65306ee
Compare
From the "Lint Markdown" step: @JoshuaKGoldberg not directly related to this change, but the first time I'm seeing this error (I think it came in with the CTA update since I just rebased with main). How strongly do you feel about this rule? I'm personally not a fan, but if it's something you feel strongly about, I'll work around it. |
😄 I do feel strongly in favor about it, I think it's really nice to have a 1:1 of "line that can be diffed in Git" to sentences. But also if you end up hating it enough to send a PR that removes it from this repo, I'll approve it. ACK that it's kind of inconvenient to not have it be integrated into ESLint; I'm hoping that later this year as |
That actually touches on the second reason i'm not a fan of the rule haha. I have two main issues with it. For the first, i think we can generally agree on the following three statements?
Those three things tell a story of us believing that something is truly valuable, but then creating friction around contributing it. More often than not, people contributing new code will hit up against that, and get frustrated (like i did 😆). That, then discourages people from even bothering. And all of that could be ok, if we believe the benefits outweigh the cost. And i just don't see that being the case. If i think about the kinds of changes people might make to existing documentation, i don't really see what value having them one sentence per line brings in terms of diff review. Certainly not enough to outweigh the cost. For something like the dangling comma formatting rule (which promises a similar value proposition), that calculus is much more in favor of the rule, since it's something we interact with way more. And that brings me to the second point of grief: like dangling commas, this is a formatting concern. And i think we generally agree that formatting is the domain of prettier, not lint. This isn't something that feels like it should belong in any lint tool, whether it be markdownlint or eslint. In my mind, if it should exist at all, it should go in prettier. Happy to be convinced otherwise, if i'm missing something, or not looking at this correctly. 😊 |
You make a lot of good points! Agreed, getting folks to write docs in the first place >>> nitpicking the formatting of those docs 😄. Filed JoshuaKGoldberg/create-typescript-app#2216. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 solid!
🎉 This is included in version v0.30.0 🎉 The release is available on: Cheers! 📦🚀 |
PR Checklist
status: accepting prs
Overview
This change adds a new rule that allows you to restrict usage of semver ranges on dependencies using any of the following matching options:
Closes #959