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

core(tsc): gatherer type-checking cleanup #5019

Merged
merged 2 commits into from
Apr 23, 2018
Merged

Conversation

brendankenny
Copy link
Member

along with #5018, add types (and descriptions) to all default artifacts

also adds types to image-usage.js and start-url.js, which were more straightforward than fonts.js (which is why that was split out and those aren't)

this leaves domstats.js, tags-blocking-first-paint.js, and font-size.js with @ts-nocheck internally, but their output types and API are typed, so it's at least contained within those files. Maybe someday we'll get to them :)

'use strict';

const Gatherer = require('./gatherer');
const manifestParser = require('../../lib/manifest-parser');
const Driver = require('../driver.js'); // eslint-disable-line no-unused-vars
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish what's the story .js or not? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i prefer without .js because that's what vscode autocompletes to but hey given the inconsistency right now, it doesn't matter until we fix it one way or the other. :)

@@ -55,15 +55,16 @@ class StartUrl extends Gatherer {
return {isReadFailure: true, reason: manifest.value.start_url.debugString};
}

// @ts-ignore - TODO(bckenny): should actually be testing value above, not debugString
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bug we let slip in after the last rewrite. Having a debugString doesn't mean there's a failure necessarily. It could have been a warning but then fell back to the documentURL.

This means we're failing sites that use one of the fallbacks even though it's technically allowed. Above should be checking if there's not a manifest.value.start_url.value for the failure case, leaving here to pass on the value to try to load it (and probably passing along any debugString as a warning they messed up the relative URL or whatever).

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brendankenny brendankenny merged commit 16419e7 into master Apr 23, 2018
@brendankenny brendankenny deleted the tslastgathers branch April 23, 2018 23:24
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants