ci: lint and typecheck the whole tree in CI and only staged files in the pre-commit hook

This commit is contained in:
Linus Rath
2026-10-19 19:09:46 +02:00
parent 6a59faf127
commit 9ef7e686ce
3 changed files with 33 additions and 1 deletions
+2
View File
@@ -1,4 +1,6 @@
# Sourced by /bin/sh inside the Lite container image: CRLF would break it.
*.envsh text eol=lf
# Run by sh from Git Bash on Windows, which does not strip CR.
.husky/* text eol=lf
# Demo fixtures record exact byte sizes of these files; never normalise them.
public/demo/** -text
+25
View File
@@ -34,3 +34,28 @@ jobs:
# from timing out on the shared runners; the longer per-test timeout
# covers the jsdom-heavy suites.
run: npx vitest run --pool=forks --maxWorkers=2 --testTimeout=15000
# The pre-commit hook lints only staged files and never runs on fork PRs,
# so this is the one place the whole tree is checked.
lint:
name: Lint and typecheck
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Typecheck
run: npm run typecheck
- name: Lint
run: npm run lint
+6 -1
View File
@@ -1 +1,6 @@
npx tsc --noEmit && npx eslint . --ext .ts,.tsx
#!/bin/sh
# Typecheck the project (incremental, a few seconds warm) and lint only the
# staged files. The full lint and typecheck run in CI for every push and PR.
npx tsc --noEmit || exit 1
files=$(git diff --cached --name-only --diff-filter=ACM -- '*.ts' '*.tsx' '*.js' '*.mjs')
[ -z "$files" ] || echo "$files" | xargs npx eslint --no-warn-ignored