Skip to content

no-ref-object-reactivity-loss: false negative when the accessing is wrapped in IIFE with the same scope #3056

@n0099

Description

@n0099

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 10.0.2
  • eslint-plugin-vue version: 10.8.0
  • Vue version: 3.5.29
  • Node version: 24.12.0
  • Operating System: NixOS

Please show your full configuration:

https://github.com/n0099/open-tbm/blob/e48097c0ac96da264942f52d74bcd294855df35a/fe/eslint.config.ts

What did you do?

const firstThread = computed(() => firstPostPage.value?.threads[0]); // https://github.com/n0099/open-tbm/blob/92fd7111a62c16f0f7ec29da5fae04a34532f1e2/fe/src/utils/post/seo/index.ts#L18
console.log(firstThread.value?.title);
//          ^ reporting violation of eslint rule `vue/no-ref-object-reactivity-loss`
(() => {
    const firstThreadTitle = computed(() => firstThread.value?.title); // https://github.com/n0099/open-tbm/blob/92fd7111a62c16f0f7ec29da5fae04a34532f1e2/fe/src/utils/post/seo/index.ts#L56
    console.log(firstThread.value?.title);
    //          ^ not reporting violation of eslint rule `vue/no-ref-object-reactivity-loss`
    console.log(firstThreadTitle.value);
    //          ^ reporting violation of eslint rule `vue/no-ref-object-reactivity-loss`
})();

What did you expect to happen?
firstThread.value?.title inside this IIFE should also report.

What actually happened?

Not reporting.

Repository to reproduce this issue

https://github.com/n0099/open-tbm/blob/e48097c0ac96da264942f52d74bcd294855df35a/fe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions