diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9445ad7..eb5a18c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,17 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt -r requirements-test.txt + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install Node dependencies + run: npm ci + + - name: Typecheck (tsc --noEmit) + run: npm run typecheck + - name: Run pytest run: pytest diff --git a/package-lock.json b/package-lock.json index 31332ca..672f8f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "AGPL-3.0-only", "devDependencies": { - "@playwright/test": "^1.59.1" + "@playwright/test": "^1.59.1", + "typescript": "^5.4" } }, "node_modules/@playwright/test": { @@ -74,6 +75,20 @@ "engines": { "node": ">=18" } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } } } } diff --git a/package.json b/package.json index bdcb3d9..81eedbf 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,11 @@ "test:headed": "playwright test --headed", "test:debug": "playwright test --debug", "test:js": "node --test tests/js/*.test.js 'tests/plugins/*/js/*.test.js'", - "install:playwright": "playwright install chromium" + "install:playwright": "playwright install chromium", + "typecheck": "tsc --noEmit" }, "devDependencies": { - "@playwright/test": "^1.59.1" + "@playwright/test": "^1.59.1", + "typescript": "^5.4" } -} +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1121663 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": false, + "noEmit": true, + "strict": true, + "target": "es2022", + "lib": ["es2022", "dom", "dom.iterable"], + "skipLibCheck": true + }, + "include": ["static/**/*.js", "static/**/*.d.ts"], + "exclude": ["static/vendor/**", "node_modules"] +}