LoginSignup
1

More than 3 years have passed since last update.

posted at

updated at

vue/require-valid-default-prop のESLint警告の解消方法

環境

  • vue 2.6.10
  • eslint 5.16.0
  • ES7

vue/require-valid-default-prop

export default {
  ...
  props: {
    propArray: {
      type: Array,
      default: []
    },
    propObject: {
      type: Object,
      default: {}
    }
  },
  ...
}

上記の様に書くと vue/require-valid-default-prop のESLint警告が出ます。

export default {
  ...
  props: {
    propArray: {
      type: Array,
      default: () => []
    },
    propObject: {
      type: Object,
      default: () => {}
    }
  },
  ...
}

こうすればok

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
1