Skip to content

Commit

Permalink
core(tsc): type check config files (#5858)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Aug 20, 2018
1 parent 8e18e75 commit 9d3285c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
5 changes: 4 additions & 1 deletion lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const UIStrings = {

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

module.exports = {
/** @type {LH.Config.Json} */
const defaultConfig = {
settings: constants.defaultSettings,
passes: [{
passName: 'defaultPass',
Expand Down Expand Up @@ -445,3 +446,5 @@ Object.defineProperty(module.exports, 'UIStrings', {
enumerable: false,
get: () => UIStrings,
});

module.exports = defaultConfig;
6 changes: 5 additions & 1 deletion lighthouse-core/config/full-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
'use strict';

module.exports = {
/** @type {LH.Config.Json} */
const fullConfig = {
extends: 'lighthouse:default',
settings: {},
passes: [
Expand All @@ -19,6 +20,7 @@ module.exports = {
audits: [
'byte-efficiency/unused-javascript',
],
// @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required
categories: {
'performance': {
auditRefs: [
Expand All @@ -27,3 +29,5 @@ module.exports = {
},
},
};

module.exports = fullConfig;
5 changes: 4 additions & 1 deletion lighthouse-core/config/mixed-content-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
'use strict';

module.exports = {
/** @type {LH.Config.Json} */
const mixedContentConfig = {
// This performs two passes:
// (1) Gather the default resources requested by the page, and
// (2) Re-load page but attempt to upgrade each request to HTTPS.
Expand Down Expand Up @@ -35,3 +36,5 @@ module.exports = {
},
},
};

module.exports = mixedContentConfig;
5 changes: 4 additions & 1 deletion lighthouse-core/config/perf-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
*/
'use strict';

module.exports = {
/** @type {LH.Config.Json} */
const perfConfig = {
extends: 'lighthouse:default',
settings: {
throttlingMethod: 'devtools',
onlyCategories: ['performance'],
},
};

module.exports = perfConfig;
5 changes: 4 additions & 1 deletion lighthouse-core/config/plots-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
'use strict';

module.exports = {
/** @type {LH.Config.Json} */
const plotsConfig = {
extends: 'lighthouse:default',
settings: {
onlyAudits: [
Expand All @@ -17,3 +18,5 @@ module.exports = {
],
},
};

module.exports = plotsConfig;
5 changes: 3 additions & 2 deletions typings/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ declare global {

export interface CategoryJson {
title: string;
description: string;
auditRefs: AuditRefJson[];
description?: string;
manualDescription?: string;
}

export interface GroupJson {
title: string;
description: string;
description?: string;
}

export type AuditJson = {
Expand Down

0 comments on commit 9d3285c

Please sign in to comment.