fix(no-sync): resolve full typed names for ignores#501
Merged
aladdin-add merged 3 commits intoeslint-community:masterfrom Jan 10, 2026
Merged
Conversation
|
@patricktree Have you found the cause of the issue? I tried it on my Windows + WSL (Ubuntu) setup, and no errors were reported during testing. |
Author
Still investigating it. |
b0970e0 to
aacd206
Compare
aacd206 to
92655f8
Compare
Author
|
I found out that You can locally run: CI=true npm run -s test:tests
# or:
CI=true npm exec _mocha -- --reporter progress --timeout 4000 tests/lib/rules/no-sync.js...and get the failures too. I pushed a change which sets |
Author
|
I've let Claude Code loose on the issue, it says: Found the root cause!
Summary
When CI=true:
1. TypeScript-eslint detects this as a "single run" scenario (see node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js:50)
2. In singleRun mode, after the first parse of a file path (file.ts), all subsequent parses use createIsolatedProgram instead of the project service
3. createIsolatedProgram creates a minimal isolated program with noResolve: true and no access to TypeScript lib types (DOM, etc.)
4. Tests relying on type info (like checking if replaceSync comes from CSSStyleSheet in the DOM lib) fail because the isolated program has no such type information
When CI=false:
- No isolated programs are created - always uses project service
- All type info from lib.d.ts (DOM types like CSSStyleSheet) is available
- Tests pass
Evidence: With CI=true, multiple isolated programs are created for file.ts:
Getting isolated program in TS mode for: .../tests/fixtures/no-sync/base/file.ts
Getting isolated program in TS mode for: .../tests/fixtures/no-sync/base/file.ts
...
3 failing
With CI=false: No isolated programs created, all tests pass.
Root issue: All TypeScript tests in no-sync/base share the same filename (file.ts). After the first test, the singleRun optimization kicks in and uses isolated programs without type context. |
typescript-eslint's singleRun optimization (triggered by CI=true) uses isolated programs without type info after the first parse of a filename. This caused tests relying on type info (e.g., CSSStyleSheet.replaceSync) to fail when multiple tests shared the same file.ts filename. - Generate unique filenames (file-1.ts, file-2.ts, etc.) per test case - Use allowDefaultProject for virtual test files instead of blocking them - Remove CI=false workaround from GitHub Actions workflow Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Author
|
I've let CC fix it: Summary of Changes
tests/test-helpers.js - Two changes:
1. Unique filenames per test - Added counter to generate file-1.ts, file-2.ts, etc. instead of always using file.ts. This prevents typescript-eslint's singleRun optimization from reusing isolated programs without type info.
2. Use allowDefaultProject - Replaced maximumDefaultProjectFileMatchCount: 0 with allowDefaultProject: ["file-*.ts"] so the virtual test files can be handled by the default project since they don't exist on disk.
.github/workflows/CI.yml - Removed the CI=false workaround since it's no longer needed.see a75eb34 |
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.
Problem
Test cases are failing in CI for branch main, see e.g. https://github.com/eslint-community/eslint-plugin-n/actions/runs/20819474971/job/59803717861