-
-
Notifications
You must be signed in to change notification settings - Fork 48
Union types for props cause trigger of svelte/no-unused-props
#1168
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
Comments
This is the expected behavior. |
I can see why it's like this, but it's a bit of an out-of-scope decision in my opinion. Technically, my prop is used, but not all of its properties. This means that we have to separately define types to avoid this behavior, which seems a bit intrusive for a simple lint rule. Also, if I disable this in this component/altogether, I lose the cases when I actually have an unused prop, which is annoying. The possibilities are the following:
By the way, if the issue stays in this state, it should be closed as "Won't solve" and not as "Completed" |
Let's add |
Great thank you!! |
This issue is fixed in v3.5.0 |
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9.23.0
What version of
eslint-plugin-svelte
are you using?3.4.0
What did you do?
Configuration
If I don't use
myProp.a
in my code, even if I use one or more properties ofMyType
,a
is marked as unused propsWhat did you expect to happen?
Not having this reported because I do use
myProp
What actually happened?
Got this error reported on my
$props()
Link to GitHub Repo with Minimal Reproducible Example
https://eslint-online-playground.netlify.app/#eNqFVE1v2zAM/SuCMAxdENv3rB0KdNut2LDtVuXg2IynVJYMSU4TBP7vpT7sOHGSnmSTj+R7FMUDNbrInvdPqm6UBGlTswVhgS7ovSk0bywRuaweGLWG0W9MMmv3DZDn/T93PJADsf+5rBbEWI0n6b4OmN9aNcZBnIXZeu8MC4zIj2jyOabyYSFYgEVQgJNuMeT51LiPuy8Ius8COUdIHgI09UQ6JumcghEctRRKrnmVbgzK4ShQWxI8ZK1VTRh9DL/ZBsVh2oix5hTl1IR6SXCMwaFfPTT4k0a0FZdJ8I3RjQZrOegnz+wsKtBNeky2FvlJqUqoVS5MHxV/PYJJ2HlMCeu8FUcNsQd3rrEnFpNqKFRdgyyhnPtLOw2ZAoKcq+5TbZcieoT3xbFw49XmFfxqLFfS4HwEO7NR38jCbJqm0ZyutHozMdfEKVUJvQNHYji6cek1F4DpXxidzbJZnHxG59jbkQHHZ2pzr2EZS19X0OQaGU7tvWdxvKZgGImBndX5T2T4Y2dBmpABqQ40lx/q063XdyxLHyejnEmVtLI1UCZbpMCoLwJaK+1UHwivpNLwB4z9y1cYUWFGzAykiwSmdUNIoLtquSiz0MBIPXnlNlpKbvpPt4cEX2U4U2ETmazlZ77Wcrzbl41duvb7uky6fYBPvsmLV7wEvC0l8bkjFRKfrtPEaK1KbAfmC44Stt+hccMrCw5etw9xvvFWcKH4DFF+DHWAfgvccJ4/5tvgs31xETo894vem6Gx730xP2pXoMcB+RAwLMMxzsHwUtwa7t4BzLVIRw== (can't make typescript work)
Additional comments
No response
The text was updated successfully, but these errors were encountered: