Skip to content

Commit 9285284

Browse files
committed
chore: broken typechecking and linting
1 parent 3c46cff commit 9285284

14 files changed

+23
-15
lines changed

eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default createConfigForNuxt({
1313
})
1414
.override('nuxt/typescript/rules', {
1515
rules: {
16+
'@typescript-eslint/no-empty-object-type': ['off'],
1617
'@typescript-eslint/ban-ts-comment': [
1718
'error',
1819
{

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,13 @@
4848
"lint": "eslint .",
4949
"lint:fix": "eslint . --fix",
5050
"test": "vitest",
51-
"test:types": "npx nuxi typecheck",
51+
"test:types": "echo 'broken due to type regeneration, use pnpm typecheck' && npx nuxi typecheck",
5252
"script:generate-tpc": "bun ./scripts/generateTpcScripts.ts && pnpm lint:fix"
5353
},
5454
"build": {
5555
"externals": [
5656
"@unhead/vue",
5757
"@unhead/schema",
58-
"#nuxt-scripts",
59-
"#nuxt-scripts-validator",
6058
"third-party-capital",
6159
"knitwork",
6260
"estree-walker",

src/module.ts

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export default defineNuxtModule<ModuleOptions>({
9292
async setup(config, nuxt) {
9393
const { resolve } = createResolver(import.meta.url)
9494
const { version, name } = await readPackageJSON(resolve('../package.json'))
95+
nuxt.options.alias['#nuxt-scripts-validator'] = resolve(`./runtime/validation/${(nuxt.options.dev || nuxt.options._prepare) ? 'valibot' : 'mock'}`)
96+
nuxt.options.alias['#nuxt-scripts'] = resolve('./runtime/types')
97+
nuxt.options.alias['#nuxt-scripts-utils'] = resolve('./runtime/utils')
9598
if (!config.enabled) {
9699
// TODO fallback to useHead?
97100
logger.debug('The module is disabled, skipping setup.')

src/runtime/registry/clarity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface ClarityApi {
3333
}
3434

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

3939
export const ClarityOptions = object({

src/runtime/registry/cloudflare-web-analytics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface CloudflareWebAnalyticsApi {
1818
}
1919

2020
declare global {
21-
type Window = CloudflareWebAnalyticsApi
21+
interface Window extends CloudflareWebAnalyticsApi {}
2222
}
2323

2424
export const CloudflareWebAnalyticsOptions = object({

src/runtime/registry/google-adsense.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface GoogleAdsenseApi {
2121
}
2222

2323
declare global {
24-
type Window = GoogleAdsenseApi
24+
interface Window extends GoogleAdsenseApi {}
2525
}
2626

2727
/**

src/runtime/registry/google-maps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRegistryScript } from '../utils'
44
import { array, literal, object, optional, string, union } from '#nuxt-scripts-validator'
55
import type { RegistryScriptInput } from '#nuxt-scripts'
66

7-
// eslint-disable-next-line @typescript-eslint/no-namespace
7+
// eslint-disable-next-line
88
declare namespace google {
99
// eslint-disable-next-line @typescript-eslint/no-namespace
1010
export namespace maps {
@@ -23,7 +23,7 @@ export const GoogleMapsOptions = object({
2323

2424
export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>
2525

26-
type MapsNamespace = google.maps
26+
type MapsNamespace = typeof google.maps
2727
export interface GoogleMapsApi {
2828
maps: MapsNamespace | Promise<MapsNamespace>
2929
}

src/runtime/registry/google-tag-manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { RegistryScriptInput } from '#nuxt-scripts'
66
import { object, string, optional } from '#nuxt-scripts-validator'
77

88
declare global {
9-
type Window = GoogleTagManagerApi
9+
interface Window extends GoogleTagManagerApi {}
1010
}
1111
export const GoogleTagManagerOptions = object({
1212
id: string(),

src/runtime/registry/matomo-analytics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface MatomoAnalyticsApi {
1717
}
1818

1919
declare global {
20-
type Window = MatomoAnalyticsApi
20+
interface Window extends MatomoAnalyticsApi {}
2121
}
2222

2323
export function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput) {

src/runtime/registry/meta-pixel.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ export interface MetaPixelApi {
2929
queue: any[]
3030
}
3131
_fbq: MetaPixelApi['fbq']
32+
callMethod?: FbqFns
3233
}
3334

3435
declare global {
35-
type Window = MetaPixelApi
36+
interface Window extends MetaPixelApi {}
3637
}
3738

3839
export const MetaPixelOptions = object({
@@ -56,7 +57,9 @@ export function useScriptMetaPixel<T extends MetaPixelApi>(_options?: MetaPixelI
5657
? undefined
5758
: () => {
5859
const fbq: MetaPixelApi['fbq'] = window.fbq = function (...params: any[]) {
60+
// @ts-expect-error untypeds
5961
if (fbq.callMethod) {
62+
// @ts-expect-error untyped
6063
fbq.callMethod(...params)
6164
}
6265
else {

src/runtime/registry/segment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface AnalyticsApi {
3434
export type SegmentApi = Pick<AnalyticsApi, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'reset'>
3535

3636
declare global {
37-
type Window = SegmentApi
37+
interface Window extends SegmentApi {}
3838
}
3939

4040
const methods = ['track', 'page', 'identify', 'group', 'alias', 'reset']

src/runtime/registry/stripe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface StripeApi {
1515
}
1616

1717
declare global {
18-
type Window = StripeApi
18+
interface Window extends StripeApi {}
1919
}
2020

2121
export function useScriptStripe<T extends StripeApi>(_options?: StripeInput) {

src/runtime/registry/vimeo-player.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface VimeoPlayerApi {
1515
export type VimeoPlayerInput = RegistryScriptInput
1616

1717
declare global {
18-
type Window = VimeoPlayerApi
18+
interface Window extends VimeoPlayerApi {}
1919
}
2020

2121
export function useScriptVimeoPlayer<T extends VimeoPlayerApi>(_options?: VimeoPlayerInput) {

src/runtime/registry/x-pixel.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface XPixelApi {
3636
}
3737

3838
declare global {
39-
type Window = XPixelApi
39+
interface Window extends XPixelApi {}
4040
}
4141

4242
export const XPixelOptions = object({
@@ -57,10 +57,13 @@ export function useScriptXPixel<T extends XPixelApi>(_options?: XPixelInput) {
5757
: () => {
5858
// @ts-expect-error untyped
5959
const s = window.twq = function (...args) {
60+
// @ts-expect-error untyped
6061
if (e.exe) {
62+
// @ts-expect-error untyped
6163
s.exe(s, args)
6264
}
6365
else {
66+
// @ts-expect-error untyped
6467
s.queue.push(args)
6568
}
6669
}

0 commit comments

Comments
 (0)