Skip to content

fix(lint): exclude consumer fixtures from the root tsc program - #10

Merged
acebytes merged 1 commit into
mainfrom
fix/root-lint-exclude-fixtures
Aug 18, 2026
Merged

fix(lint): exclude consumer fixtures from the root tsc program#10
acebytes merged 1 commit into
mainfrom
fix/root-lint-exclude-fixtures

Conversation

@acebytes

Copy link
Copy Markdown
Contributor

The regression

npm run lint (root tsc --noEmit --project tsconfig.json) exits 2 on main with:

packages/plugin-types/fixtures/globals/jsc-with-globals/main.ts(59,1): error TS2578: Unused '@ts-expect-error' directive.
packages/plugin-types/fixtures/globals/jsc-with-globals/main.ts(64,1): error TS2578: Unused '@ts-expect-error' directive.
packages/plugin-types/fixtures/globals/jsc-with-globals/main.ts(67,1): error TS2578: Unused '@ts-expect-error' directive.

Introduced by #8 (feat/url-globals-subpath), which added the fn-182 globals consumer fixtures under packages/plugin-types/fixtures/globals/.

Root cause

The root tsconfig.json has no include, so the lint program sweeps every .ts file under the repo root that isn't excluded — including the consumer fixtures. Under the root config the compile runs with the default lib (which includes lib.dom, so URL is fully typed). The jsc-with-globals fixture's deliberate @ts-expect-error lines therefore no longer suppress a real error, and tsc reports TS2578 for each.

The fixtures are designed to compile only under their own per-fixture tsconfigs ("lib": ["ES2020"], "types": []), driven by the consumer-fixture harness packages/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:

-  "exclude": ["node_modules", "dist", "docs-site"]
+  "exclude": ["node_modules", "dist", "docs-site", "packages/*/fixtures"]

This deliberately does not touch the fixtures or their per-fixture tsconfigs — the @ts-expect-error lines are the fn-182 contract test and must keep erroring under their tsconfigs. That contract is still enforced by npm testnode fixtures/globals/run.mjs, which runs all 4 fixture cases with exact pass/fail expectations (and TS2578 would fail the jsc-with-globals case if a directive ever became unused there).

Verification (on this branch)

Check Result
npm run lint exit 0
npm run build exit 0
npm test exit 0 — 59/59 workspace tests; globals harness: all 4 fixture cases PASS (jsc-with-globals, jsc-types-array, jsc-without-globals fails-with-only-TS2304 as required, webview-dom)
npm run validate-schema exit 0 (community-plugins skip is pre-existing/environmental)
tsc --listFilesOnly sweep diff 0 fixture files in the root program; all 55 package src/ + __tests__ files still swept

Note: CI has no lint job

This regression shipped because the only workflow (docs.yml) runs docs checks — nothing in CI runs npm run lint. Suggested follow-up (not in this PR): add a small CI job running npm run lint && npm test on PRs so root-program regressions like this are caught at review time.

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.
@acebytes
acebytes merged commit 05df7ed into main Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant