-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(lhr): convert reportCategories to categories object #5155
Conversation
e5c287e
to
40adda9
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.
type fixup but otherwise LGTM
lighthouse-core/runner.js
Outdated
if (opts.config.categories) { | ||
reportCategories = ReportScoring.scoreAllCategories(opts.config.categories, resultsById); | ||
categories = ReportScoring.scoreAllCategories(opts.config.categories, resultsById); | ||
} | ||
|
||
const lhr = { |
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.
we should probably put a /** @type {LH.Result} */
above this so it's checked for excess properties not in the def (reportGroups
-> categoryGroups
isn't caught by the un-updated type in lhr.d.ts
since reportGroups
was optional)
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.
yeah good call done
typings/lhr.d.ts
Outdated
@@ -21,7 +21,7 @@ declare global { | |||
/** An object containing the results of the audits, keyed by the audits' `id` identifier. */ | |||
audits: Record<string, Audit.Result>; | |||
/** The top-level categories, their overall scores, and member audits. */ | |||
reportCategories: Result.Category[]; | |||
categories: Record<string, Result.Category>; | |||
/** Descriptions of the groups referenced by CategoryMembers. */ | |||
reportGroups?: Record<string, Result.Group>; |
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.
categoryGroups
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.
and do we want the interface of the values to be ReportGroup
to match our usual plural/singular thing?
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.
yeah good call fixed!
ref #4333 #5008