Skip to content

bug: no-unused-props falsely reports props as unused when they have default value #1145

Closed
@AndersRobstad

Description

@AndersRobstad

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

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

3.3.2

What did you do?

Configuration

When having a default value for a prop it reports as unused even when all attributes of the prop is referenced in the file

<!-- Paste your configuration here -->

When having a default value for a prop it reports as unused even when all attributes of the prop is referenced in the file as shown below:

Image

It works fine when changing the prop to not have a default value:
Image

The same behavior can also be seen when adding = $bindable() to a prop as seen below. The error reports that selected.value is not being used, but its referenced in the file

Image

What did you expect to happen?

I'd expect it not to report an error in this case

What actually happened?

It reports an error

Link to GitHub Repo with Minimal Reproducible Example

No repor since shown in examples

Additional comments

No response

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