eslint-plugin-vue
eslint-plugin-vue copied to clipboard
`vue/no-ref-as-operand` should not autofix when variable is `Ref | NotARef`
Checklist
- [x] I have tried restarting my IDE and the issue persists.
- [x] I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 8.23.1
- eslint-plugin-vue version: 9.5.1
- Node version: 16.14.2
- Operating System: win
Please show your full configuration:
module.exports = {
extends: ['jkarczm/vuetify'],
parserOptions: {
project: 'tsconfig.json',
},
}
(where jkarczm/vuetify
is from https://github.com/jacekkarczmarczyk/eslint-config-jkarczm package, but probably including only vue/no-ref-as-operand
matters)
What did you do?
let foo: Ref<number> | undefined;
if (!foo) {
foo = ref(5);
}
What did you expect to happen?
no error, no autofixing
What actually happened?
code was "fixed" to
let foo: Ref<number> | undefined;
if (!foo.value) {
foo.value = ref(5);
}
let foo;
foo = Reactive(bar)
triggers the same bug.
This was caused by #1965 I think, because those cases didn't trigger an error before and they now do