-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
no-unnecessary-state-wrap triggers too often #1154
Comments
We can suppress the warning by setting I think we can discuss the default value. Personally, I slightly preferred using |
Oh, yeah, I think Is there a case with |
@benmccann I originally thought the same and argued with @baseballyama in #1062 but in the end, I agree that assigning to |
Catching up on that thread, I agree that However, in the case that I ran into, the code was
I think false positives are far more harmful than false negatives, so would still lean towards defaulting |
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
9
What version of
eslint-plugin-svelte
are you using?3.3.3
What did you do?
Tried to upgrade https://github.com/immich-app/immich/tree/main/web to 3.3.3
It triggered
no-unnecessary-state-wrap
in two places. One was helpful, but the other I consider to be a false positiveWhat did you expect to happen?
This shouldn't be
$state
and should be aconst
: https://github.com/immich-app/immich/blob/392ce7deb2683d2c66a821c617329b3641491016/web/src/lib/components/forms/tag-asset-form.svelte#L21However, this one is pretty reasonable because you're creating a new
SvelteSet
and it's a lot more cumbersome toclear
the set and thenadd
each item: https://github.com/immich-app/immich/blob/90f21d9047aa33dcb8231ab61269e60a32aedd9f/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte#L86I think we should trigger the rule only when the variable is not being reassigned
What actually happened?
It said that I should not use
$state
in either location.Link to GitHub Repo with Minimal Reproducible Example
The full repo is here: https://github.com/immich-app/immich/tree/main/web
I can create a smaller version if needed
Additional comments
No response
The text was updated successfully, but these errors were encountered: