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

Add vue/no-ref-object-destructure rule #1965

Merged
merged 6 commits into from Sep 10, 2022
Merged

Conversation

ota-meshi
Copy link
Member

This PR adds vue/no-ref-object-destructure rule that reports the destructuring of ref objects causing the value to lose reactivity.

close #1949

Copy link
Member

@FloEdelmann FloEdelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick look because I don't have time for a full review of this big PR.

docs/rules/no-ref-object-destructure.md Outdated Show resolved Hide resolved
tests/lib/rules/no-ref-object-destructure.js Outdated Show resolved Hide resolved
tests/lib/rules/no-ref-object-destructure.js Outdated Show resolved Hide resolved
@ota-meshi
Copy link
Member Author

Thank you for the quick review! I have changed the part you commented on.

Copy link
Member

@FloEdelmann FloEdelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that looks fine now. As noted earlier, I have not looked deeper into the other parts though.

@ota-meshi ota-meshi merged commit 8828bbb into master Sep 10, 2022
@ota-meshi ota-meshi deleted the no-ref-object-destructure branch September 10, 2022 22:53
@Tofandel
Copy link

Tofandel commented Sep 22, 2022

This seems to have caused a regression on the vue/no-ref-as-operand rule

import {ref} from 'vue';

const something = false;
let columns;

if (something) {
  columns = ref([1]);
} else {
  columns = ref([2]);
}

This used to be fine, with the new version this causes

 error  Must use `.value` to read or write the value wrapped by `ref()`  vue/no-ref-as-operand
 error  Must use `.value` to read or write the value wrapped by `ref()`  vue/no-ref-as-operand

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

Successfully merging this pull request may close these issues.

Rule Proposal: vue/no-ref-object-destructure rule
3 participants