Ran prettier everywhere
This commit is contained in:
@@ -46,7 +46,7 @@ describe('AuditView', () => {
|
||||
apis = ApiRegistry.from([
|
||||
[lighthouseApiRef, new LighthouseRestApi('https://lighthouse')],
|
||||
]);
|
||||
id = websiteResponse.audits.find(a => a.status === 'COMPLETED')
|
||||
id = websiteResponse.audits.find((a) => a.status === 'COMPLETED')
|
||||
?.id as string;
|
||||
useParams.mockReturnValue({ id });
|
||||
});
|
||||
@@ -98,7 +98,7 @@ describe('AuditView', () => {
|
||||
|
||||
await rendered.findByTestId('audit-sidebar');
|
||||
|
||||
websiteResponse.audits.forEach(a => {
|
||||
websiteResponse.audits.forEach((a) => {
|
||||
expect(
|
||||
rendered.queryByText(formatTime(a.timeCreated)),
|
||||
).toBeInTheDocument();
|
||||
@@ -116,14 +116,14 @@ describe('AuditView', () => {
|
||||
|
||||
await rendered.findByTestId('audit-sidebar');
|
||||
|
||||
const audit = websiteResponse.audits.find(a => a.id === id) as Audit;
|
||||
const audit = websiteResponse.audits.find((a) => a.id === id) as Audit;
|
||||
const auditElement = rendered.getByText(formatTime(audit.timeCreated));
|
||||
expect(auditElement.parentElement?.parentElement?.className).toContain(
|
||||
'selected',
|
||||
);
|
||||
|
||||
const notSelectedAudit = websiteResponse.audits.find(
|
||||
a => a.id !== id,
|
||||
(a) => a.id !== id,
|
||||
) as Audit;
|
||||
const notSelectedAuditElement = rendered.getByText(
|
||||
formatTime(notSelectedAudit.timeCreated),
|
||||
@@ -144,7 +144,7 @@ describe('AuditView', () => {
|
||||
|
||||
await rendered.findByTestId('audit-sidebar');
|
||||
|
||||
websiteResponse.audits.forEach(a => {
|
||||
websiteResponse.audits.forEach((a) => {
|
||||
expect(
|
||||
rendered.getByText(formatTime(a.timeCreated)).parentElement
|
||||
?.parentElement,
|
||||
@@ -183,7 +183,7 @@ describe('AuditView', () => {
|
||||
|
||||
describe.skip('when a loading audit is accessed', () => {
|
||||
it('shows a loading view', async () => {
|
||||
id = websiteResponse.audits.find(a => a.status === 'RUNNING')
|
||||
id = websiteResponse.audits.find((a) => a.status === 'RUNNING')
|
||||
?.id as string;
|
||||
useParams.mockReturnValueOnce({ id });
|
||||
|
||||
@@ -203,7 +203,7 @@ describe('AuditView', () => {
|
||||
|
||||
describe.skip('when a failed audit is accessed', () => {
|
||||
it('shows an error message', async () => {
|
||||
id = websiteResponse.audits.find(a => a.status === 'FAILED')
|
||||
id = websiteResponse.audits.find((a) => a.status === 'FAILED')
|
||||
?.id as string;
|
||||
useParams.mockReturnValueOnce({ id });
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ const AuditLinkList: FC<AuditLinkListProps> = ({
|
||||
component="nav"
|
||||
aria-label="lighthouse audit history"
|
||||
>
|
||||
{audits.map(audit => (
|
||||
{audits.map((audit) => (
|
||||
<ListItem
|
||||
key={audit.id}
|
||||
selected={audit.id === selectedId}
|
||||
@@ -136,7 +136,7 @@ const ConnectedAuditView: FC<{}> = () => {
|
||||
<AuditLinkList audits={value?.audits} selectedId={params.id} />
|
||||
</Grid>
|
||||
<Grid item xs={9}>
|
||||
<AuditView audit={value?.audits.find(a => a.id === params.id)} />
|
||||
<AuditView audit={value?.audits.find((a) => a.id === params.id)} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
@@ -164,7 +164,7 @@ describe('CreateAudit', () => {
|
||||
fireEvent.click(rendered.getByText(/Create Audit/));
|
||||
|
||||
await wait(() => expect(rendered.getByLabelText(/URL/)).toBeEnabled());
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
await new Promise((r) => setTimeout(r, 0));
|
||||
|
||||
expect(errorApi.post).toHaveBeenCalledWith(expect.any(Error));
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ import { lighthouseApiRef } from '../../api';
|
||||
import { useQuery } from '../../utils';
|
||||
import LighthouseSupportButton from '../SupportButton';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
input: {
|
||||
minWidth: 300,
|
||||
},
|
||||
@@ -113,7 +113,7 @@ const CreateAudit: FC<{}> = () => {
|
||||
<Grid item xs={12} sm={6}>
|
||||
<InfoCard>
|
||||
<form
|
||||
onSubmit={ev => {
|
||||
onSubmit={(ev) => {
|
||||
ev.preventDefault();
|
||||
triggerAudit();
|
||||
}}
|
||||
@@ -128,7 +128,7 @@ const CreateAudit: FC<{}> = () => {
|
||||
helperText="The target URL for Lighthouse to use."
|
||||
required
|
||||
disabled={submitting}
|
||||
onChange={ev => setUrl(ev.target.value)}
|
||||
onChange={(ev) => setUrl(ev.target.value)}
|
||||
value={url}
|
||||
inputProps={{ 'aria-label': 'URL' }}
|
||||
/>
|
||||
@@ -142,7 +142,7 @@ const CreateAudit: FC<{}> = () => {
|
||||
select
|
||||
required
|
||||
disabled={submitting}
|
||||
onChange={ev => setEmulatedFormFactor(ev.target.value)}
|
||||
onChange={(ev) => setEmulatedFormFactor(ev.target.value)}
|
||||
value={emulatedFormFactor}
|
||||
inputProps={{ 'aria-label': 'Emulated form factor' }}
|
||||
>
|
||||
|
||||
@@ -71,7 +71,7 @@ export default builder.build() as ApiHolder;
|
||||
\`\`\`
|
||||
`;
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
tabs: { marginBottom: -18 },
|
||||
tab: { minWidth: 72, paddingLeft: 1, paddingRight: 1 },
|
||||
content: { marginBottom: theme.spacing(2) },
|
||||
|
||||
@@ -53,13 +53,13 @@ export function buildSparklinesDataForItem(
|
||||
(audit: Audit): audit is AuditCompleted => audit.status === 'COMPLETED',
|
||||
)
|
||||
.reduce((scores, audit) => {
|
||||
Object.values(audit.categories).forEach(category => {
|
||||
Object.values(audit.categories).forEach((category) => {
|
||||
scores[category.id] = scores[category.id] || [];
|
||||
scores[category.id].unshift(category.score);
|
||||
});
|
||||
|
||||
// edge case: if only one audit exists, force a "flat" sparkline
|
||||
Object.values(scores).forEach(arr => {
|
||||
Object.values(scores).forEach((arr) => {
|
||||
if (arr.length === 1) arr.push(arr[0]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user