fix: preserve lint migration contracts

This commit is contained in:
Tianyi Cui
2026-07-29 22:38:20 +08:00
parent 5fb4bd66d7
commit e91ef39f5a
22 changed files with 401 additions and 214 deletions

View File

@@ -376,22 +376,25 @@ function ciWindowsObservationalGates(): Gate[] {
]
}
function lintGate(oxlintTargets: readonly string[] = ['.']): Gate {
const threadArgs = oxlintThreadArgs()
if (threadArgs.length > 0) {
return pnpmExec('lint', ['oxlint', ...oxlintTargets, ...threadArgs], { label: 'lint' })
function lintGate(): Gate {
const threadBound = oxlintThreadBound()
if (threadBound !== undefined) {
return pnpmExec('lint', ['oxlint', '.', `--threads=${threadBound}`], {
label: 'lint',
env: { GOMAXPROCS: threadBound },
})
}
return pnpmScript('lint', 'lint')
}
function oxlintThreadArgs(): string[] {
function oxlintThreadBound(): string | undefined {
const raw = process.env.DSH_OXLINT_THREADS
if (raw === undefined || raw === '') return []
if (raw === undefined || raw === '') return undefined
const parsed = Number.parseInt(raw, 10)
if (!Number.isSafeInteger(parsed) || parsed < 1 || String(parsed) !== raw) {
throw new Error(`run-gates: DSH_OXLINT_THREADS must be a positive integer, got ${JSON.stringify(raw)}.`)
}
return [`--threads=${raw}`]
return raw
}
function coverageGate(): Gate {