Skip to content

Commit 3c46cff

Browse files
committed
chore: broken linting
1 parent b27d4ee commit 3c46cff

21 files changed

+64
-53
lines changed

docs/pages/index.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ const { $script } = useScript<JSConfettiApi>({
8181
},
8282
})
8383
onMounted(() => {
84-
confettiEl.value && useEventListener(confettiEl.value, 'mouseenter', () => {
85-
$script.then(({ JSConfetti }) => {
86-
new JSConfetti().addConfetti({ emojis: ['🎉', '🎊'] })
84+
if (confettiEl.value) {
85+
useEventListener(confettiEl.value, 'mouseenter', () => {
86+
$script.then(({ JSConfetti }) => {
87+
new JSConfetti().addConfetti({ emojis: ['🎉', '🎊'] })
88+
})
8789
})
88-
})
90+
}
8991
})
9092
9193
const links = [

playground/pages/npm/js-confetti.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface JSConfettiApi {
1111
}
1212
1313
declare global {
14-
interface Window extends JSConfettiApi {}
14+
type Window = JSConfettiApi
1515
}
1616
1717
const { $script } = useScriptNpm<JSConfettiApi>({

playground/scripts/myCustomScript.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import type { Input } from 'valibot'
33
import { useScript } from '#imports'
44
import type { NuxtUseScriptOptions } from '#nuxt-scripts'
55

6-
export interface MyCustomScriptApi {
7-
}
6+
export type MyCustomScriptApi = Record<string, any>
87

98
export const MyCustomScriptOptions = object({
109
id: string(),

scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function generateTpcContent(input: TpcDescriptor) {
3535

3636
chunks.push(`
3737
declare global {
38-
interface Window extends ${input.tpcTypeAugmentation} {}
38+
type Window = ${input.tpcTypeAugmentation}
3939
}`)
4040
}
4141

src/devtools.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { useNuxt } from '@nuxt/kit'
55
import type { ModuleOptions } from './module'
66
import { DEVTOOLS_UI_LOCAL_PORT, DEVTOOLS_UI_ROUTE } from './constants'
77

8-
export interface ServerFunctions {}
9-
10-
export interface ClientFunctions {}
11-
128
export function setupDevToolsUI(options: ModuleOptions, resolve: Resolver['resolve'], nuxt: Nuxt = useNuxt()) {
139
const clientPath = resolve('./client')
1410
const isProductionBuild = existsSync(clientPath)

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default defineNuxtModule<ModuleOptions>({
131131
nuxt.hooks.hook('modules:done', async () => {
132132
const registryScripts = [...scripts]
133133

134-
// @ts-ignore nuxi prepare is broken to generate these types, possibly because of the runtime path
134+
// @ts-expect-error nuxi prepare is broken to generate these types, possibly because of the runtime path
135135
await nuxt.hooks.callHook('scripts:registry', registryScripts)
136136
const registryScriptsWithImport = registryScripts.filter(i => !!i.import?.name) as Required<RegistryScript>[]
137137
addImports(registryScriptsWithImport.map((i) => {

src/runtime/components/ScriptGoogleMaps.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ defineExpose({
135135
136136
onMounted(() => {
137137
watch(ready, (v) => {
138-
v && emits('ready', map)
138+
if (v) {
139+
emits('ready', map)
140+
}
139141
})
140142
watch($script.status, () => {
141143
if ($script.status.value === 'error') {

src/runtime/components/ScriptVimeoPlayer.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ onMounted(() => {
188188
})
189189
190190
watch(() => props.id, (v) => {
191-
v && player?.loadVideo(Number(v))
191+
if (v) {
192+
player?.loadVideo(Number(v))
193+
}
192194
})
193195
watch($script.status, (status) => {
194196
if (status === 'error') {

src/runtime/composables/useScriptEventPage.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useScriptEventPage(onChange?: (payload: TrackedPage) => void) {
1414
return payload
1515

1616
let lastPayload: TrackedPage = { path: '', title: '' }
17-
let stopDomWatcher: () => void
17+
let stopDomWatcher = () => {}
1818
// TODO make sure useAsyncData isn't running
1919
nuxt.hooks.hook('page:finish', () => {
2020
Promise.race([
@@ -23,18 +23,20 @@ export function useScriptEventPage(onChange?: (payload: TrackedPage) => void) {
2323
new Promise<void>((resolve) => {
2424
stopDomWatcher = head.hooks.hook('dom:rendered', () => resolve())
2525
}),
26-
]).finally(() => {
27-
stopDomWatcher && stopDomWatcher()
28-
}).then(() => {
29-
payload.value = {
30-
path: route.fullPath,
31-
title: document.title,
32-
}
33-
if (lastPayload.path !== payload.value.path || lastPayload.title !== payload.value.title) {
34-
onChange && onChange(payload.value)
35-
lastPayload = payload.value
36-
}
37-
})
26+
])
27+
.finally(stopDomWatcher)
28+
.then(() => {
29+
payload.value = {
30+
path: route.fullPath,
31+
title: document.title,
32+
}
33+
if (lastPayload.path !== payload.value.path || lastPayload.title !== payload.value.title) {
34+
if (onChange) {
35+
onChange(payload.value)
36+
}
37+
lastPayload = payload.value
38+
}
39+
})
3840
})
3941
return payload
4042
}

src/runtime/registry/clarity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface ClarityApi {
3333
}
3434

3535
declare global {
36-
interface Window extends ClarityApi {}
36+
type Window = ClarityApi
3737
}
3838

3939
export const ClarityOptions = object({

0 commit comments

Comments
 (0)