Skip to content

@typescript-eslint/no-use-before-define reports $props unepectedly #1158

Closed
sveltejs/svelte-eslint-parser
#692
@baseballyama

Description

@baseballyama

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.

What version of ESLint are you using?

9.23.0

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

3.3.3

What did you do?

Just run ESLint.

What did you expect to happen?

I don't get lint error

What actually happened?

Image

Link to GitHub Repo with Minimal Reproducible Example

<script lang="ts">
  interface Props {
    bar: string;
  }

  const props: Props = $props();
  const state = $state(props);

  console.warn(props.bar);
</script>

Additional comments

It’s caused by conflicting with the store detection logic. I think a fix on the parser side is needed.
We should also check how Svelte itself handles this.

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