@@ -9,11 +9,11 @@ import { join } from 'node:path';
99import type { Audit , Group } from '@code-pushup/models' ;
1010import { LIGHTHOUSE_OUTPUT_PATH } from '../constants' ;
1111
12- const { audits = [ ] , categories = { } } = defaultConfig ;
12+ const { audits, categories } = defaultConfig ;
1313
1414// internal intermediate variable to derive the relevant audits
1515const allRawLighthouseAudits = await Promise . all (
16- ( audits as Config . AuditJson [ ] ) . map ( loadLighthouseAudit ) ,
16+ ( audits ?? [ ] ) . map ( loadLighthouseAudit ) ,
1717) ;
1818
1919export const PLUGIN_SLUG = 'lighthouse' ;
@@ -35,21 +35,21 @@ export const LIGHTHOUSE_NAVIGATION_AUDITS: Audit[] = allRawLighthouseAudits
3535const navigationAuditSlugs = new Set (
3636 LIGHTHOUSE_NAVIGATION_AUDITS . map ( ( { slug } ) => slug ) ,
3737) ;
38- export const LIGHTHOUSE_GROUPS : Group [ ] = Object . entries (
39- categories as Record < string , Config . CategoryJson > ,
40- ) . map ( ( [ id , category ] ) => ( {
41- slug : id ,
42- title : getMetaString ( category . title ) ,
43- ...( category . description && {
44- description : getMetaString ( category . description ) ,
38+ export const LIGHTHOUSE_GROUPS : Group [ ] = Object . entries ( categories ?? { } ) . map (
39+ ( [ id , category ] ) => ( {
40+ slug : id ,
41+ title : getMetaString ( category . title ) ,
42+ ...( category . description && {
43+ description : getMetaString ( category . description ) ,
44+ } ) ,
45+ refs : category . auditRefs
46+ . filter ( ( { id : auditSlug } ) => navigationAuditSlugs . has ( auditSlug ) )
47+ . map ( ref => ( {
48+ slug : ref . id ,
49+ weight : ref . weight ,
50+ } ) ) ,
4551 } ) ,
46- refs : category . auditRefs
47- . filter ( ( { id : auditSlug } ) => navigationAuditSlugs . has ( auditSlug ) )
48- . map ( ref => ( {
49- slug : ref . id ,
50- weight : ref . weight ,
51- } ) ) ,
52- } ) ) ;
52+ ) ;
5353
5454function getMetaString ( value : string | IcuMessage ) : string {
5555 if ( typeof value === 'string' ) {
0 commit comments