Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lizkenyon committed Feb 23, 2024
1 parent 23b034a commit 9525b31
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions packages/shopify-app-express/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ If you need to explicitly set those generics, you'll need to use the `AppConfigP
Before:

```ts
import { ShopifyApp } from "@shopify/shopify-app-express";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-10";
import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory";
import {ShopifyApp} from '@shopify/shopify-app-express';
import {restResources} from '@shopify/shopify-api/rest/admin/2023-10';
import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory';

const myVariable: ShopifyApp<typeof restResources, MemorySessionStorage>;
```

After:

```ts
import { ShopifyApp, AppConfigParams } from "@shopify/shopify-app-express";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-10";
import { MemorySessionStorage } from "@shopify/shopify-app-session-storage-memory";
import {ShopifyApp, AppConfigParams} from '@shopify/shopify-app-express';
import {restResources} from '@shopify/shopify-api/rest/admin/2023-10';
import {MemorySessionStorage} from '@shopify/shopify-app-session-storage-memory';

const myVariable: ShopifyApp<
AppConfigParams<typeof restResources, MemorySessionStorage>
Expand Down
98 changes: 49 additions & 49 deletions packages/shopify-app-remix/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@
When using variables, `data` needs to be an object containing `query` and `variables`.

```ts
import { json, ActionFunctionArgs } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import {json, ActionFunctionArgs} from '@remix-run/node';
import {authenticate} from '../shopify.server';

export async function action({ request }: ActionFunctionArgs) {
const { admin } = await authenticate.webhook(request);
export async function action({request}: ActionFunctionArgs) {
const {admin} = await authenticate.webhook(request);

const response = await admin?.graphql.query<any>({
data: {
Expand All @@ -222,23 +222,23 @@
}
}
}`,
variables: { input: { title: "Product Name" } },
variables: {input: {title: 'Product Name'}},
},
});

const productData = response?.body.data;
return json({ data: productData.data });
return json({data: productData.data});
}
```

With the `v3_webhookContext` flag enabled, `graphql` _is_ a function that takes in the query string and an optional settings object, including `variables`.

```ts
import { ActionFunctionArgs } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import {ActionFunctionArgs} from '@remix-run/node';
import {authenticate} from '../shopify.server';

export async function action({ request }: ActionFunctionArgs) {
const { admin } = await authenticate.webhook(request);
export async function action({request}: ActionFunctionArgs) {
const {admin} = await authenticate.webhook(request);

const response = await admin?.graphql(
`#graphql
Expand All @@ -249,11 +249,11 @@
}
}
}`,
{ variables: { input: { title: "Product Name" } } },
{variables: {input: {title: 'Product Name'}}},
);

const productData = await response.json();
return json({ data: productData.data });
return json({data: productData.data});
}
```

Expand All @@ -279,12 +279,12 @@
<summary>App Proxy</summary>

```ts
import { json } from "@remix-run/node";
import { authenticate } from "~/shopify.server";
import {json} from '@remix-run/node';
import {authenticate} from '~/shopify.server';

export async function loader({ request }) {
const { storefront } = await authenticate.public.appProxy(request);
const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}");
export async function loader({request}) {
const {storefront} = await authenticate.public.appProxy(request);
const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}');

return json(await response.json());
}
Expand All @@ -296,17 +296,17 @@
<summary>Unauthenticated Storefront</summary>

```ts
import { json } from "@remix-run/node";
import { unauthenticated } from "~/shopify.server";
import { customAuthenticateRequest } from "~/helpers";
import {json} from '@remix-run/node';
import {unauthenticated} from '~/shopify.server';
import {customAuthenticateRequest} from '~/helpers';

export async function loader({ request }) {
export async function loader({request}) {
await customAuthenticateRequest(request);

const { storefront } = await unauthenticated.storefront(
"my-shop.myshopify.com",
const {storefront} = await unauthenticated.storefront(
'my-shop.myshopify.com',
);
const response = await storefront.graphql("{blogs(first: 10) {nodes{id}}}");
const response = await storefront.graphql('{blogs(first: 10) {nodes{id}}}');

return json(await response.json());
}
Expand All @@ -322,17 +322,17 @@
<summary>Override billing configs when calling <code>request</code></summary>

```ts
import { json } from "@remix-run/node";
import { authenticate } from "~/shopify.server";
import {json} from '@remix-run/node';
import {authenticate} from '~/shopify.server';

export async function loader({ request }) {
const { billing } = await authenticate.admin(request);
export async function loader({request}) {
const {billing} = await authenticate.admin(request);

await billing.require({
plans: ["plan1", "plan2"],
plans: ['plan1', 'plan2'],
onFailure: async () =>
await billing.request({
plan: "plan1",
plan: 'plan1',
trialDays: 5, // Override the trialDays config value
}),
});
Expand Down Expand Up @@ -364,12 +364,12 @@

```ts
// app/routes/**\/.ts
import { authenticate } from "~/shopify.server";
import {authenticate} from '~/shopify.server';

export async function loader({ request }) {
const { liquid, admin } = authenticate.public.appProxy(request);
export async function loader({request}) {
const {liquid, admin} = authenticate.public.appProxy(request);

return liquid("Hello {{shop.name}}");
return liquid('Hello {{shop.name}}');
}
```

Expand All @@ -380,12 +380,12 @@

```ts
// app/routes/**\/.ts
import { authenticate } from "~/shopify.server";
import {authenticate} from '~/shopify.server';

export async function loader({ request }) {
const { liquid, admin } = authenticate.public.appProxy(request);
export async function loader({request}) {
const {liquid, admin} = authenticate.public.appProxy(request);

const response = await admin.graphql("QUERY");
const response = await admin.graphql('QUERY');
const json = await response.json();

return json(json);
Expand Down Expand Up @@ -422,8 +422,8 @@

```ts
// app/shopify.server.ts
import { shopifyApp } from "@shopify/shopify-app-remix";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
import {shopifyApp} from '@shopify/shopify-app-remix';
import {restResources} from '@shopify/shopify-api/rest/admin/2023-04';

const shopify = shopifyApp({
restResources,
Expand All @@ -433,15 +433,15 @@
export default shopify;

// app/routes/\/.jsx
import { json } from "@remix-run/node";
import { authenticateExternalRequest } from "~/helpers/authenticate";
import shopify from "../../shopify.server";
import {json} from '@remix-run/node';
import {authenticateExternalRequest} from '~/helpers/authenticate';
import shopify from '../../shopify.server';

export async function loader({ request }) {
export async function loader({request}) {
const shop = await authenticateExternalRequest(request);
const { admin, session } = await shopify.unauthenticated.admin(shop);
const {admin, session} = await shopify.unauthenticated.admin(shop);

return json(await admin.rest.resources.Product.count({ session }));
return json(await admin.rest.resources.Product.count({session}));
}
```

Expand All @@ -455,10 +455,10 @@
<summary>See an example</summary>

```ts
export const loader = async ({ request }) => {
const { redirect } = await authenticate.admin(request);
export const loader = async ({request}) => {
const {redirect} = await authenticate.admin(request);

return redirect("https://www.example.com", { target: "_top" });
return redirect('https://www.example.com', {target: '_top'});
};
```

Expand Down

0 comments on commit 9525b31

Please sign in to comment.