From 736cc15e624709403a6f6fd333f5607c0237590e Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Thu, 4 Apr 2019 18:48:44 -0700 Subject: [PATCH 1/2] misc: remove lhr-lite.d.ts --- types/audit.d.ts | 19 +++++++++-- types/lhr-lite.d.ts | 82 --------------------------------------------- types/lhr.d.ts | 2 -- 3 files changed, 17 insertions(+), 86 deletions(-) delete mode 100644 types/lhr-lite.d.ts diff --git a/types/audit.d.ts b/types/audit.d.ts index dddf009cf603..1120adeef135 100644 --- a/types/audit.d.ts +++ b/types/audit.d.ts @@ -28,11 +28,17 @@ declare global { } export interface ScoreDisplayModes { + /** Scores of 0-1 (map to displayed scores of 0-100). */ NUMERIC: 'numeric'; + /** Pass/fail audit (0 and 1 are only possible scores). */ BINARY: 'binary'; + /** The audit exists only to tell you to review something yourself. Score is null and should be ignored. */ MANUAL: 'manual'; + /** The audit is an FYI only, and can't be interpreted as pass/fail. Score is null and should be ignored. */ INFORMATIVE: 'informative'; + /** The audit turned out to not apply to the page. Score is null and should be ignored. */ NOT_APPLICABLE: 'notApplicable'; + /** There was an error while running the audit (check `errorMessage` for details). Score is null and should be ignored. */ ERROR: 'error'; } @@ -45,7 +51,7 @@ declare global { title: string; /** Short, user-visible title for the audit when failing. */ failureTitle?: string; - /** Explanation of why the user should care about the audit. */ + /** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */ description: string; /** A list of the members of LH.Artifacts that must be present for the audit to execute. */ requiredArtifacts: Array; @@ -64,23 +70,31 @@ declare global { export interface Product { rawValue: boolean | number | null; displayValue?: string; + /** An explanation of audit-related issues encountered on the test page. */ explanation?: string; + /** Error message from any exception thrown while running this audit. */ errorMessage?: string; warnings?: string[]; + /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ score?: number; + /** Deprecated and does not make its way into the Lighthouse report. */ extendedInfo?: {[p: string]: any}; /** Overrides scoreDisplayMode with notApplicable if set to true */ notApplicable?: boolean; + /** Extra information provided by some types of audits. */ details?: Audit.Details; } - /* Audit result returned in Lighthouse report. All audits offer a description and score of 0-1 */ + /* Audit result returned in Lighthouse report. All audits offer a description and score of 0-1. */ export interface Result { rawValue: boolean | number | null; displayValue?: string; + /** An explanation of audit-related issues encountered on the test page. */ explanation?: string; + /** Error message from any exception thrown while running this audit. */ errorMessage?: string; warnings?: string[]; + /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ score: number|null; /** * A string identifying how the score should be interpreted: @@ -98,6 +112,7 @@ declare global { id: string; /** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */ description: string; + /** Extra information provided by some types of audits. */ details?: Audit.Details; } diff --git a/types/lhr-lite.d.ts b/types/lhr-lite.d.ts deleted file mode 100644 index a8c1251d995f..000000000000 --- a/types/lhr-lite.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @license Copyright 2018 Google Inc. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ - -declare global { - module LH { - /** - * The lightweight version of Lighthouse results. - */ - export interface ResultLite { - /** The URL that was supplied to Lighthouse and initially navigated to. */ - requestedUrl: string; - /** The post-redirects URL that Lighthouse loaded. */ - finalUrl: string; - /** The ISO-8601 timestamp of when the results were generated. */ - fetchTime: string; - /** The version of Lighthouse with which these results were generated. */ - lighthouseVersion: string; - /** An object containing the results of the audits. */ - audits: Record; - /** An object containing the top-level categories, their overall scores, and reference to member audits. */ - categories: Record; - } - - // ResultLite namespace - export module ResultLite { - export interface Category { - /** The human-friendly name of the category. */ - title: string; - /** A description of what this category is about (e.g. these help you validate your PWA). */ - description: string; - /** The overall score of the category, the weighted average of all its audits. */ - score: number; - /** An array of references to all the audit members of this category. */ - auditRefs: AuditRef[]; - /** An optional description for manual audits within this category. */ - manualDescription?: string; - } - - /** - * A reference to an audit result, with weighting and grouping information - * for its place in this category. - */ - export interface AuditRef { - /** Matches a key in the top-level `audits` object. */ - auditId: string; - /** The weight of the audit's score in the overall category score. */ - weight: number; - } - - export interface Audit { - /** The brief description of the audit. The text can change depending on if the audit passed or failed. */ - title: string; - /** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */ - description: string; - /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ - score: number | null; - /** - * A string identifying how the score should be interpreted: - * 'binary': pass/fail audit (0 and 1 are only possible scores). - * 'numeric': scores of 0-1 (map to displayed scores of 0-100). - * 'informative': the audit is an FYI only, and can't be interpreted as pass/fail. Score is null and should be ignored. - * 'notApplicable': the audit turned out to not apply to the page. Score is null and should be ignored. - * 'manual': The audit exists only to tell you to review something yourself. Score is null and should be ignored. - * 'error': There was an error while running the audit (check `errorMessage` for details). Score is null and should be ignored. - */ - scoreDisplayMode: 'binary' | 'numeric' | 'informative' | 'notApplicable' | 'manual' | 'error'; - /** An explanation of audit-related issues encountered on the test page. */ - explanation?: string; - /** Extra information provided by some types of audits. */ - details?: never; - /** Error message from any exception thrown while running this audit. */ - errorMessage?: string; - } - } - } -} - -// empty export to keep file a module -export {} diff --git a/types/lhr.d.ts b/types/lhr.d.ts index 6e7193fe2845..a9a7168b63dd 100644 --- a/types/lhr.d.ts +++ b/types/lhr.d.ts @@ -46,8 +46,6 @@ declare global { /** Descriptions of the groups referenced by CategoryMembers. */ categoryGroups?: Record; - - // Additional non-LHR-lite information. /** The config settings used for these results. */ configSettings: Config.Settings; /** List of top-level warnings for this Lighthouse run. */ From bcd3e2b69672c45496029cb0c8b0e14c6bc99e97 Mon Sep 17 00:00:00 2001 From: Brendan Kenny Date: Thu, 4 Apr 2019 22:35:47 -0700 Subject: [PATCH 2/2] comment changes --- types/audit.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/audit.d.ts b/types/audit.d.ts index 1120adeef135..f8eb0cb0cc8b 100644 --- a/types/audit.d.ts +++ b/types/audit.d.ts @@ -70,18 +70,18 @@ declare global { export interface Product { rawValue: boolean | number | null; displayValue?: string; - /** An explanation of audit-related issues encountered on the test page. */ + /** An explanation of why the audit failed on the test page. */ explanation?: string; /** Error message from any exception thrown while running this audit. */ errorMessage?: string; warnings?: string[]; - /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ + /** The scored value of the audit, provided in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ score?: number; /** Deprecated and does not make its way into the Lighthouse report. */ extendedInfo?: {[p: string]: any}; /** Overrides scoreDisplayMode with notApplicable if set to true */ notApplicable?: boolean; - /** Extra information provided by some types of audits. */ + /** Extra information about the page provided by some types of audits, in one of several possible forms that can be rendered in the HTML report. */ details?: Audit.Details; } @@ -89,12 +89,12 @@ declare global { export interface Result { rawValue: boolean | number | null; displayValue?: string; - /** An explanation of audit-related issues encountered on the test page. */ + /** An explanation of why the audit failed on the test page. */ explanation?: string; /** Error message from any exception thrown while running this audit. */ errorMessage?: string; warnings?: string[]; - /** The scored value determined by the audit, in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ + /** The scored value of the audit, provided in the range `0-1`, or null if `scoreDisplayMode` indicates not scored. */ score: number|null; /** * A string identifying how the score should be interpreted: @@ -112,7 +112,7 @@ declare global { id: string; /** A more detailed description that describes why the audit is important and links to Lighthouse documentation on the audit; markdown links supported. */ description: string; - /** Extra information provided by some types of audits. */ + /** Extra information about the page provided by some types of audits, in one of several possible forms that can be rendered in the HTML report. */ details?: Audit.Details; }