A Vue option is an arrow function that uses this, which is not the component there
What it finds
Vue calls methods, computed properties, watchers and hooks with the component as this. An arrow function takes this from where it was written, the module, so this.count inside it is undefined.
Reported are arrow functions that use this and are a member of the methods, computed or watch options, or are the data option or a lifecycle hook.
From the rule's source, arrow_option_uses_this.rs.
import { defineComponent } from "vue";export default defineComponent({ data: () => ({ count: 0 }), methods: { inc: () => this.count++,tx0 reports: this arrow function uses this, which is not the component dec() { this.count--; }, },}); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:arrow-option-uses-this" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:arrow-option-uses-this] reason="..."tx0 explain tx0/ts:arrow-option-uses-this shows the same in the terminal. Found a false positive? Report it.