Skip to content

Commit

Permalink
Update Prettier to 1.15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
OtterleyW committed Dec 5, 2018
1 parent 1fa91f7 commit 0aca456
Show file tree
Hide file tree
Showing 42 changed files with 222 additions and 123 deletions.
4 changes: 2 additions & 2 deletions docs/env.md
Expand Up @@ -3,7 +3,7 @@
The following configuration variables can be set to control the Flex template app behaviour. Most of
them have defaults that work for development environment. For production deploys most should be set.

| Variable | Description |
| Variable | Description |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| REACT_APP_MAPBOX_ACCESS_TOKEN | See: [Integrating to map providers](./map-providers.md) |
| REACT_APP_GOOGLE_MAPS_API_KEY | See: [Google Maps API key](./google-maps.md) (Alternative map provider) |
Expand All @@ -24,7 +24,7 @@ them have defaults that work for development environment. For production deploys
| REACT_APP_GOOGLE_ANALYTICS_ID | See: [Google Analytics](./analytics.md) |
| REACT_APP_AVAILABILITY_ENABLED | Enables availability calendar for listings. |
| REACT_APP_DEFAULT_SEARCHES_ENABLED | Enables default search suggestions in location autocomplete search input. |
| REACT_APP_SHARETRIBE_SDK_BASE_URL | The base url to access the Sharetribe Flex Marketplace API. FTW uses the correct one by default so no need to set this. |
| REACT_APP_SHARETRIBE_SDK_BASE_URL | The base url to access the Sharetribe Flex Marketplace API. FTW uses the correct one by default so no need to set this. |

## Defining configuration

Expand Down
20 changes: 10 additions & 10 deletions docs/google-maps.md
Expand Up @@ -67,16 +67,16 @@ comments.
_public/index.html:_

```html
<script src="%PUBLIC_URL%/static/scripts/mapbox/mapbox-sdk.min.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://api.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.js"></script>
<script>
window.mapboxgl.accessToken = '%REACT_APP_MAPBOX_ACCESS_TOKEN%';
</script>
<!--
If Google Maps is used instead of Mapbox, you need to include Google's script instead:
<script src="https://maps.googleapis.com/maps/api/js?key=%REACT_APP_GOOGLE_MAPS_API_KEY%&libraries=places"></script>
-->
<script src="%PUBLIC_URL%/static/scripts/mapbox/mapbox-sdk.min.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://api.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.js"></script>
<script>
window.mapboxgl.accessToken = '%REACT_APP_MAPBOX_ACCESS_TOKEN%';
</script>
<!--
If Google Maps is used instead of Mapbox, you need to include Google's script instead:
<script src="https://maps.googleapis.com/maps/api/js?key=%REACT_APP_GOOGLE_MAPS_API_KEY%&libraries=places"></script>
-->
```

### 2. Searching with Google's geocoding API
Expand Down
18 changes: 9 additions & 9 deletions docs/icons.md
Expand Up @@ -28,15 +28,15 @@ set if icons and an HTML snippet to point to those images.
**Example HTML snippet:**

```html
<!-- Start Favicons from https://realfavicongenerator.net/ -->
<link rel="apple-touch-icon" sizes="180x180" href="/static/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/icons/favicon-16x16.png">
<link rel="mask-icon" href="/static/icons/safari-pinned-tab.svg" color="#c0392b">
<link rel="shortcut icon" href="/static/icons/favicon.ico">
<meta name="msapplication-config" content="/static/icons/browserconfig.xml">
<meta name="theme-color" content="#c0392b">
<!-- End Favicons -->
<!-- Start Favicons from https://realfavicongenerator.net/ -->
<link rel="apple-touch-icon" sizes="180x180" href="/static/icons/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/static/icons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/static/icons/favicon-16x16.png" />
<link rel="mask-icon" href="/static/icons/safari-pinned-tab.svg" color="#c0392b" />
<link rel="shortcut icon" href="/static/icons/favicon.ico" />
<meta name="msapplication-config" content="/static/icons/browserconfig.xml" />
<meta name="theme-color" content="#c0392b" />
<!-- End Favicons -->
```

## Map marker icon
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -64,7 +64,7 @@
"nodemon": "^1.17.2",
"nsp": "^3.2.1",
"nsp-preprocessor-yarn": "^1.0.1",
"prettier": "^1.11.1"
"prettier": "^1.15.3"
},
"scripts": {
"clean": "rm -rf build/*",
Expand Down
5 changes: 4 additions & 1 deletion src/Routes.js
Expand Up @@ -187,4 +187,7 @@ const mapStateToProps = state => {
// lifecycle hook.
//
// See: https://github.com/ReactTraining/react-router/issues/4671
export default compose(withRouter, connect(mapStateToProps))(Routes);
export default compose(
withRouter,
connect(mapStateToProps)
)(Routes);
4 changes: 2 additions & 2 deletions src/components/BookingBreakdown/LineItemUnitPrice.js
Expand Up @@ -12,8 +12,8 @@ const LineItemUnitPrice = props => {
const translationKey = isNightly
? 'BookingBreakdown.pricePerNight'
: isDaily
? 'BookingBreakdown.pricePerDay'
: 'BookingBreakdown.pricePerQuantity';
? 'BookingBreakdown.pricePerDay'
: 'BookingBreakdown.pricePerQuantity';

const unitPurchase = transaction.attributes.lineItems.find(
item => item.code === unitType && !item.reversal
Expand Down
6 changes: 5 additions & 1 deletion src/components/Discussion/Discussion.js
Expand Up @@ -43,7 +43,11 @@ class Discussion extends Component {
render() {
return (
<div className={this.props.className}>
<ul>{this.props.messages.map(msg => <Message key={msg.id} {...msg} />)}</ul>
<ul>
{this.props.messages.map(msg => (
<Message key={msg.id} {...msg} />
))}
</ul>
<form className={css.sendMessageForm} onSubmit={this.handleNewMessage}>
<input
className={css.sendMessageInput}
Expand Down
5 changes: 4 additions & 1 deletion src/components/EditListingWizard/EditListingWizard.js
Expand Up @@ -327,4 +327,7 @@ EditListingWizard.propTypes = {
intl: intlShape.isRequired,
};

export default compose(withViewport, injectIntl)(EditListingWizard);
export default compose(
withViewport,
injectIntl
)(EditListingWizard);
4 changes: 2 additions & 2 deletions src/components/ListingLink/ListingLink.js
Expand Up @@ -44,8 +44,8 @@ const ListingLink = props => {
const variant = isPendingApproval
? LISTING_PAGE_PENDING_APPROVAL_VARIANT
: isDraft
? LISTING_PAGE_DRAFT_VARIANT
: null;
? LISTING_PAGE_DRAFT_VARIANT
: null;
const linkProps = !!variant
? {
name: 'ListingPageVariant',
Expand Down
9 changes: 6 additions & 3 deletions src/components/ManageListingCard/ManageListingCard.js
Expand Up @@ -68,8 +68,8 @@ const createListingURL = (routes, listing) => {
const variant = isDraft
? LISTING_PAGE_DRAFT_VARIANT
: isPendingApproval
? LISTING_PAGE_PENDING_APPROVAL_VARIANT
: null;
? LISTING_PAGE_PENDING_APPROVAL_VARIANT
: null;

const linkProps =
isPendingApproval || isDraft
Expand Down Expand Up @@ -359,4 +359,7 @@ ManageListingCardComponent.propTypes = {
}).isRequired,
};

export default compose(withRouter, injectIntl)(ManageListingCardComponent);
export default compose(
withRouter,
injectIntl
)(ManageListingCardComponent);
4 changes: 2 additions & 2 deletions src/components/Map/StaticGoogleMap.js
Expand Up @@ -91,8 +91,8 @@ class StaticGoogleMap extends Component {
const targetMaybe = mapsConfig.fuzzy.enabled
? { path: drawFuzzyCircle(mapsConfig, center) }
: mapsConfig.customMarker.enabled
? { markers: customMarker(mapsConfig.customMarker, lat, lng) }
: { markers: `${lat},${lng}` };
? { markers: customMarker(mapsConfig.customMarker, lat, lng) }
: { markers: `${lat},${lng}` };

const srcParams = stringify({
center: encodeLatLng(center),
Expand Down
4 changes: 2 additions & 2 deletions src/components/RangeSlider/RangeSlider.js
Expand Up @@ -33,14 +33,14 @@ class RangeSliderComponent extends Component {
const width = dimensions.width;
const valueOffset = value - min;
const scale = max - min;
return Math.round(valueOffset / scale * width);
return Math.round((valueOffset / scale) * width);
}

toValue(position) {
const { dimensions, min, max, step } = this.props;
const width = dimensions.width;
const scale = max - min;
const value = Math.round(position / width * scale) + min;
const value = Math.round((position / width) * scale) + min;
return Math.ceil(value / step) * step;
}

Expand Down
5 changes: 4 additions & 1 deletion src/components/SearchFilters/SearchFilters.js
Expand Up @@ -229,6 +229,9 @@ SearchFiltersComponent.propTypes = {
intl: intlShape.isRequired,
};

const SearchFilters = compose(withRouter, injectIntl)(SearchFiltersComponent);
const SearchFilters = compose(
withRouter,
injectIntl
)(SearchFiltersComponent);

export default SearchFilters;
36 changes: 19 additions & 17 deletions src/components/SearchMap/SearchMapWithMapbox.js
Expand Up @@ -148,8 +148,8 @@ const priceLabelsInLocations = (
const infoCardOpenIds = Array.isArray(infoCardOpen)
? infoCardOpen.map(l => l.id.uuid)
: infoCardOpen
? [infoCardOpen.id.uuid]
: [];
? [infoCardOpen.id.uuid]
: [];

// if the listing is open, don't print price label
if (infoCardOpen != null && infoCardOpenIds.includes(listing.id.uuid)) {
Expand Down Expand Up @@ -400,22 +400,24 @@ class SearchMapWithMapbox extends Component {

// SearchMapPriceLabel and SearchMapGroupLabel:
// create a new marker or use existing one if markerId is among previously rendered markers
this.currentMarkers = labels.filter(v => v != null).map(m => {
const existingMarkerId = this.currentMarkers.findIndex(
marker => m.markerId === marker.markerId && marker.marker
);
this.currentMarkers = labels
.filter(v => v != null)
.map(m => {
const existingMarkerId = this.currentMarkers.findIndex(
marker => m.markerId === marker.markerId && marker.marker
);

if (existingMarkerId >= 0) {
const { marker, markerContainer, ...rest } = this.currentMarkers[existingMarkerId];
return { ...rest, ...m, markerContainer, marker };
} else {
const markerContainer = document.createElement('div');
markerContainer.setAttribute('id', m.markerId);
markerContainer.classList.add(css.labelContainer);
const marker = createMarker(m, markerContainer);
return { ...m, markerContainer, marker };
}
});
if (existingMarkerId >= 0) {
const { marker, markerContainer, ...rest } = this.currentMarkers[existingMarkerId];
return { ...rest, ...m, markerContainer, marker };
} else {
const markerContainer = document.createElement('div');
markerContainer.setAttribute('id', m.markerId);
markerContainer.classList.add(css.labelContainer);
const marker = createMarker(m, markerContainer);
return { ...m, markerContainer, marker };
}
});

/* Create marker for SearchMapInfoCard component */
if (infoCardOpen) {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Topbar/Topbar.js
Expand Up @@ -326,7 +326,10 @@ TopbarComponent.propTypes = {
intl: intlShape.isRequired,
};

const Topbar = compose(withViewport, injectIntl)(TopbarComponent);
const Topbar = compose(
withViewport,
injectIntl
)(TopbarComponent);

Topbar.displayName = 'Topbar';

Expand Down
4 changes: 2 additions & 2 deletions src/components/TransactionPanel/TransactionPanel.helpers.js
Expand Up @@ -100,8 +100,8 @@ export const AddressLinkMaybe = props => {
const hrefToGoogleMaps = geolocation
? `https://maps.google.com/?q=${lat},${lng}`
: address
? `https://maps.google.com/?q=${encodeURIComponent(address)}`
: null;
? `https://maps.google.com/?q=${encodeURIComponent(address)}`
: null;

const fullAddress =
typeof building === 'string' && building.length > 0 ? `${building}, ${address}` : address;
Expand Down
5 changes: 4 additions & 1 deletion src/containers/AuthenticationPage/AuthenticationPage.js
Expand Up @@ -324,7 +324,10 @@ const mapDispatchToProps = dispatch => ({
// See: https://github.com/ReactTraining/react-router/issues/4671
const AuthenticationPage = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(AuthenticationPageComponent);

Expand Down
11 changes: 8 additions & 3 deletions src/containers/CheckoutPage/CheckoutPage.js
Expand Up @@ -532,9 +532,14 @@ const mapDispatchToProps = dispatch => ({
fetchSpeculatedTransaction: params => dispatch(speculateTransaction(params)),
});

const CheckoutPage = compose(withRouter, connect(mapStateToProps, mapDispatchToProps), injectIntl)(
CheckoutPageComponent
);
const CheckoutPage = compose(
withRouter,
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(CheckoutPageComponent);

CheckoutPage.setInitialValues = initialValues => setInitialValues(initialValues);

Expand Down
10 changes: 7 additions & 3 deletions src/containers/ContactDetailsPage/ContactDetailsPage.js
Expand Up @@ -167,9 +167,13 @@ const mapDispatchToProps = dispatch => ({
onSubmitContactDetails: values => dispatch(saveContactDetails(values)),
});

const ContactDetailsPage = compose(connect(mapStateToProps, mapDispatchToProps), injectIntl)(
ContactDetailsPageComponent
);
const ContactDetailsPage = compose(
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(ContactDetailsPageComponent);

ContactDetailsPage.loadData = () => {
// Since verify email happens in separate tab, current user's data might be updated
Expand Down
10 changes: 7 additions & 3 deletions src/containers/EditListingPage/EditListingPage.js
Expand Up @@ -271,9 +271,13 @@ const mapDispatchToProps = dispatch => ({
// lifecycle hook.
//
// See: https://github.com/ReactTraining/react-router/issues/4671
const EditListingPage = compose(withRouter, connect(mapStateToProps, mapDispatchToProps))(
injectIntl(EditListingPageComponent)
);
const EditListingPage = compose(
withRouter,
connect(
mapStateToProps,
mapDispatchToProps
)
)(injectIntl(EditListingPageComponent));

EditListingPage.loadData = loadData;

Expand Down
Expand Up @@ -138,7 +138,10 @@ const mapDispatchToProps = dispatch => ({
// See: https://github.com/ReactTraining/react-router/issues/4671
const EmailVerificationPage = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(EmailVerificationPageComponent);

Expand Down
5 changes: 4 additions & 1 deletion src/containers/InboxPage/InboxPage.js
Expand Up @@ -419,7 +419,10 @@ const mapStateToProps = state => {
};
};

const InboxPage = compose(connect(mapStateToProps), injectIntl)(InboxPageComponent);
const InboxPage = compose(
connect(mapStateToProps),
injectIntl
)(InboxPageComponent);

InboxPage.loadData = loadData;

Expand Down
6 changes: 5 additions & 1 deletion src/containers/LandingPage/LandingPage.js
Expand Up @@ -107,6 +107,10 @@ const mapStateToProps = state => {
// lifecycle hook.
//
// See: https://github.com/ReactTraining/react-router/issues/4671
const LandingPage = compose(withRouter, connect(mapStateToProps), injectIntl)(LandingPageComponent);
const LandingPage = compose(
withRouter,
connect(mapStateToProps),
injectIntl
)(LandingPageComponent);

export default LandingPage;
11 changes: 8 additions & 3 deletions src/containers/ListingPage/ListingPage.js
Expand Up @@ -620,9 +620,14 @@ const mapDispatchToProps = dispatch => ({
// lifecycle hook.
//
// See: https://github.com/ReactTraining/react-router/issues/4671
const ListingPage = compose(withRouter, connect(mapStateToProps, mapDispatchToProps), injectIntl)(
ListingPageComponent
);
const ListingPage = compose(
withRouter,
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(ListingPageComponent);

ListingPage.setInitialValues = initialValues => setInitialValues(initialValues);
ListingPage.loadData = loadData;
Expand Down
10 changes: 7 additions & 3 deletions src/containers/ManageListingsPage/ManageListingsPage.js
Expand Up @@ -231,9 +231,13 @@ const mapDispatchToProps = dispatch => ({
onOpenListing: listingId => dispatch(openListing(listingId)),
});

const ManageListingsPage = compose(connect(mapStateToProps, mapDispatchToProps), injectIntl)(
ManageListingsPageComponent
);
const ManageListingsPage = compose(
connect(
mapStateToProps,
mapDispatchToProps
),
injectIntl
)(ManageListingsPageComponent);

ManageListingsPage.loadData = (params, search) => {
const queryParams = parse(search);
Expand Down

0 comments on commit 0aca456

Please sign in to comment.