Skip to content

bug with several parsers for svelte #379

@mblandr

Description

@mblandr

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm using eslint-plugin-svelte. (*.svelte file linting does not work with the parser alone. You should also use eslint-plugin-svelte with it.)
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-svelte repo and open the issue in eslint-plugin-svelte repo if there is no solution.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.45.0

What version of eslint-plugin-svelte and svelte-eslint-parser are you using?

  • svelte-eslint-parser@0.32.1
  • eslint-plugin-svelte@2.32.2

What did you do?

I try mix of TypeScript and JavaScript in the project, so I configured .eslintrc as described in [https://sveltejs.github.io/eslint-plugin-svelte/user-guide/](url)

"overrides": [
{
"files": ["*.svelte"],
"parser": "svelte-eslint-parser",
"parserOptions": {
"parser": {
"ts": "@typescript-eslint/parser",
"js": "espree"
}
}
}
],

but I got there:

[Error - 12:38:00 PM] Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

Whene I change to this:

"overrides": [
{
"files": ["*.svelte"],
"parser": "svelte-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser"
}
}
],

error is gone.

What should I change to my settings work?

What did you expect to happen?

working EsLint settings

What actually happened?

[Error - 12:38:00 PM] Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/mblandr/test

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions