Skip to content
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

Merged
merged 2 commits into from
May 8, 2018

Conversation

patrickhulce
Copy link
Collaborator

  • renames reportCategories -> categories
  • converts categories to a keyed object instead of array
  • renames reportGroups -> categoryGroups

ref #4333 #5008

Copy link
Member

@brendankenny brendankenny left a 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

if (opts.config.categories) {
reportCategories = ReportScoring.scoreAllCategories(opts.config.categories, resultsById);
categories = ReportScoring.scoreAllCategories(opts.config.categories, resultsById);
}

const lhr = {
Copy link
Member

@brendankenny brendankenny May 8, 2018

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)

Copy link
Collaborator Author

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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

categoryGroups

Copy link
Member

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good call fixed!

@brendankenny brendankenny merged commit beb7092 into master May 8, 2018
@brendankenny brendankenny deleted the categories_groups branch May 8, 2018 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants