Skip to content

Commit

Permalink
fix: update propTypes and defaultProps
Browse files Browse the repository at this point in the history
  • Loading branch information
Dvun committed Dec 12, 2023
1 parent 7d0e6af commit ac8bc1c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
9 changes: 7 additions & 2 deletions app/component/Availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ Availability.displayName = 'Availability';
Availability.propTypes = {
available: PropTypes.number.isRequired,
total: PropTypes.number.isRequired,
fewAvailableCount: PropTypes.number.isRequired,
fewerAvailableCount: PropTypes.number.isRequired,
fewAvailableCount: PropTypes.number,
fewerAvailableCount: PropTypes.number,
text: PropTypes.node.isRequired,
showStatusBar: PropTypes.bool.isRequired,
};

Availability.defaultProps = {
fewAvailableCount: undefined,
fewerAvailableCount: undefined,
};

export default Availability;
3 changes: 2 additions & 1 deletion app/component/DepartureRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ DepartureRow.propTypes = {
showPlatformCode: PropTypes.bool,
canceled: PropTypes.bool,
className: PropTypes.string,
onCapacityClick: PropTypes.func.isRequired,
// eslint-disable-next-line react/require-default-props
onCapacityClick: PropTypes.func,
};

DepartureRow.contextTypes = {
Expand Down
6 changes: 3 additions & 3 deletions app/component/StopsNearYouFavouritesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ StopsNearYouFavouritesContainer.propTypes = {
stations: PropTypes.array,
vehicleStations: PropTypes.array,
searchPosition: dtLocationShape,
relay: PropTypes.shape({
refetch: PropTypes.func.isRequired,
}).isRequired,
// relay: PropTypes.shape({
// refetch: PropTypes.func.isRequired,
// }).isRequired,
};

const refetchContainer = createFragmentContainer(
Expand Down
23 changes: 20 additions & 3 deletions app/component/VehicleStopNearYou.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,29 @@ const VehicleStopNearYou = ({ stop, relay, currentTime, currentMode }) => {
);
};
VehicleStopNearYou.propTypes = {
stop: PropTypes.object.isRequired,
currentTime: PropTypes.number.isRequired,
currentMode: PropTypes.string.isRequired,
stop: PropTypes.shape({
capacity: PropTypes.number,
distance: PropTypes.number,
lat: PropTypes.number,
lon: PropTypes.number,
name: PropTypes.string,
network: PropTypes.string,
operative: PropTypes.bool,
spacesAvailable: PropTypes.number,
stationId: PropTypes.string,
type: PropTypes.string,
vehiclesAvailable: PropTypes.number,
}).isRequired,
currentTime: PropTypes.number,
currentMode: PropTypes.string,
relay: PropTypes.any,
};

VehicleStopNearYou.defaultProps = {
currentTime: undefined,
currentMode: undefined,
};

const containerComponent = createRefetchContainer(
VehicleStopNearYou,
{
Expand Down
11 changes: 8 additions & 3 deletions app/component/map/StopsNearYouMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,13 @@ function StopsNearYouMap(

StopsNearYouMap.propTypes = {
currentTime: PropTypes.number.isRequired,
stopsNearYou: PropTypes.object,
stopsNearYou: PropTypes.shape({
nearest: PropTypes.shape({
edges: PropTypes.arrayOf(PropTypes.object).isRequired,
}).isRequired,
}),
prioritizedStopsNearYou: PropTypes.array,
favouriteIds: PropTypes.objectOf(PropTypes.string.isRequired),
favouriteIds: PropTypes.object,
mapLayers: PropTypes.object.isRequired,
mapLayerOptions: mapLayerOptionsShape,
position: dtLocationShape.isRequired,
Expand All @@ -510,9 +514,10 @@ StopsNearYouMap.propTypes = {
};

StopsNearYouMap.defaultProps = {
stopsNearYou: null,
showWalkRoute: false,
loading: false,
favouriteIds: {},
favouriteIds: undefined,
};

StopsNearYouMap.contextTypes = {
Expand Down

0 comments on commit ac8bc1c

Please sign in to comment.