Expected BehaviourFirst 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.
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 BehaviourThe 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:
*.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*.ts
files are correctly linted; however, the *.svelte
files produce the following error relating to tsconfig.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
extraFileExtensions: [".svelte"]
to the languageOptions
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 Linkhttps://github.com/JP-Ellis/eslint-plugin-svelte-mwe
Repro Stepspnpm install
pnpm lint
(this should work fine)eslint.config.js
pnpm lint
(this should produce errors)extraFileExtensions: [".svelte"]
to the languageOptions
in the TypeScript block.pnpm lint
(this should have fixed the previous issue)@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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4