Skip to content

Conversation

@brendankenny
Copy link
Contributor

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
Contributor 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
Contributor 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

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
Contributor 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
Contributor

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
Contributor 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

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
Contributor

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