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
First and foremost, this bug relates to the new ESLint flat configuration. I understand that this feature is still in beta and is now in Phase 3 which is to ensure compability with existing plugins. I suspect the error is with the TypeScript parser and not with ESLint.
Expected Behaviour
I should be able to configure options for the TypeScript parser independently when it is used within the TypeScript section of the config, and the Svelte section of the configuration.
Actual Behaviour
The setting of languageOptions
in the block of the ESLint config targetting **/*.ts
files has side-effects, impacting the use of the TypeScript parser in the Svelte section targettin **/*.svelte
files.
In the example repo (below), the ESLint config contains the following segment:
I note the following behaviours:
- When it is commented out, the
*.svelte
files are parsed and linted correctly. The TypeScript files are not linted, which is expected as non of the configuration blocks in ESLint match*.ts
files - When the TypeScript configuration block is uncommented, the
*.ts
files are correctly linted; however, the*.svelte
files produce the following error relating totsconfig.ts
:0:0 error Parsing error: ESLint was configured to run on `<tsconfigRootDir>/src/routes/+page.svelte` using `parserOptions.project`: <tsconfigRootDir>/tsconfig.json However, that TSConfig does not include this file. Either: - Change ESLint's list of included files to not include this file - Change that TSConfig to include this file - Create a new TSConfig that includes this file and include it in your parserOptions.project See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
- Adding
extraFileExtensions: [".svelte"]
to thelanguageOptions
in the TypeScript block (and having it uncommented) resolves the above issue.
My expectation is that the settings passed in the TypeScript config block should be independent of the settings passed in the Svelte block.
Reproduction Repository Link
https://github.com/JP-Ellis/eslint-plugin-svelte-mwe
Repro Steps
- clone the repo
pnpm install
pnpm lint
(this should work fine)- Uncomment the TypeScript configuration in
eslint.config.js
pnpm lint
(this should produce errors)- Add
extraFileExtensions: [".svelte"]
to thelanguageOptions
in the TypeScript block. pnpm lint
(this should have fixed the previous issue)
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
5.56.0 |
@typescript-eslint/parser |
5.56.0 |
TypeScript |
5.0.2 |
ESLint |
8.36.0 |
node |
19.8.1 |