Skip to content

Commit f9fc1f2

Browse files
committed
Fix linter.
1 parent c19f358 commit f9fc1f2

File tree

12 files changed

+67
-101
lines changed

12 files changed

+67
-101
lines changed

packages/e2e-tests/test-applications/remix-hydrogen/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Hydrogen template: Hello World
22

3-
Hydrogen is Shopify’s stack for headless commerce. Hydrogen is designed to dovetail with [Remix](https://remix.run/), Shopify’s full stack web framework. This template contains a **minimal setup** of components, queries and tooling to get started with Hydrogen.
3+
Hydrogen is Shopify’s stack for headless commerce. Hydrogen is designed to dovetail with [Remix](https://remix.run/),
4+
Shopify’s full stack web framework. This template contains a **minimal setup** of components, queries and tooling to get
5+
started with Hydrogen.
46

57
[Check out Hydrogen docs](https://shopify.dev/custom-storefronts/hydrogen)
68
[Get familiar with Remix](https://remix.run/docs/en/v1)

packages/e2e-tests/test-applications/remix-hydrogen/app/entry.client.tsx

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import {RemixBrowser, useLocation, useMatches} from '@remix-run/react';
2-
import {startTransition, StrictMode, useEffect} from 'react';
3-
import {hydrateRoot} from 'react-dom/client';
1+
import { RemixBrowser, useLocation, useMatches } from '@remix-run/react';
2+
import { startTransition, StrictMode, useEffect } from 'react';
3+
import { hydrateRoot } from 'react-dom/client';
44
import * as Sentry from '@sentry/remix';
5-
import {env} from '../env';
5+
import { env } from '../env';
66

77
Sentry.init({
88
dsn: env.SENTRY_DSN,
99
integrations: [
1010
new Sentry.BrowserTracing({
11-
routingInstrumentation: Sentry.remixRouterInstrumentation(
12-
useEffect,
13-
useLocation,
14-
useMatches,
15-
),
11+
routingInstrumentation: Sentry.remixRouterInstrumentation(useEffect, useLocation, useMatches),
1612
}),
1713
new Sentry.Replay(),
1814
],
@@ -24,11 +20,10 @@ Sentry.init({
2420
debug: true,
2521
});
2622

27-
Sentry.addGlobalEventProcessor((event) => {
23+
Sentry.addGlobalEventProcessor(event => {
2824
if (
2925
event.type === 'transaction' &&
30-
(event.contexts?.trace?.op === 'pageload' ||
31-
event.contexts?.trace?.op === 'navigation')
26+
(event.contexts?.trace?.op === 'pageload' || event.contexts?.trace?.op === 'navigation')
3227
) {
3328
const eventId = event.event_id;
3429
if (eventId) {

packages/e2e-tests/test-applications/remix-hydrogen/app/entry.server.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import type {DataFunctionArgs, EntryContext} from '@shopify/remix-oxygen';
2-
import {RemixServer} from '@remix-run/react';
1+
import type { DataFunctionArgs, EntryContext } from '@shopify/remix-oxygen';
2+
import { RemixServer } from '@remix-run/react';
33
import isbot from 'isbot';
4-
import {renderToReadableStream} from 'react-dom/server';
5-
import {createContentSecurityPolicy} from '@shopify/hydrogen';
4+
import { renderToReadableStream } from 'react-dom/server';
5+
import { createContentSecurityPolicy } from '@shopify/hydrogen';
66
import * as Sentry from '@sentry/remix';
7-
import {env} from '../env';
7+
import { env } from '../env';
88

99
Sentry.workerInit({
1010
dsn: env.SENTRY_DSN,
1111
// Performance Monitoring
1212
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
1313
});
1414

15-
export function handleError(error: unknown, {request}: DataFunctionArgs): void {
15+
export function handleError(error: unknown, { request }: DataFunctionArgs): void {
1616
Sentry.captureRemixServerException(error, 'remix.server', request);
1717
}
1818

@@ -22,7 +22,7 @@ export default async function handleRequest(
2222
responseHeaders: Headers,
2323
remixContext: EntryContext,
2424
) {
25-
const {nonce, header, NonceProvider} = createContentSecurityPolicy();
25+
const { nonce, header, NonceProvider } = createContentSecurityPolicy();
2626

2727
const body = await renderToReadableStream(
2828
<NonceProvider>

packages/e2e-tests/test-applications/remix-hydrogen/app/root.tsx

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {type LinksFunction, type LoaderArgs} from '@shopify/remix-oxygen';
1+
import { type LinksFunction, type LoaderArgs } from '@shopify/remix-oxygen';
22
import {
33
Links,
44
Meta,
@@ -10,18 +10,14 @@ import {
1010
type ShouldRevalidateFunction,
1111
useRouteError,
1212
} from '@remix-run/react';
13-
import type {Shop} from '@shopify/hydrogen/storefront-api-types';
13+
import type { Shop } from '@shopify/hydrogen/storefront-api-types';
1414
import appStyles from './styles/app.css';
1515
import favicon from '../public/favicon.svg';
16-
import {useNonce} from '@shopify/hydrogen';
16+
import { useNonce } from '@shopify/hydrogen';
1717
import * as Sentry from '@sentry/remix';
1818

1919
// This is important to avoid re-fetching root queries on sub-navigations
20-
export const shouldRevalidate: ShouldRevalidateFunction = ({
21-
formMethod,
22-
currentUrl,
23-
nextUrl,
24-
}) => {
20+
export const shouldRevalidate: ShouldRevalidateFunction = ({ formMethod, currentUrl, nextUrl }) => {
2521
// revalidate when a mutation is performed e.g add to cart, login...
2622
if (formMethod && formMethod !== 'GET') {
2723
return true;
@@ -37,7 +33,7 @@ export const shouldRevalidate: ShouldRevalidateFunction = ({
3733

3834
export const links: LinksFunction = () => {
3935
return [
40-
{rel: 'stylesheet', href: appStyles},
36+
{ rel: 'stylesheet', href: appStyles },
4137
{
4238
rel: 'preconnect',
4339
href: 'https://cdn.shopify.com',
@@ -46,12 +42,12 @@ export const links: LinksFunction = () => {
4642
rel: 'preconnect',
4743
href: 'https://shop.app',
4844
},
49-
{rel: 'icon', type: 'image/svg+xml', href: favicon},
45+
{ rel: 'icon', type: 'image/svg+xml', href: favicon },
5046
];
5147
};
5248

53-
export async function loader({context}: LoaderArgs) {
54-
const layout = await context.storefront.query<{shop: Shop}>(LAYOUT_QUERY);
49+
export async function loader({ context }: LoaderArgs) {
50+
const layout = await context.storefront.query<{ shop: Shop }>(LAYOUT_QUERY);
5551
return {
5652
layout,
5753
};
@@ -73,7 +69,7 @@ function App() {
7369
const nonce = useNonce();
7470
const data = useLoaderData<typeof loader>();
7571

76-
const {name} = data.layout.shop;
72+
const { name } = data.layout.shop;
7773

7874
return (
7975
<html lang="en">

packages/e2e-tests/test-applications/remix-hydrogen/app/routes/_index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Sentry from '@sentry/remix';
2-
import {Link} from '@remix-run/react';
2+
import { Link } from '@remix-run/react';
33

44
export default function Index() {
55
return (

packages/e2e-tests/test-applications/remix-hydrogen/app/routes/client-error.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useEffect, useState} from 'react';
1+
import { useEffect, useState } from 'react';
22

33
export default function ErrorBoundaryCapture() {
44
const [count, setCount] = useState(0);

packages/e2e-tests/test-applications/remix-hydrogen/app/routes/server-error.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import {json} from '@shopify/remix-oxygen';
2-
import {useLoaderData} from '@remix-run/react';
1+
import { json } from '@shopify/remix-oxygen';
2+
import { useLoaderData } from '@remix-run/react';
33
import * as Sentry from '@sentry/remix';
44

55
export function loader() {
66
const id = Sentry.captureException(new Error('Sentry Server Error'));
77

8-
return json({id});
8+
return json({ id });
99
}
1010

1111
export default function ServerError() {
12-
const {id} = useLoaderData();
12+
const { id } = useLoaderData();
1313

1414
return (
1515
<div>

packages/e2e-tests/test-applications/remix-hydrogen/app/styles/app.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
body {
22
margin: 0;
3-
background: #FFFFFF;
4-
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
5-
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
3+
background: #ffffff;
4+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
5+
'Helvetica Neue', sans-serif;
66
padding: 20px;
77
}
88

packages/e2e-tests/test-applications/remix-hydrogen/playwright.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type {PlaywrightTestConfig} from '@playwright/test';
2-
import {devices} from '@playwright/test';
1+
import type { PlaywrightTestConfig } from '@playwright/test';
2+
import { devices } from '@playwright/test';
33

44
const port = 3030;
55

packages/e2e-tests/test-applications/remix-hydrogen/remix.env.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
// Enhance TypeScript's built-in typings.
66
import '@total-typescript/ts-reset';
77

8-
import type {Storefront} from '@shopify/hydrogen';
9-
import type {HydrogenSession} from './server';
8+
import type { Storefront } from '@shopify/hydrogen';
9+
import type { HydrogenSession } from './server';
1010

1111
declare global {
1212
/**
1313
* A global `process` object is only available during build to access NODE_ENV.
1414
*/
15-
const process: {env: {NODE_ENV: 'production' | 'development'}};
15+
const process: { env: { NODE_ENV: 'production' | 'development' } };
1616

1717
/**
1818
* Declare expected Env parameter in fetch handler.

packages/e2e-tests/test-applications/remix-hydrogen/server.ts

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Virtual entry point for the app
22
import * as remixBuild from '@remix-run/dev/server-build';
3-
import {createStorefrontClient, storefrontRedirect} from '@shopify/hydrogen';
3+
import { createStorefrontClient, storefrontRedirect } from '@shopify/hydrogen';
44
import {
55
createRequestHandler,
66
getStorefrontHeaders,
@@ -13,11 +13,7 @@ import {
1313
* Export a fetch handler in module format.
1414
*/
1515
export default {
16-
async fetch(
17-
request: Request,
18-
env: Env,
19-
executionContext: ExecutionContext,
20-
): Promise<Response> {
16+
async fetch(request: Request, env: Env, executionContext: ExecutionContext): Promise<Response> {
2117
try {
2218
/**
2319
* Open a cache instance in the worker and a custom session instance.
@@ -35,10 +31,10 @@ export default {
3531
/**
3632
* Create Hydrogen's Storefront client.
3733
*/
38-
const {storefront} = createStorefrontClient({
34+
const { storefront } = createStorefrontClient({
3935
cache,
4036
waitUntil,
41-
i18n: {language: 'EN', country: 'US'},
37+
i18n: { language: 'EN', country: 'US' },
4238
publicStorefrontToken: env.PUBLIC_STOREFRONT_API_TOKEN,
4339
privateStorefrontToken: env.PRIVATE_STOREFRONT_API_TOKEN,
4440
storeDomain: env.PUBLIC_STORE_DOMAIN,
@@ -53,7 +49,7 @@ export default {
5349
const handleRequest = createRequestHandler({
5450
build: remixBuild,
5551
mode: process.env.NODE_ENV,
56-
getLoadContext: () => ({session, storefront, env, waitUntil}),
52+
getLoadContext: () => ({ session, storefront, env, waitUntil }),
5753
});
5854

5955
const response = await handleRequest(request);
@@ -64,14 +60,14 @@ export default {
6460
* If the redirect doesn't exist, then `storefrontRedirect`
6561
* will pass through the 404 response.
6662
*/
67-
return storefrontRedirect({request, response, storefront});
63+
return storefrontRedirect({ request, response, storefront });
6864
}
6965

7066
return response;
7167
} catch (error) {
7268
// eslint-disable-next-line no-console
7369
console.error(error);
74-
return new Response('An unexpected error occurred', {status: 500});
70+
return new Response('An unexpected error occurred', { status: 500 });
7571
}
7672
},
7773
};
@@ -82,10 +78,7 @@ export default {
8278
* swap out the cookie-based implementation with something else!
8379
*/
8480
export class HydrogenSession {
85-
constructor(
86-
private sessionStorage: SessionStorage,
87-
private session: Session,
88-
) {}
81+
constructor(private sessionStorage: SessionStorage, private session: Session) {}
8982

9083
static async init(request: Request, secrets: string[]) {
9184
const storage = createCookieSessionStorage({

0 commit comments

Comments
 (0)