Repository navigation
fix(lint): check whole programs under --type-check, with or without --fast - #930
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
|
Tested this PR at This reproduces with Minimal reproduction, starting in the TSRS checkout with cargo build --profile dev -p tsrs_lint
tsrs_backend="$PWD/target/debug/tsrs-lint"
tsrs_repro="$(mktemp -d)"
mkdir "$tsrs_repro/app" "$tsrs_repro/lib"
cat > "$tsrs_repro/tsconfig.json" <<'JSON'
{"compilerOptions":{"composite":true,"strict":true,"strictNullChecks":false},"files":[],"references":[{"path":"./app/tsconfig.app.json"}]}
JSON
cat > "$tsrs_repro/app/tsconfig.app.json" <<'JSON'
{"extends":"../tsconfig.json","include":["*.ts"],"references":[{"path":"../lib/tsconfig.lib.json"}]}
JSON
cat > "$tsrs_repro/lib/tsconfig.lib.json" <<'JSON'
{"extends":"../tsconfig.json","include":["*.ts"]}
JSON
printf 'export const app: number = null;\n' > "$tsrs_repro/app/index.ts"
printf 'export const lib: number = null;\n' > "$tsrs_repro/lib/index.ts"
cd "$tsrs_repro"
env -u TSRS_FAST OXLINT_TSGOLINT_PATH="$tsrs_backend" oxlint --type-check-only app/index.ts lib/index.ts
TSRS_FAST=1 OXLINT_TSGOLINT_PATH="$tsrs_backend" oxlint --type-check-only app/index.ts lib/index.tsExpected: both commands succeed with zero errors. Both files inherit Actual: both commands exit 1 with the same diagnostic: The directly referenced I checked the same files against the pinned TypeScript 7.1.0-beta, source commit Separately, the silent-success issue for circular project references also reproduces in the pinned TypeScript 7 compiler with AI-assisted reproduction and validation. |
76b5783 to
db69ac1
Compare
Fixed in #934 |
…-fast oxlint --type-check checked whole tsconfig programs only under the fast preset. There it dropped type errors for files oxlint sent that no tsconfig includes, and reported a file twice when two programs had it. Default mode reported only the files oxlint sent, as tsgolint does. Both modes now check whole programs, check files outside every tsconfig in an inferred program, and report each file's type errors once: a file oxlint sent by the program it maps to, any other file by the first program that has it.
db69ac1 to
33db0ae
Compare
combines the two earlier fixes, both left open for context
which type errors
oxlint --type-aware --type-checkreports depends on--fast, and neither mode covers everything. this makes both modes report everything tsgolint ortsc --noEmitwouldtsc --noEmit--fast.d.tsfiles withoutskipLibCheckloose files are checked in an inferred program with tsgolint's fallback options. a file two tsconfig programs share is reported once,
--fastreported it twicetradeoff:
tsrs-lintstops being a drop-in for tsgolint under--type-check. same command, more errors (oxlint ignore patterns stop hiding type errors) and more work, since it checks whole programs. pays off when it replaces a separatetsc --noEmit: the earlier benchmark measured 21-37% less wall time than typecheck then lint, under--fast. didnt measure default modeone test (
parallel_rules_and_type_checking_match_serial_for_independent_modules) setsskipLibChecknow so it doesnt type-check lib.dom in each of its 24 runs, ~100 s → ~24 s locallytools/tsgolint/README.mdstill describes the old behavior. left it since AGENTS.md says readmes only change when askedchecked against oxc main
582b5756, including the new type-check combination tests below. tsrs main matched every tsgolint snapshot. main plus this change differs in 6 snapshots, all additions from unlisted files in the same tsconfig; default,TSRS_FAST=1, and a repeat run produced identical output.--type-check-only clean.tscan now fail on type errors elsewhere in its tsconfig. the programs test stops at its first mismatch, so the comparison usedINSTA_FORCE_PASS=1 INSTA_UPDATE=newto inspect every caseSession