Skip to content

Commit 5d474ce

Browse files
committed
[CodeFactor] Apply fixes
1 parent 4cf88f3 commit 5d474ce

File tree

8 files changed

+150
-150
lines changed

8 files changed

+150
-150
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import { object, string, number } from 'yup'
1+
import { object, string, number } from "yup";
22

33
export const BILLING_FIELDS = [
44
{
5-
inputId: 'firstName',
6-
label: 'First name',
5+
inputId: "firstName",
6+
label: "First name",
77
},
88
{
9-
inputId: 'lastName',
10-
label: 'Last name',
9+
inputId: "lastName",
10+
label: "Last name",
1111
},
1212
{
13-
inputId: 'address1',
14-
label: 'Address',
13+
inputId: "address1",
14+
label: "Address",
1515
},
1616
{
17-
inputId: 'postcode',
18-
label: 'Postcode',
17+
inputId: "postcode",
18+
label: "Postcode",
1919
},
2020
{
21-
inputId: 'city',
22-
label: 'City',
21+
inputId: "city",
22+
label: "City",
2323
},
2424
{
25-
inputId: 'email',
26-
label: 'Email',
25+
inputId: "email",
26+
label: "Email",
2727
},
2828
{
29-
inputId: 'phone',
30-
label: 'Phone',
29+
inputId: "phone",
30+
label: "Phone",
3131
},
32-
]
32+
];
3333

3434
export const BILLING_SCHEMA = object().shape({
3535
firstName: string().required(),
@@ -39,4 +39,4 @@ export const BILLING_SCHEMA = object().shape({
3939
city: string().required(),
4040
email: string().required().email(),
4141
phone: number().required().moreThan(11_111_111),
42-
})
42+
});

nuxt.config.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22

3-
import { defineNuxtConfig } from 'nuxt/config'
3+
import { defineNuxtConfig } from "nuxt/config";
44

55
export default defineNuxtConfig({
66
ssr: true,
77
components: true,
8-
css: ['~/assets/css/main.css', '~/assets/css/animate.min.css'],
8+
css: ["~/assets/css/main.css", "~/assets/css/animate.min.css"],
99
modules: [
10-
'@pinia/nuxt',
11-
'@nuxtjs/apollo',
12-
'@formkit/nuxt',
13-
'@nuxtjs/algolia',
10+
"@pinia/nuxt",
11+
"@nuxtjs/apollo",
12+
"@formkit/nuxt",
13+
"@nuxtjs/algolia",
1414
],
15-
plugins: ['~/plugins/apollo'],
15+
plugins: ["~/plugins/apollo"],
1616
runtimeConfig: { public: { graphqlURL: process.env.PUBLIC_GRAPHQL_URL } },
1717
postcss: {
1818
plugins: {
@@ -22,31 +22,31 @@ export default defineNuxtConfig({
2222
},
2323
app: {
2424
head: {
25-
charset: 'utf-16',
26-
viewport: 'width=500, initial-scale=1',
27-
meta: [{ name: 'description', content: 'Nuxt 3 - Woocommerce' }],
25+
charset: "utf-16",
26+
viewport: "width=500, initial-scale=1",
27+
meta: [{ name: "description", content: "Nuxt 3 - Woocommerce" }],
2828
},
2929
// global transition
30-
pageTransition: { name: 'page', mode: 'out-in' },
31-
layoutTransition: { name: 'layout', mode: 'out-in' },
30+
pageTransition: { name: "page", mode: "out-in" },
31+
layoutTransition: { name: "layout", mode: "out-in" },
3232
},
3333
algolia: {
3434
apiKey: process.env.ALGOLIA_SEARCH_API_KEY,
3535
applicationId: process.env.ALGOLIA_APPLICATION_ID,
36-
instantSearch: { theme: 'algolia' },
36+
instantSearch: { theme: "algolia" },
3737
},
3838
apollo: {
39-
authType: 'Session',
40-
authHeader: 'woocommerce-session',
41-
tokenStorage: 'cookie',
42-
tokenName: 'woocommerce-session',
39+
authType: "Session",
40+
authHeader: "woocommerce-session",
41+
tokenStorage: "cookie",
42+
tokenName: "woocommerce-session",
4343
clients: {
4444
default: {
4545
httpEndpoint: process.env.PUBLIC_GRAPHQL_URL,
4646
httpLinkOptions: {
47-
credentials: 'include',
47+
credentials: "include",
4848
},
4949
},
5050
},
5151
},
52-
})
52+
});
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
import { object, string, number } from 'yup'
1+
import { object, string, number } from "yup";
22

33
export const BILLING_FIELDS = [
44
{
5-
inputId: 'firstName',
6-
label: 'First name',
5+
inputId: "firstName",
6+
label: "First name",
77
},
88
{
9-
inputId: 'lastName',
10-
label: 'Last name',
9+
inputId: "lastName",
10+
label: "Last name",
1111
},
1212
{
13-
inputId: 'address1',
14-
label: 'Address',
13+
inputId: "address1",
14+
label: "Address",
1515
},
1616
{
17-
inputId: 'postcode',
18-
label: 'Postcode',
17+
inputId: "postcode",
18+
label: "Postcode",
1919
},
2020
{
21-
inputId: 'city',
22-
label: 'City',
21+
inputId: "city",
22+
label: "City",
2323
},
2424
{
25-
inputId: 'email',
26-
label: 'Email',
25+
inputId: "email",
26+
label: "Email",
2727
},
2828
{
29-
inputId: 'phone',
30-
label: 'Phone',
29+
inputId: "phone",
30+
label: "Phone",
3131
},
32-
]
32+
];
3333

