Skip to content

Commit

Permalink
closure.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 8, 2018
1 parent eb9018e commit bfe9d71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions lighthouse-core/report/v2/renderer/category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@ class CategoryRenderer {
_renderManualAudits(manualAudits, groupDefinitions, element) {
// While we could support rendering multiple groups of manual audits, it doesn't
// seem desirable for UX or renderer complexity. So we'll throw.
const groupsIds = Array.from(new Set(manualAudits.map(a => a.group)));
// eslint-disable-next-line no-console
console.assert(groupsIds.length <= 1, 'More than 1 manual audit group found.');
if (!groupsIds.length) return;

const groupId = groupsIds[0];
const groupsIds = new Set(manualAudits.map(a => a.group));
/* eslint-disable no-console */
console.assert(groupsIds.size <= 1, 'More than 1 manual audit group found.');
console.assert(!groupsIds.has(undefined), 'Some manual audits don\'t belong to a group');
/* eslint-enable no-console */
if (!groupsIds.size) return;

const groupId = /** @type {string} */ (Array.from(groupsIds)[0]);
const auditGroupElem = this.renderAuditGroup(groupDefinitions[groupId], {expandable: true});
auditGroupElem.classList.add('lh-audit-group--manual');

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/report/v2/renderer/details-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ if (typeof module !== 'undefined' && module.exports) {
* @typedef {{
* type: string,
* value: (string|number|undefined),
* summary: (DetailsRenderer.DetailsSummary|undefined),
* summary: (DetailsRenderer.OpportunitySummary|undefined),
* granularity: (number|undefined),
* displayUnit: (string|undefined)
* }}
Expand Down Expand Up @@ -451,4 +451,4 @@ DetailsRenderer.FilmstripDetails; // eslint-disable-line no-unused-expressions
* wastedBytes: (number|undefined),
* }}
*/
DetailsRenderer.DetailsSummary; // eslint-disable-line no-unused-expressions
DetailsRenderer.OpportunitySummary; // eslint-disable-line no-unused-expressions
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
}

const details = audit.result.details;
const summaryInfo = /** @type {!DetailsRenderer.DetailsSummary}
const summaryInfo = /** @type {!DetailsRenderer.OpportunitySummary}
*/ (details && details.summary);
// eslint-disable-next-line no-console
console.assert(summaryInfo, 'Missing `summary` for perf-hint audit');
Expand Down

0 comments on commit bfe9d71

Please sign in to comment.