Skip to content

Incorrectly parses Svelte 5 snippets' returns #657

@lishaduck

Description

@lishaduck

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?

9.19.0

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

  • svelte-eslint-parser@0.43.0
  • eslint-plugin-svelte@3.0.0-next.16

What did you do?

Configuration
export default ts.config([
  ...ts.configs.recommendedTypeChecked,
  ...sveltePlugin.configs.recommended,
  {
    files: ["**/*.svelte"],
    languageOptions: {
      parserOptions: {
        extraFileExtensions: [".svelte"],
        parser: ts.parser,
        project: "./tsconfig.json",
      },
    },
    rules: {
      "@typescript-eslint/no-confusing-void-expression": "warn",
    },
  },
]);
{#snippet text(string: string)}
	{string}
{/snippet}

{@render text('Whoa')}

What did you expect to happen?

No errors.

What actually happened?

Placing a void expression inside another expression is forbidden. Move it to its own statement instead. eslint(@typescript-eslint/no-confusing-void-expression)

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/lishaduck/sv-esl-prs-repro

Additional comments

sonarjs/no-use-of-empty-return-value also fails, so it's not just a types issue.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy