feat(sort): add name-desc and stars-asc to SortValue - #32
Conversation
sortProjects could not express Name Z-A or ascending stars, forcing consumers past the convenience switch to the granular sorters. Extend the string union with the two missing directions; existing values keep their meaning. Object-enum redesign intentionally out of scope (#20).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 48 minutes Limit details: You’ve used all 3 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 3 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesProject sorting options
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This PR adds two localized sort directions with documentation and focused test coverage; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThe PR extends
Confidence Score: 5/5The PR appears safe to merge because no eligible blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/core/src/lib/sortProjects.ts | Extends the public sort-value union and dispatches the two new values to existing directional sort helpers. |
| packages/core/src/lib/tests/sortProjects.test.ts | Adds focused ordering coverage for ascending stars and descending names. |
| packages/docs/src/api/types/sort-value.md | Documents the expanded union and the behavior of both new sort values. |
| packages/docs/src/api/utilities/sort-projects.md | Updates the utility reference and examples to include both new sorting directions. |
| CHANGELOG.md | Records the additive sorting API extension and preserves the meanings of existing values. |
Reviews (2): Last reviewed commit: "docs(sort): add changelog entry and show..." | Re-trigger Greptile
Closes #20
Problem
sortProjectswas asymmetrical: date had both directions (date= desc,date-asc= asc), butnamewas ascending-only andstarssingle-direction. A consumer offering a "Name (Z-A)" option could not express it viasortProjectsand had to drop down to the granular sorters.Change
Additive string-union extension (per the locked decision on the issue — the object-enum redesign is out of scope):
'name-desc'→sortByName(projects, 'desc')— the case the issue demands'stars-asc'→sortByStars(projects, 'asc')—sortByStarsdefaults todesc, soascis the missing direction (no alias added for existing behaviour)SortValuekeeps its meaning unchangedNotes
SmartProjectGrid's internalSORT_OPTIONSstill exposes only the original four — exposing the new directions in that UI is a separate product decisionsort-value.mdandsort-projects.mdvalue tables, unions, and behaviour sectionsVerification
pnpm build && pnpm typecheck && pnpm lint && pnpm test— all green (1012 tests). Two focused cases added tosortProjects.test.tscovering Z-A name order and lowest-stars-first.Summary by CodeRabbit
New Features
Tests