fix(lint): exclude consumer fixtures from the root tsc program - #10
Merged
Conversation
npm run lint (root tsc --noEmit) exited 2 with 3x TS2578 "Unused '@ts-expect-error' directive" at packages/plugin-types/fixtures/globals/jsc-with-globals/main.ts:59,64,67. Root cause: the root tsconfig.json has no include, so tsc sweeps the fn-182 globals consumer fixtures under the DEFAULT lib (which pulls in lib.dom, making URL fully typed) — so the fixture's deliberate @ts-expect-error lines stop erroring and trip TS2578. The fixtures are designed to compile ONLY under their own per-fixture tsconfigs (lib ES2020, types: []), driven by fixtures/globals/run.mjs. Fix: add packages/*/fixtures to the root exclude so the lint program never sweeps consumer fixtures. The per-fixture harness (npm test -> node fixtures/globals/run.mjs) still exercises all 4 cases under their own tsconfigs, so the fn-182 contract stays enforced. Introduced by PR #8 (feat/url-globals-subpath); unseen by CI because the only workflow (docs.yml) runs docs checks, not root lint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The regression
npm run lint(roottsc --noEmit --project tsconfig.json) exits 2 onmainwith:Introduced by #8 (
feat/url-globals-subpath), which added the fn-182 globals consumer fixtures underpackages/plugin-types/fixtures/globals/.Root cause
The root
tsconfig.jsonhas noinclude, so the lint program sweeps every.tsfile under the repo root that isn't excluded — including the consumer fixtures. Under the root config the compile runs with the default lib (which includeslib.dom, soURLis fully typed). Thejsc-with-globalsfixture's deliberate@ts-expect-errorlines therefore no longer suppress a real error, andtscreports TS2578 for each.The fixtures are designed to compile only under their own per-fixture tsconfigs (
"lib": ["ES2020"],"types": []), driven by the consumer-fixture harnesspackages/plugin-types/fixtures/globals/run.mjs. Sweeping them in any other program is a category error — the whole point of the fixtures is to typecheck against a specific, minimal lib environment.The fix
Exclude fixtures from the root program:
This deliberately does not touch the fixtures or their per-fixture tsconfigs — the
@ts-expect-errorlines are the fn-182 contract test and must keep erroring under their tsconfigs. That contract is still enforced bynpm test→node fixtures/globals/run.mjs, which runs all 4 fixture cases with exact pass/fail expectations (and TS2578 would fail thejsc-with-globalscase if a directive ever became unused there).Verification (on this branch)
npm run lintnpm run buildnpm testjsc-with-globals,jsc-types-array,jsc-without-globalsfails-with-only-TS2304 as required,webview-dom)npm run validate-schematsc --listFilesOnlysweep diffsrc/+__tests__files still sweptNote: CI has no lint job
This regression shipped because the only workflow (
docs.yml) runs docs checks — nothing in CI runsnpm run lint. Suggested follow-up (not in this PR): add a small CI job runningnpm run lint && npm teston PRs so root-program regressions like this are caught at review time.