Bug: EXPERIMENTAL_useProjectService does not respect extraFileExtensions #8899
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: typescript-estree
Issues related to @typescript-eslint/typescript-estree
Milestone
Before You File a Bug Report Please Confirm You Have Done The Following...
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 withproject: true
, since that path ends up increateWatchProgram
where we provide theextraFileExtensions
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
npm i
npm run lint
Switch
EXPERIMENTAL_useProjectService
tofalse
ineslint.config.js
and runnpm run lint
to see how it works well without the project service.Versions
@typescript-eslint/parser
7.6.0
@typescript-eslint/typescript-estree
7.6.0
TypeScript
5.4.5
ESLint
8.57.0
The text was updated successfully, but these errors were encountered: