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

report: isolate flow-report type checking #12952

Merged
merged 3 commits into from
Aug 20, 2021
Merged

Conversation

brendankenny
Copy link
Member

fairly straightforward, though a few options here to change now or later, depending on your preferences, @adamraine


const flowResult = JSON.parse(
fs.readFileSync(
`${LH_ROOT}/lighthouse-core/test/fixtures/fraggle-rock/reports/sample-lhrs.json`,
`${__dirname}/../../lighthouse-core/test/fixtures/fraggle-rock/reports/sample-lhrs.json`,
Copy link
Member Author

@brendankenny brendankenny Aug 20, 2021

Choose a reason for hiding this comment

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

similar to #12940 (comment), root.js isn't accessible without importing all of core, so this works for now.

I also don't have a good mental model for where tsx files live on the commonjs <-> esmodules spectrum and what works in them and what doesn't. Does it just depend on the bundler?

@@ -1,14 +1,37 @@
{
"extends": "../tsconfig",
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll switch this back to extending and move most of this back to a tsconfig-base.json or whatever in a follow up

@@ -6,8 +6,10 @@

import {FunctionComponent} from 'preact';
import {useState} from 'preact/hooks';
import type FlowResult from '../types/lhr/flow';
import type LHResult from '../types/lhr/lhr';
Copy link
Member Author

Choose a reason for hiding this comment

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

went with explicit type import because this is tsx. Could add declare LH {} to flow-report.d.ts instead if global types are preferred.

Copy link
Member

Choose a reason for hiding this comment

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

Global types SGTM, I think it would also prevent a merge conflict with #12929

Copy link
Member Author

Choose a reason for hiding this comment

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

Global types SGTM

done

@@ -6,8 +6,10 @@

import {FunctionComponent} from 'preact';
import {useState} from 'preact/hooks';
import type FlowResult from '../types/lhr/flow';
import type LHResult from '../types/lhr/lhr';
Copy link
Member

Choose a reason for hiding this comment

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

Global types SGTM, I think it would also prevent a merge conflict with #12929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants