Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 746 Bytes

require-prop-types.md

File metadata and controls

42 lines (33 loc) · 746 Bytes

Prop definitions should be detailed (require-prop-types)

In committed code, prop definitions should always be as detailed as possible, specifying at least type(s).

📖 Rule Details

This rule enforces that a props statement contains type definition.

👎 Examples of incorrect code for this rule:

export default {
  props: ['status']
}

👍 Examples of correct code for this rule:

export default {
  props: {
    status: String
  }
}
export default {
  props: {
    status: {
      type: String,
      required: true,
      validate: function (value) {
        return ['syncing', 'synced', 'version-conflict', 'error'].indexOf(value) !== -1
      }
    }
  }
}

🔧 Options

Nothing.