Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Issue Description
When linting a project containing e.g. svelte files, you need to provide extraFileExtensions: ['.svelte']
to make the parser use the correct tsconfig for the specific file. This works well with project: true
, since that path ends up in createWatchProgram
where we provide the extraFileExtensions
option to ts.
However, if we switch EXPERIMENTAL_useProjectService
on, we end up in a code path where the extraFileExtensions are not passed to ts. In my reproduction case this is surfaced by the fact that ts will then use the default compiler options, which transpiles the code back to ES5, instead of using the correct tsconfig.
While this reproduction example is using Svelte, the same issue should apply to other cases where extraFileExtensions
would be used (such as when using Vite).
Reproduction Repository Link
https://github.com/alfredringstad/typescript-eslint-svelte-use-project-service-bug-reproduction
Repro Steps
- clone the repo
npm i
npm run lint
Switch EXPERIMENTAL_useProjectService
to false
in eslint.config.js
and run npm run lint
to see how it works well without the project service.
Versions
package | version |
---|---|
@typescript-eslint/parser |
7.6.0 |
@typescript-eslint/typescript-estree |
7.6.0 |
TypeScript |
5.4.5 |
ESLint |
8.57.0 |