fix: direct & total dependency count#868
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📝 WalkthroughWalkthroughA new 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/composables/usePackageComparison.ts (1)
363-390:⚠️ Potential issue | 🟠 MajorWrap ALL switch cases with const declarations in blocks to satisfy Biome's
noSwitchDeclarations.The rule is enabled by default in the current Biome configuration (via
"recommended": true). Five cases violate this rule and require block-scoped wrapping:'lastUpdated','license','deprecated','dependencies', and'totalDependencies'.Proposed fix
case 'lastUpdated': + { if (!data.metadata?.lastUpdated) return null const date = new Date(data.metadata.lastUpdated) return { raw: date.getTime(), display: data.metadata.lastUpdated, status: isStale(date) ? 'warning' : 'neutral', type: 'date', } + } case 'license': + { const license = data.metadata?.license if (!license) { return { raw: null, display: t('compare.facets.values.unknown'), status: 'warning' } } return { raw: license, display: license, status: 'neutral', } + } case 'dependencies': + { if (!data.installSize) return null const directDepCount = data.installSize.directDepCount return { raw: directDepCount, display: String(directDepCount), status: directDepCount > 50 ? 'warning' : 'neutral', } + } case 'deprecated': + { const isDeprecated = !!data.metadata?.deprecated return { raw: isDeprecated, display: isDeprecated ? t('compare.facets.values.deprecated') : t('compare.facets.values.not_deprecated'), status: isDeprecated ? 'bad' : 'good', } + } case 'totalDependencies': + { if (!data.installSize) return null const depCount = data.installSize.dependencyCount return { raw: depCount, display: String(depCount), status: depCount > 50 ? 'warning' : 'neutral', } + }
| if (!data.installSize) return null | ||
| const depCount = data.installSize.dependencyCount | ||
| return { | ||
| raw: depCount, | ||
| display: String(depCount), | ||
| status: depCount > 50 ? 'warning' : 'neutral', | ||
| } |
There was a problem hiding this comment.
Include totalDependencies in the install-size loading check.
This facet now depends on install-size, but isFacetLoading (Line 231) still omits it, so the UI can show a non-loading state whilst data is pending.
Proposed fix
- return facet === 'installSize' || facet === 'dependencies'
+ return facet === 'installSize' || facet === 'dependencies' || facet === 'totalDependencies'🧰 Tools
🪛 Biome (2.3.13)
[error] 385-385: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Safe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
fixes #857