A Vue component assigns to one of its own props, which the parent overwrites on its next render
What it finds
Props flow from parent to child. A child that assigns to a prop changes only its local copy, which Vue replaces with the parent's value on the next render, and Vue warns about it. Local state initialized from the prop, or an event to the parent, does what was meant.
Reported are assignments to this.name in the options of a component that declares the prop name, and assignments to a property of the first parameter of setup.
From the rule's source, prop_mutation.rs.
import { defineComponent } from "vue";export default defineComponent({ props: ["value"], methods: { clear() { this.value = "";tx0 reports: the prop value is assigned in the child }, },}); 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:prop-mutation" = "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:prop-mutation] reason="..."tx0 explain tx0/ts:prop-mutation shows the same in the terminal. Found a false positive? Report it.