-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
Relevant Package
typescript-estree
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
When using processors like @eslint/markdown with parserOptions.projectService: true, typed linting fails for extracted code blocks because the virtual child paths (e.g., docs/example.md/0.ts) aren't recognized by the project service.
The problem:
file.md/0_0.ts was not found by the project service.
Consider either including it in the tsconfig.json or including it in allowDefaultProject.
These virtual paths can't be added to tsconfig.json since they don't exist on disk, and adding allowDefaultProject globs for every processor pattern is fragile.
Proposed solution:
When typescript-estree encounters a non-existent path, it should check if a parent path is a real file. If so, treat the path as a virtual child and implicitly allow the default project.
For example:
docs/example.md/0.ts→ parentdocs/example.mdexists → allow default project- Real files continue to work exactly as today
Related work:
- Draft PR: feat(typescript-estree): allow projectService to type-check virtual processor children #11827
- ESLint RFC discussion: RFC: Allow processors to associate child files with real filesystem paths for typed linting eslint/eslint#20378
- Allow projectService to use the default project for virtual processor child files #11838
This would eliminate the need for processors to create temp files or for users to maintain complex allowDefaultProject patterns.
Additional Info
No response