-
-
Notifications
You must be signed in to change notification settings - Fork 48
Add prefer-reactive-destructuring
rule
#205
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
Conversation
3ecafc5
to
6cf01f5
Compare
I've noticed that sometimes what the rule report doesn't lead to a reduction in render times. See #208 (comment) |
export default createRule("prefer-reactive-destructuring", { | ||
meta: { | ||
docs: { | ||
description: "Prefer destructuring from objects in reactive statements", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first letter should be lowercase to be consistent with existing rules. (see #218)
@tivac What are the remaining tasks of the PR? I can do the remaining tasks if you need. |
@baseballyama Needs to be changed to a stylistic rule and any remaining comments need to be addressed (I think it's just capitalization nit?). Seems like either svelte has improved object access change tracking or my initial tests when I wrote these rules years ago were faulty 🤷🏻♂️ So this is really a style preference over a perf thing. |
I checked this rule well, and now I understand this rule doesn't have an impact on rendering frequency. So I think even in terms of styling, I don't think we need to add this rule. |
Thank you for the explanation.
You are right. So I will close this PR. |
From the docs:
This rule triggers whenever a reactive statement contains an assignment that could be rewritten using destructuring. This is beneficial because it allows svelte's change-tracking to prevent wasteful redraws whenever the object is changed.
This svelte REPL example shows just how effective this can be at preventing bogus redraws.