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

Suppress prefer-const warnings for $props() and $derived() #889

Open
Conduitry opened this issue Oct 24, 2024 · 2 comments
Open

Suppress prefer-const warnings for $props() and $derived() #889

Conduitry opened this issue Oct 24, 2024 · 2 comments

Comments

@Conduitry
Copy link
Member

I'm not sure what mechanism is being used to suppress prefer-const warnings for variables that have bind:s in the template, but these warnings should also be suppressed for $props() and $derived(). Using a const for a $derived() feels like a weird thing to force on people, and a mixture of bindable and non-bindable $props() can cause more serious issues where ESLint will encourage components that can't be compiled - sveltejs/svelte#13897

@ryanatkn
Copy link

A workaround for props is using the destructuring: all option in prefer-const for Svelte files.

@ilyakamens
Copy link

I'm also encountering this with $derived() and $derived.by().

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

No branches or pull requests

3 participants