Skip to content

Commit f322ef4

Browse files
committed
chore: fix typecheck and run it in CI
Backported from vitejs/vite-ecosystem-ci#261
1 parent b4cd264 commit f322ef4

25 files changed

+53
-46
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
run: pnpm format
3030
- name: lint
3131
run: pnpm run lint
32+
- name: typecheck
33+
run: pnpm run typecheck
3234
- name: audit
3335
if: (${{ success() }} || ${{ failure() }})
3436
run: pnpm audit

discord-webhook.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import fetch from 'node-fetch'
2-
import { getPermanentRef, setupEnvironment, teardownEnvironment } from './utils'
2+
import {
3+
getPermanentRef,
4+
setupEnvironment,
5+
teardownEnvironment,
6+
} from './utils.ts'
37

48
type RefType = 'branch' | 'tag' | 'commit' | 'release'
59
type Status = 'success' | 'failure' | 'cancelled'

ecosystem-ci.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
bisectVue,
1212
parseVueMajor,
1313
parseMajorVersion,
14-
} from './utils'
15-
import { CommandOptions, RunOptions } from './types'
14+
} from './utils.ts'
15+
import { CommandOptions, RunOptions } from './types.ts'
1616

1717
const cli = cac()
1818
cli

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"lint:fix": "pnpm lint --fix",
1212
"format": "prettier --ignore-path .gitignore --check .",
1313
"format:fix": "pnpm format --write",
14+
"typecheck": "tsc",
1415
"test:self": "tsx ecosystem-ci.ts _selftest",
1516
"test": "tsx ecosystem-ci.ts",
1617
"clean": "rimraf .verdaccio-cache/.local workspace && pnpm store prune",

registry.ts

-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ export const REGISTRY_ADDRESS = `http://localhost:${LOCAL_REGISTRY_PORT}/`
1212
export async function startRegistry() {
1313
// It's not ideal to repeat this config option here,
1414
// luckily, `self_path` would no longer be required in verdaccio 6
15-
// @ts-expect-error import.meta
1615
const cache = fileURLToPath(new URL('./.verdaccio-cache', import.meta.url))
1716
const config = {
1817
...parseConfigFile(
19-
// @ts-expect-error import.meta
2018
fileURLToPath(new URL('./verdaccio.yaml', import.meta.url)),
2119
),
2220
self_path: cache,

tests/_selftest.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'node:path'
2-
import { runInRepo } from '../utils'
3-
import { RunOptions } from '../types'
2+
import { runInRepo } from '../utils.ts'
3+
import { RunOptions } from '../types.ts'
44

55
export async function test(options: RunOptions) {
66
await runInRepo({

tests/language-tools.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/naive-ui.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/nuxt.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/pinia.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/primevue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/quasar.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/radix-vue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/router.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/test-utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vant.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vite-plugin-vue.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vitepress.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vue-i18n.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vue-macros.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vue-simple-compiler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vuetify.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tests/vueuse.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { runInRepo } from '../utils'
2-
import { RunOptions } from '../types'
1+
import { runInRepo } from '../utils.ts'
2+
import { RunOptions } from '../types.ts'
33

44
export async function test(options: RunOptions) {
55
await runInRepo({

tsconfig.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"compilerOptions": {
55
"target": "esnext",
66
"module": "NodeNext",
7-
"moduleResolution": "node",
7+
"moduleResolution": "NodeNext",
8+
"allowImportingTsExtensions": true,
89
"strict": true,
910
"declaration": true,
1011
"noImplicitOverride": true,
@@ -14,6 +15,8 @@
1415
"allowSyntheticDefaultImports": true,
1516
"lib": ["esnext"],
1617
"sourceMap": true,
17-
"typeRoots": ["./typings/node_modules/@types"]
18+
"typeRoots": ["./typings/node_modules/@types"],
19+
"noEmit": true,
20+
"skipLibCheck": true
1821
}
1922
}

utils.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
RepoOptions,
1010
RunOptions,
1111
Task,
12-
} from './types'
13-
import { REGISTRY_ADDRESS, startRegistry } from './registry'
12+
} from './types.ts'
13+
import { REGISTRY_ADDRESS, startRegistry } from './registry.ts'
1414
//eslint-disable-next-line n/no-unpublished-import
1515
import { detect, AGENTS, Agent, getCommand } from '@antfu/ni'
1616
import actionsCore from '@actions/core'
@@ -87,7 +87,6 @@ let app: any
8787
export async function setupEnvironment(): Promise<EnvironmentData> {
8888
app = await startRegistry()
8989

90-
// @ts-expect-error import.meta
9190
const root = dirnameFrom(import.meta.url)
9291
const workspace = path.resolve(root, 'workspace')
9392
vuePath = path.resolve(workspace, 'core')

0 commit comments

Comments
 (0)