Skip to content

no-immutable-reactive-statements false positive on mutable consts #580

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
DetachHead opened this issue Sep 8, 2023 · 0 comments · Fixed by #581
Closed
2 tasks done

no-immutable-reactive-statements false positive on mutable consts #580

DetachHead opened this issue Sep 8, 2023 · 0 comments · Fixed by #581
Labels
bug Something isn't working

Comments

@DetachHead
Copy link
Contributor

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

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

2.33.0

What did you do?

<script>
  let values = [1]

  $: count = values[0] // error: svelte/no-immutable-reactive-statements
</script>

{count}
<br />
<button on:click={() => values[0] = 2}>asdf</button>

What did you expect to happen?

no error, because the reactive statement still reacts to the variable being mutated. changing it to no longer be a reactive statement causes it to no longer react to the mutation

What actually happened?

no-immutable-reactive-statements error on the reactive statement

Link to GitHub Repo with Minimal Reproducible Example

https://sveltejs.github.io/eslint-plugin-svelte/playground/#eJxNjEEKwjAQRa8yBBcKlqjL0OQibRdpOkIwnUgy6abk7rYWxNWH9x9vFS5OKJRos0v+zaYngIAMiw0FM2jo7kNPOz0pcLEQb+w4u9sAUgKmFFNPrfwVelq/Zt3omECafQtzJIikXPDupdfzBbT5K2l4VGPz9Gzl4RpxFakEzEKtIi8YGCXFxs9zYTsGbBJax37BJrNlnJF4Ux+1fgDeMkmM

Additional comments

No response

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