Visitar URL original
feat(no-ref-as-operand): report refs detected by type information by ValentinYoushkevich · Pull Request #3144 · vuejs/eslint-plugin-vue · GitHub
Skip to content

feat(no-ref-as-operand): report refs detected by type information - #3144

Merged
waynzh merged 3 commits into
vuejs:masterfrom
ValentinYoushkevich:feat/no-ref-as-operand-typed-refs
Oct 19, 2026
Merged

waynzh merged 3 commits into
vuejs:masterfrom
ValentinYoushkevich:feat/no-ref-as-operand-typed-refs

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

Closes #2519

Following the suggestion in the issue, the rule now also uses type information when it's available. If a variable isn't created by ref() and friends in the same file but its type is a ref, it gets reported as well, so const ok = useOk(); ok ? 'yes' : 'no' is caught when useOk returns Ref<boolean>.

A value counts as a ref when its type has the RefSymbol marker, which covers Ref, ShallowRef, ComputedRef and the rest, while MaybeRef isn't reported. Plain = assignment is left out since assigning another ref there is valid. Without type information nothing changes.

@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b4548e8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-vue Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very cool, thank you!

Comment thread docs/rules/no-ref-as-operand.md Resolved
@ValentinYoushkevich

Copy link
Copy Markdown
Contributor Author

Thanks! Applied both suggestions.

@FloEdelmann FloEdelmann mentioned this pull request Oct 16, 2026

@waynzh waynzh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@waynzh
waynzh merged commit 902b74d into vuejs:master Oct 19, 2026
17 checks passed
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.

vue/no-ref-as-operand to support ref from composable

3 participants