From f3c3678f0276b548896c8e64ad4d10a51a4e9a47 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 19 Feb 2024 16:35:53 +0100 Subject: [PATCH] fix: don't use DOM types (#252) * fix: don't use DOM types * chore: add typecheck to CI * chore: fix lint --- .github/workflows/build.yml | 1 + package.json | 1 + src/pure/watch/ws-client.ts | 3 ++- tsconfig.json | 9 +++------ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d93fd1..9805e7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,5 +26,6 @@ jobs: - run: pnpm install --frozen-lockfile - run: pnpm compile + - run: pnpm typecheck - run: pnpm lint - run: pnpm test diff --git a/package.json b/package.json index 95f0e17..228ad3b 100644 --- a/package.json +++ b/package.json @@ -149,6 +149,7 @@ "compile": "tsup ./src/extension.ts --external vscode --minify", "watch": "tsup ./src/extension.ts --external vscode --watch --sourcemap", "test": "vitest run --config vite.global-config.ts", + "typecheck": "tsc --noEmit", "lint": "eslint --cache .", "lint:fix": "eslint --cache --fix ." }, diff --git a/src/pure/watch/ws-client.ts b/src/pure/watch/ws-client.ts index 1ec1301..e65d529 100644 --- a/src/pure/watch/ws-client.ts +++ b/src/pure/watch/ws-client.ts @@ -4,6 +4,7 @@ import { shallowReactive } from '@vue/reactivity' import type { BirpcReturn } from 'birpc' import { createBirpc } from 'birpc' import { parse, stringify } from 'flatted' +import WebSocket from 'ws' import type { File, @@ -114,7 +115,7 @@ export function createClient(url: string, options: VitestClientOptions = {}) { reconnectInterval = 2000, reconnectTries = 10, reactive = v => v, - WebSocketConstructor = globalThis.WebSocket, + WebSocketConstructor = WebSocket, onFailedConnection, } = options diff --git a/tsconfig.json b/tsconfig.json index 6e34250..f161b0b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,15 @@ { "compilerOptions": { "target": "ES2020", - "lib": ["ES2020", "ESNext.Disposable", "DOM"], + "lib": ["ES2020", "ESNext.Disposable"], "rootDir": "src", "module": "commonJS", + "types": ["node"], "strict": true, "outDir": "out", "sourceMap": true, "esModuleInterop": true, - "skipLibCheck": true /* enable all strict type-checking options */ - /* Additional Checks */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ + "skipLibCheck": true }, "include": ["src/**/*.ts"], "exclude": ["samples/**/*"] -- 2.51.2