Skip to content

prefer-destructured-store-props reports error when using $$slots #463

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

Closed
2 tasks done
dkrutsko opened this issue May 4, 2023 · 1 comment · Fixed by #465
Closed
2 tasks done

prefer-destructured-store-props reports error when using $$slots #463

dkrutsko opened this issue May 4, 2023 · 1 comment · Fixed by #465
Labels
bug Something isn't working

Comments

@dkrutsko
Copy link

dkrutsko commented May 4, 2023

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?

8.39.0

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

2.27.3

What did you do?

Configuration
{
	// ...
	'svelte/prefer-destructured-store-props': 'error'
	// ...
}
<script lang="ts">
...
</script>

{#if $$slots.default}
	<slot />
{/if}

<style lang="postcss">
...
</style>

What did you expect to happen?

No error to be displayed?

What actually happened?

An error was displayed.

Destructure default from $$slots for better change tracking & fewer redraws

Link to GitHub Repo with Minimal Reproducible Example

Minimal Example of Error

Minimal Example of Fix

Additional comments

The main problem is that the "fix" that's recommended results in the following error:

This statement is not reactive because all variables referenced in the reactive statement are immutable

Is this an actual error? Is the proposed fix the way to actually fix this? Why doesn't that fix work?

@ota-meshi
Copy link
Member

Thank you for the report! I think it's bugs

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