3434
export const BILLING_SCHEMA = object().shape({
3535
firstName: string().required(),
@@ -39,4 +39,4 @@ export const BILLING_SCHEMA = object().shape({
3939
city: string().required(),
4040
email: string().required().email(),
4141
phone: number().required().moreThan(11_111_111),
42-
})
42+
});

nuxt3/nuxt.config.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22

3-
import { defineNuxtConfig } from 'nuxt/config'
3+
import { defineNuxtConfig } from "nuxt/config";
44

55
export default defineNuxtConfig({
66
ssr: true,
77
components: true,
8-
css: ['~/assets/css/main.css', '~/assets/css/animate.min.css'],
8+
css: ["~/assets/css/main.css", "~/assets/css/animate.min.css"],
99
modules: [
10-
'@pinia/nuxt',
11-
'@nuxtjs/apollo',
12-
'@formkit/nuxt',
13-
'@nuxtjs/algolia',
10+
"@pinia/nuxt",
11+
"@nuxtjs/apollo",
12+
"@formkit/nuxt",
13+
"@nuxtjs/algolia",
1414
],
15-
plugins: ['~/plugins/apollo'],
15+
plugins: ["~/plugins/apollo"],
1616
runtimeConfig: { public: { graphqlURL: process.env.PUBLIC_GRAPHQL_URL } },
1717
postcss: {
1818
plugins: {
@@ -22,31 +22,31 @@ export default defineNuxtConfig({
2222
},
2323
app: {
2424
head: {
25-
charset: 'utf-16',
26-
viewport: 'width=500, initial-scale=1',
27-
meta: [{ name: 'description', content: 'Nuxt 3 - Woocommerce' }],
25+
charset: "utf-16",
26+
viewport: "width=500, initial-scale=1",
27+
meta: [{ name: "description", content: "Nuxt 3 - Woocommerce" }],
2828
},
2929
// global transition
30-
pageTransition: { name: 'page', mode: 'out-in' },
31-
layoutTransition: { name: 'layout', mode: 'out-in' },
30+
pageTransition: { name: "page", mode: "out-in" },
31+
layoutTransition: { name: "layout", mode: "out-in" },
3232
},
3333
algolia: {
3434
apiKey: process.env.ALGOLIA_SEARCH_API_KEY,
3535
applicationId: process.env.ALGOLIA_APPLICATION_ID,
36-
instantSearch: { theme: 'algolia' },
36+
instantSearch: { theme: "algolia" },
3737
},
3838
apollo: {
39-
authType: 'Session',
40-
authHeader: 'woocommerce-session',
41-
tokenStorage: 'cookie',
42-
tokenName: 'woocommerce-session',
39+
authType: "Session",
40+
authHeader: "woocommerce-session",
41+
tokenStorage: "cookie",
42+
tokenName: "woocommerce-session",
4343
clients: {
4444
default: {
4545
httpEndpoint: process.env.PUBLIC_GRAPHQL_URL,
4646
httpLinkOptions: {
47-
credentials: 'include',
47+
credentials: "include",
4848
},
4949
},
5050
},
5151
},
52-
})
52+
});

nuxt3/plugins/apollo.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import {
33
ApolloLink,
44
InMemoryCache,
55
ApolloClient,
6-
} from '@apollo/client/core'
6+
} from "@apollo/client/core";
77

8-
import { provideApolloClient } from '@vue/apollo-composable'
8+
import { provideApolloClient } from "@vue/apollo-composable";
99

1010
export default defineNuxtPlugin((nuxtApp) => {
11-
const cookie = useCookie('woo-session', {
11+
const cookie = useCookie("woo-session", {
1212
maxAge: 86_400,
13-
sameSite: 'none',
13+
sameSite: "none",
1414
secure: true,
15-
})
16-
const config = useRuntimeConfig()
15+
});
16+
const config = useRuntimeConfig();
1717

1818
const httpLink = createHttpLink({
1919
uri: config.graphqlURL,
20-
})
20+
});
2121

2222
const middleware = new ApolloLink((operation, forward) => {
2323
/**
@@ -27,46 +27,46 @@ export default defineNuxtPlugin((nuxtApp) => {
2727
if (process.client && cookie.value) {
2828
operation.setContext(() => ({
2929
headers: {
30-
'woocommerce-session': `Session ${cookie.value}`,
30+
"woocommerce-session": `Session ${cookie.value}`,
3131
},
32-
}))
32+
}));
3333
}
3434

35-
return forward(operation)
36-
})
35+
return forward(operation);
36+
});
3737

3838
const afterware = new ApolloLink((operation, forward) =>
3939
forward(operation).map((response) => {
4040
/**
4141
* Check for session header and update session in local storage accordingly.
4242
*/
43-
const context = operation.getContext()
43+
const context = operation.getContext();
4444

4545
const {
4646
response: { headers },
47-
} = context
47+
} = context;
4848

49-
const session = headers.get('woocommerce-session') || cookie.value
49+
const session = headers.get("woocommerce-session") || cookie.value;
5050

5151
if (process.client && session) {
52-
cookie.value = session
52+
cookie.value = session;
5353
}
54-
return response
54+
return response;
5555
})
56-
)
56+
);
5757

5858
// Cache implementation
59-
const cache = new InMemoryCache()
59+
const cache = new InMemoryCache();
6060

6161
// Create the apollo client
6262
const apolloClient = new ApolloClient({
6363
link: middleware.concat(afterware.concat(httpLink)),
6464
cache,
65-
})
65+
});
6666

67-
provideApolloClient(apolloClient)
67+
provideApolloClient(apolloClient);
6868

69-
nuxtApp.hook('apollo:auth', ({ token }) => {
70-
token.value = cookie.value
71-
})
72-
})
69+
nuxtApp.hook("apollo:auth", ({ token }) => {
70+
token.value = cookie.value;
71+
});
72+
});

0 commit comments

Comments
 (0)