Skip to content

Nested nodes with their own scope are not nested inside an each block scope #341

@DMartens

Description

@DMartens

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.41.0

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

  • svelte-eslint-parser@0.29.0
  • eslint-plugin-svelte@2.29.0

What did you do?

Configuration
-
{#each Array.from({ length: open ? count - 1 : count }, (_, i) => i) as item (item)}
{/each}

What did you expect to happen?

The function scope of the callback of Array.from is a child scope of the each scope.

What actually happened?

The callback scope is a sibling of the each scope (both inside the module scope).

Link to GitHub Repo with Minimal Reproducible Example

Reproducible by pasting the code into the playground (sorry I found no way to get a link with the code and tab already selected).

Additional comments

I did not try to find other svelte constructs where this bug may also happen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions