Skip to content

Vue rules

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.

Rewrite the component with defineComponent or <script setup> and the Composition API.

@Component class Cart extends Vue {} reports classComponent. Write the component with defineComponent({ setup() { ... } }).

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.

Move the shared logic into a composable function, and call it from setup.

defineComponent({ mixins: [tracking] }) reports mixin. Write setup() { useTracking(); }.

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.

Guard the write with a condition that stops changing the value, or move it to a watcher or an event callback.

onUpdated(() => { count.value++; }) reports loop. Write onUpdated(() => { if (count.value < 3) count.value++; }).