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

misc(typings): convert hardcoded strings to networkRequests.TYPES #5674

Merged
merged 2 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lighthouse-core/audits/bootup-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

const Audit = require('./audit');
const Util = require('../report/html/renderer/util');
const NetworkRequest = require('../lib/network-request');
const {taskGroups} = require('../lib/task-groups');

class BootupTime extends Audit {
Expand Down Expand Up @@ -46,7 +47,7 @@ class BootupTime extends Audit {
/** @type {Set<string>} */
const urls = new Set();
for (const record of records) {
if (record.resourceType && record.resourceType === 'Script') {
if (record.resourceType === NetworkRequest.TYPES.Script) {
urls.add(record.url);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class OptimizedImages extends Gatherer {
}

seenUrls.add(record.url);
const isOptimizableImage = record.resourceType &&
record.resourceType === 'Image' &&
const isOptimizableImage = record.resourceType === NetworkRequest.TYPES.Image &&
/image\/(png|bmp|jpeg)/.test(record.mimeType);
const isSameOrigin = URL.originsMatch(pageUrl, record.url);
const isBase64DataUri = /^data:.{2,40}base64\s*,/.test(record.url);
Expand Down