vuejs/eslint-plugin-vue

`vue/no-mutating-props` should warn on Object.assign with prop as first argument

Closed this issue · 0 comments

What rule do you want to change?
vue/no-mutating-props should detect Object.assign on props with the prop as first argument as this target is mutated by the function

Does this change cause the rule to produce more or fewer warnings?
The rule would produce more warnings, due to detecting more unintended mutations on props

How will the change be implemented? (New option, new default behavior, etc.)?
I'd say this should be a default behavior for this rule

Please provide some example code that this change will affect:

this.$emit(
    'update:modelValue',
    Object.assign(this.modelValue, {[this.colname]: val}),
)
<input @input="$emit('update:modelValue', Object.assign(modelValue, {[colname]: $event.target.value}))" />

What does the rule currently do for this code?
This code is currently ignored by this rule!

What will the rule do after it's changed?
The rule should detect this kind of code and warn about it

Additional context
MDN Object.assign