Skip to content

Commit

Permalink
Improve propType checking
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerhutchings committed Aug 16, 2019
1 parent 9cd5e66 commit 3354016
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
@@ -1,5 +1,5 @@
import { inject, observer } from 'mobx-react'
import PropTypes from 'prop-types'
import { arrayOf, string } from 'prop-types'
import React, { Component } from 'react'
import asyncStates from '@zooniverse/async-states'

Expand Down Expand Up @@ -67,9 +67,15 @@ class HeroContainer extends Component {
}

HeroContainer.propTypes = {
activeWorkflows: arrayOf(string),
defaultWorkflow: string,
language: string,
}

HeroContainer.defaultProps = {
activeWorkflows: [],
defaultWorkflow: '',
language: 'en'
}

export default HeroContainer
Expand Up @@ -19,7 +19,7 @@ class BackgroundContainer extends Component {
}

BackgroundContainer.propTypes = {
backgroundSrc: string
backgroundSrc: string.isRequired
}

@inject(storeMapper)
Expand Down
Expand Up @@ -37,9 +37,9 @@ function Introduction (props) {
}

Introduction.propTypes = {
description: string,
link: object,
title: string,
description: string.isRequired,
link: object.isRequired,
title: string.isRequired,
}

export default Introduction
Expand Up @@ -37,14 +37,14 @@ class IntroductionContainer extends Component {
}

IntroductionContainer.propTypes = {
description: string,
description: string.isRequired,
router: shape({
query: shape({
owner: string,
project: string
})
}),
title: string
owner: string.isRequired,
project: string.isRequired
}).isRequired
}).isRequired,
title: string.isRequired
}

@inject(storeMapper)
Expand Down
Expand Up @@ -62,9 +62,9 @@ function WorkflowSelector (props) {
WorkflowSelector.propTypes = {
workflows: shape({
data: arrayOf(shape({
id: string
}))
})
id: string.isRequired
}).isRequired).isRequired
}).isRequired
}

export default withTheme(WorkflowSelector)
Expand Up @@ -24,14 +24,12 @@ function WorkflowSelectButton (props) {
)
}

WorkflowSelectButton.displayName = 'WorkflowSelectButton'

WorkflowSelectButton.propTypes = {
workflow: shape({
default: bool,
displayName: string,
id: string
})
default: bool.isRequired,
displayName: string.isRequired,
id: string.isRequired
}).isRequired
}

export default withThemeContext(WorkflowSelectButton, theme)

0 comments on commit 3354016

Please sign in to comment.