Vue rules
no-vue-class-components
Section titled “no-vue-class-components”Reports a class that extends Vue from vue-class-component, or carries its @Component or @Options decorator or a decorator of vue-property-decorator on the class or a member, in projects whose package.json allows Vue 3.
On in the recommended and all configs.
vue-class-component and vue-property-decorator are no longer maintained for Vue 3, and their decorators hide the component options that the Composition API writes out.
What to do
Section titled “What to do”Rewrite the component with defineComponent or <script setup> and the Composition API.
Example
Section titled “Example”@Component class Cart extends Vue {} reports classComponent. Write the component with defineComponent({ setup() { ... } }).
no-vue-mixins
Section titled “no-vue-mixins”Reports a mixins property whose value is an array, written in place or held by a variable, in an object of a project whose package.json allows Vue 3.
On in the recommended and all configs.
A mixin merges its options into the component without a name, so a reader cannot tell where a property comes from, and two mixins can overwrite each other.
What to do
Section titled “What to do”Move the shared logic into a composable function, and call it from setup.
Example
Section titled “Example”defineComponent({ mixins: [tracking] }) reports mixin. Write setup() { useTracking(); }.
no-vue-updated-writes
Section titled “no-vue-updated-writes”Reports an unguarded write to a Vue ref or reactive value in an onUpdated callback or an updated option when each run changes the value, such as an increment.
On in the recommended and all configs.
Vue runs the hook after each update, and the write schedules the next update, so the component loops until Vue stops it.
What to do
Section titled “What to do”Guard the write with a condition that stops changing the value, or move it to a watcher or an event callback.
Example
Section titled “Example”onUpdated(() => { count.value++; }) reports loop. Write onUpdated(() => { if (count.value < 3) count.value++; }).