Skip to content

vue/no-mutating-props should allow for mutating properties of a prop #1339

Closed
@pimlie

Description

@pimlie

What rule do you want to change?
vue/no-mutating-props

Does this change cause the rule to produce more or fewer warnings?
Fewer warnings

How will the change be implemented? (New option, new default behavior, etc.)?
New default behaviour should be fine I suppose

Please provide some example code that this change will affect:

props: {
  myObjectProp: {
    type: Object,
    required: true,
  }
},
methods: {
  doSomething() {
    this.myObjectProp.someKey = 'change' // <- should not trigger an error

    this.myObjectProp = { // <- should trigger an error
       someKey: 'new' 
    }
  }
}

What does the rule currently do for this code?
Trigger an error

What will the rule do after it's changed?
Nothing

Additional context

See the example, if you pass an object as property it should be fine to mutate its properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions