Skip to content

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

Merged
ota-meshi merged 6 commits intomasterfrom
no-ref-object-destructure
Sep 10, 2022
Merged

Add vue/no-ref-object-destructure rule#1965
ota-meshi merged 6 commits intomasterfrom
no-ref-object-destructure

Conversation

@ota-meshi
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread docs/rules/no-ref-object-destructure.md Outdated
Comment thread tests/lib/rules/no-ref-object-destructure.js Outdated
Comment thread tests/lib/rules/no-ref-object-destructure.js Outdated
ota-meshi and others added 3 commits September 10, 2022 20:38
@ota-meshi
Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
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
Copy Markdown

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