Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
AndersRobstad opened this issue Mar 19, 2025 · 4 comments · Fixed by #1146
Closed
2 tasks done

Comments

@AndersRobstad
Copy link

AndersRobstad commented Mar 19, 2025

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

@baseballyama
Copy link
Member

Thank you for your report!
I'm fixing the bug.

@baseballyama
Copy link
Member

@AndersRobstad

Can you install #1146 version and confirm the behavior?
If ok, I will release the new version.

npm i https://pkg.pr.new/eslint-plugin-svelte@1146

@AndersRobstad
Copy link
Author

@baseballyama Yup, seems to have fixed the issue! Great 🚀

@baseballyama
Copy link
Member

This issue is fixed in v3.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants