Skip to content

Commit e2cc7e0

Browse files
fix(ui): move license/description quality checks outside analysis guard
1 parent daf3b28 commit e2cc7e0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

app/composables/usePackageComparison.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ export function computeHealthScore(data: PackageComparisonData): number {
368368
if (data.analysis.types?.kind === 'included' || data.analysis.types?.kind === '@types')
369369
quality += 40
370370
if (data.analysis.moduleFormat === 'esm' || data.analysis.moduleFormat === 'dual') quality += 30
371-
if (data.metadata?.license) quality += 20
372-
if (data.package.description) quality += 10
373371
}
372+
if (data.metadata?.license) quality += 20
373+
if (data.package.description) quality += 10
374374

375375
// SECURITY (20%) — based on vulnerability severity
376376
let security = 100

test/nuxt/composables/use-package-comparison.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ async function usePackageComparisonInComponent(packageNames: string[]) {
4242
}
4343
}
4444

45+
function makeData(overrides: Partial<PackageComparisonData> = {}): PackageComparisonData {
46+
return {
47+
package: { name: 'test', version: '1.0.0' },
48+
directDeps: 2,
49+
...overrides,
50+
}
51+
}
52+
4553
describe('usePackageComparison', () => {
4654
afterEach(() => {
4755
vi.unstubAllGlobals()
@@ -128,14 +136,6 @@ describe('usePackageComparison', () => {
128136
})
129137
})
130138

131-
function makeData(overrides: Partial<PackageComparisonData> = {}): PackageComparisonData {
132-
return {
133-
package: { name: 'test', version: '1.0.0' },
134-
directDeps: 2,
135-
...overrides,
136-
}
137-
}
138-
139139
describe('computeHealthScore', () => {
140140
it('returns score 0 for deprecated packages', () => {
141141
const score = computeHealthScore(makeData({ metadata: { deprecated: 'Use something else' } }))

0 commit comments

Comments
 (0)