Skip to content

fix(lint): check whole programs under --type-check, with or without --fast - #930

Merged
maschwenk merged 1 commit into
mainfrom
fix/lint-type-check-everything
Nov 6, 2026
Merged

maschwenk merged 1 commit into
mainfrom
fix/lint-type-check-everything

Conversation

@maschwenk

@maschwenk maschwenk commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

combines the two earlier fixes, both left open for context

which type errors oxlint --type-aware --type-check reports depends on --fast, and neither mode covers everything. this makes both modes report everything tsgolint or tsc --noEmit would

tsgolint tsc --noEmit 0.22.0 default 0.22.0 --fast this pr
linted file in a tsconfig yes yes yes yes yes
file in a tsconfig that oxlint ignores (generated etc) no yes no yes yes
loose file: linted, in no tsconfig yes no yes no yes
tsconfig-wide errors (missing global types etc) no yes no yes yes
lib .d.ts files without skipLibCheck no yes no yes yes

loose files are checked in an inferred program with tsgolint's fallback options. a file two tsconfig programs share is reported once, --fast reported it twice

tradeoff: tsrs-lint stops 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 separate tsc --noEmit: the earlier benchmark measured 21-37% less wall time than typecheck then lint, under --fast. didnt measure default mode

one test (parallel_rules_and_type_checking_match_serial_for_independent_modules) sets skipLibCheck now so it doesnt type-check lib.dom in each of its 24 runs, ~100 s → ~24 s locally

tools/tsgolint/README.md still describes the old behavior. left it since AGENTS.md says readmes only change when asked

checked 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.ts can now fail on type errors elsewhere in its tsconfig. the programs test stops at its first mismatch, so the comparison used INSTA_FORCE_PASS=1 INSTA_UPDATE=new to inspect every case

Session

@codspeed

codspeed Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing fix/lint-type-check-everything (33db0ae) with main (28e42fc)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@camc314

camc314 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Tested this PR at 76b578369363bcd7d5f24c2255adcc5cb27eaad5 through Oxlint 1.92.0. There is still a false positive when a custom-named tsconfig is reached through a transitive project reference: its inherited strictNullChecks: false is not respected.

This reproduces with TSRS_FAST unset as well as TSRS_FAST=1, with zero type-aware rules enabled. Reporting this as a remaining compatibility issue, rather than claiming this PR introduced it.

Minimal reproduction, starting in the TSRS checkout with oxlint on PATH:

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.ts

Expected: both commands succeed with zero errors. Both files inherit strictNullChecks: false.

Actual: both commands exit 1 with the same diagnostic:

typescript(TS2322): Type 'null' is not assignable to type 'number'.
lib/index.ts:1:14
export const lib: number = null;

Found 0 warnings and 1 error.

The directly referenced app is handled correctly; the transitively referenced lib is not. This suggests lib falls back to inferred-program options instead of using tsconfig.lib.json.

I checked the same files against the pinned TypeScript 7.1.0-beta, source commit 3e9236361fa97a9e6c685f4833ac457ae2d8c50a: both tsc --build --pretty false and tsc -p lib/tsconfig.lib.json --noEmit --pretty false exit 0 with no diagnostics.

Separately, the silent-success issue for circular project references also reproduces in the pinned TypeScript 7 compiler with tsc -p; its --build mode correctly rejects the cycle with TS6202. That upstream issue is distinct from the false positive above.

AI-assisted reproduction and validation.

@camc314

camc314 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Tested this PR at 76b578369363bcd7d5f24c2255adcc5cb27eaad5 through Oxlint 1.92.0. There is still a false positive when a custom-named tsconfig is reached through a transitive project reference: its inherited strictNullChecks: false is not respected.

....

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.
@maschwenk
maschwenk force-pushed the fix/lint-type-check-everything branch from db69ac1 to 33db0ae Compare November 6, 2026 17:48
@maschwenk
maschwenk marked this pull request as ready for review November 6, 2026 18:17
@maschwenk
maschwenk added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit b8b2127 Nov 6, 2026
121 of 122 checks passed
@maschwenk
maschwenk deleted the fix/lint-type-check-everything branch November 6, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants