vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.45k stars 666 forks source link

Nested prop mutation is not flagged #1828

Closed sstern6 closed 2 years ago

sstern6 commented 2 years ago

Checklist

Tell us about your environment

Please show your full configuration:

const path = require('path');

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
    jest: true,
  },
  extends: [
    'plugin:vue/essential',
    'plugin:vue/recommended',
    'plugin:vue-a11y/base',
    'airbnb-base',
  ],
};

What did you do?

export default {
  props: {
    thing: {
      type: Object,
      required: true,
    },
   mounted() {
      this.thing.nested = true;
   }
}

What did you expect to happen? Error

What actually happened? No error

Repository to reproduce this issue

ota-meshi commented 2 years ago

Duplicate of #1314

sstern6 commented 2 years ago

@ota-meshi thanks for pointing this out.

Curious on why nested prop mutation would be allowed but regular prop mutation isnt.

It would catch the same issue and i personally think it should be guarded against.

WDYT?

Is there a way to introduce a strict flag you can toggle?