Skip to content

Commit 00d52a6

Browse files
committed
chore: appy linting
1 parent f4ec791 commit 00d52a6

File tree

12 files changed

+150
-86
lines changed

12 files changed

+150
-86
lines changed

playground/components/GithubDemo.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@
2222
</div>
2323

2424
<div class="mt-4 flex flex-wrap gap-3 items-center">
25-
<UButton :disabled="!githubToken" @click="getViewer">
25+
<UButton
26+
:disabled="!githubToken"
27+
@click="getViewer"
28+
>
2629
Load @me
2730
</UButton>
2831

29-
<UButton :disabled="!githubToken" @click="getNuxtDiscussions">
32+
<UButton
33+
:disabled="!githubToken"
34+
@click="getNuxtDiscussions"
35+
>
3036
Load Nuxt Discussions
3137
</UButton>
3238
</div>
@@ -71,7 +77,9 @@ const whoAmI = await useAsyncQuery({ query: queryViewer, clientId: 'github' }, {
7177
})
7278
7379
watch(whoAmI.data, (data) => {
74-
if (!data) { return }
80+
if (!data) {
81+
return
82+
}
7583
7684
output.value = data
7785
}, { immediate: true })
@@ -91,7 +99,9 @@ const getNuxtDiscussions = () => {
9199
}
92100
93101
const setToken = () => {
94-
if (!githubToken.value) { return }
102+
if (!githubToken.value) {
103+
return
104+
}
95105
96106
onLogin(githubToken.value, 'github')
97107
}

playground/components/StarlinkDemo.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@
1818

1919
<UCard class="p-4">
2020
<div class="mb-4">
21-
<label for="limit" class="mr-2">Limit:</label>
22-
<input v-model.number="limit" class="w-10" type="number" min="1">
21+
<label
22+
for="limit"
23+
class="mr-2"
24+
>Limit:</label>
25+
<input
26+
v-model.number="limit"
27+
class="w-10"
28+
type="number"
29+
min="1"
30+
>
2331
</div>
2432

2533
<div>

playground/components/TodosDemo.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
Load Todos
1111
</UButton>
1212

13-
<UButton :disabled="!subscribe" @click="createTodo">
13+
<UButton
14+
:disabled="!subscribe"
15+
@click="createTodo"
16+
>
1417
Create Todo
1518
</UButton>
1619

17-
<UButton :disabled="subscribe" @click="todoAdded">
20+
<UButton
21+
:disabled="subscribe"
22+
@click="todoAdded"
23+
>
1824
Subscribe
1925
</UButton>
2026
</div>
@@ -40,7 +46,7 @@ const { data, refresh } = await useAsyncQuery<TodoEntry[]>(gqlTodos, null, 'todo
4046
4147
const { mutate: todoMutation } = useMutation(gqlCreateTodo, { clientId: 'todos' })
4248
43-
function createTodo () {
49+
function createTodo() {
4450
todoMutation({
4551
todo: {
4652
text: 'Random ' + Math.floor(Math.random() * 100)
@@ -50,7 +56,7 @@ function createTodo () {
5056
5157
const subscribe = ref(false)
5258
53-
function todoAdded () {
59+
function todoAdded() {
5460
subscribe.value = true
5561
5662
const { onResult, onError } = useSubscription(gqlTodoAdded, null, { clientId: 'todos' })
@@ -60,7 +66,6 @@ function todoAdded () {
6066
})
6167
6268
onError((e) => {
63-
6469
console.log(e)
6570
})
6671
}

playground/globals.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
declare module '*.gql' {
22
import type { DocumentNode } from 'graphql'
3+
34
const Schema: DocumentNode
45
export = Schema
56
}
67

78
declare module '*.graphql' {
89
import type { DocumentNode } from 'graphql'
10+
911
const Schema: DocumentNode
1012
export = Schema
1113
}

playground/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default defineNuxtConfig({
2-
devtools: { enabled: true },
32

43
modules: ['@nuxt/ui', '@nuxtjs/apollo'],
4+
devtools: { enabled: true },
55

66
colorMode: {
77
preference: 'dark',

playground/plugins/apollo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import type { ErrorResponse } from '@nuxtjs/apollo'
33
export default defineNuxtPlugin((nuxtApp) => {
44
// Nuxt Apollo auth hook
55
nuxtApp.hook('apollo:auth', ({ client, token }) => {
6-
if (client !== 'todos') { return }
6+
if (client !== 'todos') {
7+
return
8+
}
79

810
// Pass token to the `todos` client
911
token.value = '<secret_token>'
1012
})
1113

1214
// Nuxt Apollo error hook
1315
nuxtApp.hook('apollo:error', (error: ErrorResponse) => {
14-
1516
console.log('Apollo Error Handler', error)
1617
})
1718
})

playground/types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
export type LaunchesT = {
22
launches?: {
3-
id: number,
3+
id: number
44
details: string
55
mission_name: string
66
launch_year: number
77
launch_success: boolean
88
links: {
9-
article_link: string,
9+
article_link: string
1010
flickr_images: string[]
11-
},
11+
}
1212
rocket: {
13-
rocket_name:string
13+
rocket_name: string
1414
rocket_type: string
1515
}
1616
}

src/module.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default defineNuxtModule<ModuleOptions>({
4141
},
4242
clientAwareness: false
4343
},
44-
async setup (options, nuxt) {
44+
async setup(options, nuxt) {
4545
if (!options.clients || !Object.keys(options.clients).length) {
4646
logger.warn('No apollo clients configured.')
4747
return
@@ -62,7 +62,7 @@ export default defineNuxtModule<ModuleOptions>({
6262
const clients: Record<string, ClientConfig> = {}
6363
const configPaths: Record<string, string> = {}
6464

65-
async function prepareClients () {
65+
async function prepareClients() {
6666
// eslint-disable-next-line prefer-const
6767
for (let [k, v] of Object.entries(options.clients || {})) {
6868
if (typeof v === 'string') {
@@ -75,14 +75,18 @@ export default defineNuxtModule<ModuleOptions>({
7575
}
7676

7777
v = resolvedConfig
78-
if (!configPaths[k]) { configPaths[k] = path }
78+
if (!configPaths[k]) {
79+
configPaths[k] = path
80+
}
7981
}
8082

8183
v.authType = (v?.authType === undefined ? options.authType : v?.authType) || null
8284
v.authHeader = v?.authHeader || options.authHeader
8385
v.tokenName = v?.tokenName || `apollo:${k}.token`
8486
v.tokenStorage = v?.tokenStorage || options.tokenStorage
85-
if (v.cookieAttributes) { v.cookieAttributes = defu(v?.cookieAttributes, options.cookieAttributes) }
87+
if (v.cookieAttributes) {
88+
v.cookieAttributes = defu(v?.cookieAttributes, options.cookieAttributes)
89+
}
8690

8791
v.defaultOptions = v?.defaultOptions || options.defaultOptions
8892

@@ -163,15 +167,19 @@ export default defineNuxtModule<ModuleOptions>({
163167
config.plugins = config.plugins || []
164168
config.plugins.push(GraphQLPlugin() as PluginOption)
165169

166-
if (!nuxt.options.dev) { config.define = { ...config.define, __DEV__: false } }
170+
if (!nuxt.options.dev) {
171+
config.define = { ...config.define, __DEV__: false }
172+
}
167173
})
168174

169175
nuxt.hook('webpack:config', (configs) => {
170176
for (const config of configs) {
171177
// eslint-disable-next-line @typescript-eslint/no-explicit-any
172178
const hasGqlLoader = config.module.rules.some((rule: any) => rule?.use === 'graphql-tag/loader')
173179

174-
if (hasGqlLoader) { return }
180+
if (hasGqlLoader) {
181+
return
182+
}
175183

176184
config.module.rules.push({
177185
test: /\.(graphql|gql)$/,
@@ -182,7 +190,9 @@ export default defineNuxtModule<ModuleOptions>({
182190
})
183191

184192
nuxt.hook('builder:watch', async (_event, path) => {
185-
if (!Object.values(configPaths).some(p => p.includes(path))) { return }
193+
if (!Object.values(configPaths).some(p => p.includes(path))) {
194+
return
195+
}
186196

187197
logger.log('[@nuxtjs/apollo] Reloading Apollo configuration')
188198

0 commit comments

Comments
 (0)