Change: Enforce `required` key on all props to Do not enforce `required` key on optional props
required
key on all props to Do not enforce required
key on optional props
Change pattern proposal: Enforce Old Pattern
As per our styleguide the required
key should always be provided.
Required key should always be provided when declaring a prop
// bad
props: {
foo: {
type: String,
}
}
// good
props: {
foo: {
type: String,
required: false,
default: 'bar'
}
}
New Pattern
Allow the author to decide if required: false
should be provided on optional properties.
Advantages of switching patterns
- Enforcing the rule requires manual work from authors and reviewers. This is work we could save.
- We haven't been doing a great job at enforcing this manually: it's easy to find instances that break this rule
Disadvantages of switching patterns
- There will be mixed implementations.
- Conformity increases readability.
What is the impact on our existing codebase?
Remove the docs section requiring this pattern: gitlab-org/gitlab!22972 (closed)