misc: add non-null annotations to keep internal lint happy (#10454)
This commit is contained in:
Родитель
468c10bb9d
Коммит
a74c807b3a
|
@ -65,7 +65,7 @@ class CategoryRenderer {
|
|||
* Populate an DOM tree with audit details. Used by renderAudit and renderOpportunity
|
||||
* @param {LH.ReportResult.AuditRef} audit
|
||||
* @param {DocumentFragment} tmpl
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
populateAuditValues(audit, tmpl) {
|
||||
const strings = Util.i18n.strings;
|
||||
|
@ -156,7 +156,7 @@ class CategoryRenderer {
|
|||
* @param {Element} element DOM node to populate with values.
|
||||
* @param {number|null} score
|
||||
* @param {string} scoreDisplayMode
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
_setRatingClass(element, score, scoreDisplayMode) {
|
||||
const rating = Util.calculateRating(score, scoreDisplayMode);
|
||||
|
@ -277,7 +277,7 @@ class CategoryRenderer {
|
|||
* in a collapsed state.
|
||||
* @param {Exclude<TopLevelClumpId, 'failed'>} clumpId
|
||||
* @param {{auditRefs: Array<LH.ReportResult.AuditRef>, description?: string}} clumpOpts
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
renderClump(clumpId, {auditRefs, description}) {
|
||||
const clumpTmpl = this.dom.cloneTemplate('#tmpl-lh-clump', this.templateContext);
|
||||
|
|
|
@ -55,7 +55,7 @@ class DOM {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {DocumentFragment}
|
||||
* @return {!DocumentFragment}
|
||||
*/
|
||||
createFragment() {
|
||||
return this._document.createDocumentFragment();
|
||||
|
@ -80,7 +80,7 @@ class DOM {
|
|||
/**
|
||||
* @param {string} selector
|
||||
* @param {ParentNode} context
|
||||
* @return {DocumentFragment} A clone of the template content.
|
||||
* @return {!DocumentFragment} A clone of the template content.
|
||||
* @throws {Error}
|
||||
*/
|
||||
cloneTemplate(selector, context) {
|
||||
|
@ -192,7 +192,7 @@ class DOM {
|
|||
* nothing matches query.
|
||||
* @param {string} query
|
||||
* @param {ParentNode} context
|
||||
* @return {HTMLElement}
|
||||
* @return {!HTMLElement}
|
||||
*/
|
||||
find(query, context) {
|
||||
/** @type {?HTMLElement} */
|
||||
|
@ -207,7 +207,7 @@ class DOM {
|
|||
* Helper for context.querySelectorAll. Returns an Array instead of a NodeList.
|
||||
* @param {string} query
|
||||
* @param {ParentNode} context
|
||||
* @return {Array<HTMLElement>}
|
||||
* @return {!Array<HTMLElement>}
|
||||
*/
|
||||
findAll(query, context) {
|
||||
return Array.from(context.querySelectorAll(query));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class PerformanceCategoryRenderer extends CategoryRenderer {
|
||||
/**
|
||||
* @param {LH.ReportResult.AuditRef} audit
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
_renderMetric(audit) {
|
||||
const tmpl = this.dom.cloneTemplate('#tmpl-lh-metric', this.templateContext);
|
||||
|
@ -54,7 +54,7 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
|
|||
/**
|
||||
* @param {LH.ReportResult.AuditRef} audit
|
||||
* @param {number} scale
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
_renderOpportunity(audit, scale) {
|
||||
const oppTmpl = this.dom.cloneTemplate('#tmpl-lh-opportunity', this.templateContext);
|
||||
|
|
|
@ -96,7 +96,7 @@ class PwaCategoryRenderer extends CategoryRenderer {
|
|||
/**
|
||||
* Returns the group IDs found in auditRefs.
|
||||
* @param {Array<LH.ReportResult.AuditRef>} auditRefs
|
||||
* @return {Set<string>}
|
||||
* @return {!Set<string>}
|
||||
*/
|
||||
_getGroupIds(auditRefs) {
|
||||
const groupIds = auditRefs.map(ref => ref.group).filter(/** @return {g is string} */ g => !!g);
|
||||
|
|
|
@ -41,7 +41,7 @@ class ReportRenderer {
|
|||
/**
|
||||
* @param {LH.Result} result
|
||||
* @param {Element} container Parent element to render the report into.
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
renderReport(result, container) {
|
||||
this._dom.setLighthouseChannel(result.configSettings.channel || 'unknown');
|
||||
|
@ -150,7 +150,7 @@ class ReportRenderer {
|
|||
* @param {LH.ReportResult} report
|
||||
* @param {CategoryRenderer} categoryRenderer
|
||||
* @param {Record<string, CategoryRenderer>} specificCategoryRenderers
|
||||
* @return {DocumentFragment[]}
|
||||
* @return {!DocumentFragment[]}
|
||||
*/
|
||||
_renderScoreGauges(report, categoryRenderer, specificCategoryRenderers) {
|
||||
// Group gauges in this order: default, pwa, plugins.
|
||||
|
@ -181,7 +181,7 @@ class ReportRenderer {
|
|||
|
||||
/**
|
||||
* @param {LH.ReportResult} report
|
||||
* @return {DocumentFragment}
|
||||
* @return {!DocumentFragment}
|
||||
*/
|
||||
_renderReport(report) {
|
||||
const i18n = new I18n(report.configSettings.locale, {
|
||||
|
|
|
@ -336,7 +336,7 @@ class SnippetRenderer {
|
|||
* @param {ParentNode} templateContext
|
||||
* @param {LH.Audit.Details.SnippetValue} details
|
||||
* @param {DetailsRenderer} detailsRenderer
|
||||
* @return {Element}
|
||||
* @return {!Element}
|
||||
*/
|
||||
static render(dom, templateContext, details, detailsRenderer) {
|
||||
const tmpl = dom.cloneTemplate('#tmpl-lh-snippet', templateContext);
|
||||
|
|
|
@ -320,7 +320,7 @@ class Util {
|
|||
|
||||
/**
|
||||
* @param {string|URL} value
|
||||
* @return {URL}
|
||||
* @return {!URL}
|
||||
*/
|
||||
static createOrReturnURL(value) {
|
||||
if (value instanceof URL) {
|
||||
|
@ -365,7 +365,7 @@ class Util {
|
|||
|
||||
/**
|
||||
* @param {LH.Config.Settings} settings
|
||||
* @return {Array<{name: string, description: string}>}
|
||||
* @return {!Array<{name: string, description: string}>}
|
||||
*/
|
||||
static getEnvironmentDisplayValues(settings) {
|
||||
const emulationDesc = Util.getEmulationDescriptions(settings);
|
||||
|
|
Загрузка…
Ссылка в новой задаче