From cfab06d813214487dd3bdd9c54f0934f1eb99490 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Wed, 15 Mar 2017 15:54:31 +0200 Subject: [PATCH] Don't print trailing comma in fn args since it breaks in Node --- package.json | 2 +- src/app.js | 2 +- src/components/AddImages/AddImages.example.js | 2 +- src/components/BookingInfo/BookingInfo.test.js | 2 +- src/components/HeroSection/HeroSection.test.js | 2 +- .../LocationAutocompleteInput.js | 2 +- src/components/NamedLink/NamedLink.test.js | 4 ++-- src/components/RoutesProvider/RoutesProvider.test.js | 2 +- .../AuthenticationPage/AuthenticationPage.js | 2 +- src/containers/EditListingForm/EditListingForm.js | 2 +- src/containers/EditListingForm/EditListingForm.test.js | 2 +- src/containers/EditListingPage/EditListingPage.test.js | 2 +- src/containers/ListingPage/ListingPage.test.js | 4 ++-- src/containers/SearchPage/SearchPage.duck.js | 2 +- src/containers/SearchPage/SearchPage.test.js | 2 +- src/index.js | 2 +- src/util/data.js | 4 ++-- src/util/data.test.js | 10 +++++----- src/util/googleMaps.js | 6 ++---- src/util/propTypes.js | 2 +- src/util/routes.js | 4 ++-- src/util/routes.test.js | 4 ++-- src/util/sagaHelpers.js | 2 +- src/util/test-helpers.js | 2 +- 24 files changed, 34 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 518c5025..a9464292 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "clean": "rm -rf build/*", "dev": "sharetribe-scripts start", "build": "sharetribe-scripts build", - "format": "prettier --write --print-width 100 --single-quote --trailing-comma all 'server/**/*.js' 'src/**/*.js'", + "format": "prettier --write --print-width 100 --single-quote --trailing-comma es5 'server/**/*.js' 'src/**/*.js'", "test": "sharetribe-scripts test --env=jsdom", "test-ci": "sharetribe-scripts test --env=jsdom --runInBand", "eject": "sharetribe-scripts eject", diff --git a/src/app.js b/src/app.js index 08a4cd34..6eb1f5fe 100644 --- a/src/app.js +++ b/src/app.js @@ -65,7 +65,7 @@ ServerApp.propTypes = { url: string.isRequired, context: any.isRequired, store: export const renderApp = (url, serverContext, preloadedState) => { const store = configureStore(preloadedState); const body = ReactDOMServer.renderToString( - , + ); const head = Helmet.rewind(); return { head, body }; diff --git a/src/components/AddImages/AddImages.example.js b/src/components/AddImages/AddImages.example.js index d9af74c9..6e150f15 100644 --- a/src/components/AddImages/AddImages.example.js +++ b/src/components/AddImages/AddImages.example.js @@ -45,7 +45,7 @@ class AddImagesTest extends Component { }; }); }, - 1000, + 1000 ); } diff --git a/src/components/BookingInfo/BookingInfo.test.js b/src/components/BookingInfo/BookingInfo.test.js index 342e2409..a5da72cc 100644 --- a/src/components/BookingInfo/BookingInfo.test.js +++ b/src/components/BookingInfo/BookingInfo.test.js @@ -10,7 +10,7 @@ describe('BookingInfo', () => { bookingPeriod="Jan 2nd - Jan 4th" bookingDuration="3 days" total="165\u20AC" - />, + /> ); expect(tree).toMatchSnapshot(); }); diff --git a/src/components/HeroSection/HeroSection.test.js b/src/components/HeroSection/HeroSection.test.js index 25e550d1..a6961cb6 100644 --- a/src/components/HeroSection/HeroSection.test.js +++ b/src/components/HeroSection/HeroSection.test.js @@ -7,7 +7,7 @@ describe('HeroSection', () => { const tree = renderDeep( test - , + ); expect(tree).toMatchSnapshot(); }); diff --git a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js index b72f12d9..7f04a586 100644 --- a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js +++ b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js @@ -53,7 +53,7 @@ LocationPredictionsList.propTypes = { id: string.isRequired, description: string.isRequired, place_id: string.isRequired, - }), + }) ).isRequired, highlightedIndex: number, onSelectItem: func.isRequired, diff --git a/src/components/NamedLink/NamedLink.test.js b/src/components/NamedLink/NamedLink.test.js index 03a2f621..55ab0e3d 100644 --- a/src/components/NamedLink/NamedLink.test.js +++ b/src/components/NamedLink/NamedLink.test.js @@ -26,7 +26,7 @@ describe('NamedLinkComponent', () => {
link to a link to b -
, + ); const aLink = tree.children[0]; const bLink = tree.children[1]; @@ -46,7 +46,7 @@ describe('NamedLink', () => { const tree = renderDeep( to SomePage - , + ); expect(tree.type).toEqual('a'); expect(tree.props.href).toEqual(`/somepage/${id}`); diff --git a/src/components/RoutesProvider/RoutesProvider.test.js b/src/components/RoutesProvider/RoutesProvider.test.js index 7cbcdb5e..ccc8b705 100644 --- a/src/components/RoutesProvider/RoutesProvider.test.js +++ b/src/components/RoutesProvider/RoutesProvider.test.js @@ -11,7 +11,7 @@ describe('RoutesProvider', () => { Child.contextTypes = { flattenedRoutes: React.PropTypes.array }; const tree = renderDeep( - , + ); expect(tree.children).toContain('SomePage'); }); diff --git a/src/containers/AuthenticationPage/AuthenticationPage.js b/src/containers/AuthenticationPage/AuthenticationPage.js index 8c836f8f..75b76cf4 100644 --- a/src/containers/AuthenticationPage/AuthenticationPage.js +++ b/src/containers/AuthenticationPage/AuthenticationPage.js @@ -79,7 +79,7 @@ const mapDispatchToProps = dispatch => ({ }); const AuthenticationPage = connect(mapStateToProps, mapDispatchToProps)( - AuthenticationPageComponent, + AuthenticationPageComponent ); export default AuthenticationPage; diff --git a/src/containers/EditListingForm/EditListingForm.js b/src/containers/EditListingForm/EditListingForm.js index 64754df0..d692d3a7 100644 --- a/src/containers/EditListingForm/EditListingForm.js +++ b/src/containers/EditListingForm/EditListingForm.js @@ -116,7 +116,7 @@ class EditListingForm extends Component { { id: 'EditListingForm.maxLength' }, { maxLength: TITLE_MAX_LENGTH, - }, + } ); const maxLength60 = maxLength(maxLengthStr, TITLE_MAX_LENGTH); const imageRequiredStr = intl.formatMessage({ id: 'EditListingForm.imageRequired' }); diff --git a/src/containers/EditListingForm/EditListingForm.test.js b/src/containers/EditListingForm/EditListingForm.test.js index 5ed55006..da6a706f 100644 --- a/src/containers/EditListingForm/EditListingForm.test.js +++ b/src/containers/EditListingForm/EditListingForm.test.js @@ -14,7 +14,7 @@ describe('EditListingForm', () => { onImageUpload={v => v} onSubmit={v => v} onUpdateImageOrder={v => v} - />, + /> ); expect(tree).toMatchSnapshot(); }); diff --git a/src/containers/EditListingPage/EditListingPage.test.js b/src/containers/EditListingPage/EditListingPage.test.js index cd6c2ff7..112650db 100644 --- a/src/containers/EditListingPage/EditListingPage.test.js +++ b/src/containers/EditListingPage/EditListingPage.test.js @@ -15,7 +15,7 @@ describe('EditListingPageComponent', () => { onUpdateImageOrder={v => v} page={{ imageOrder: [], images: {} }} type="new" - />, + /> ); expect(tree).toMatchSnapshot(); }); diff --git a/src/containers/ListingPage/ListingPage.test.js b/src/containers/ListingPage/ListingPage.test.js index 796b3afd..0df312a8 100644 --- a/src/containers/ListingPage/ListingPage.test.js +++ b/src/containers/ListingPage/ListingPage.test.js @@ -17,7 +17,7 @@ describe('ListingPage', () => { marketplaceData={marketplaceData} intl={fakeIntl} onLoadListing={l => l} - />, + /> ); expect(tree).toMatchSnapshot(); }); @@ -57,7 +57,7 @@ describe('ListingPage', () => { expect(e).toEqual(error); expect(show.mock.calls).toEqual([[{ id, include: ['author', 'images'] }]]); expect(dispatch.mock.calls).toEqual([[showListingRequest(id)], [showListingError(e)]]); - }, + } ); }); }); diff --git a/src/containers/SearchPage/SearchPage.duck.js b/src/containers/SearchPage/SearchPage.duck.js index 76caf833..847a34c1 100644 --- a/src/containers/SearchPage/SearchPage.duck.js +++ b/src/containers/SearchPage/SearchPage.duck.js @@ -92,7 +92,7 @@ const lookupMap = included => return memo; }, - {}, + {} ); // Format the data as ListingCard component expects it and diff --git a/src/containers/SearchPage/SearchPage.test.js b/src/containers/SearchPage/SearchPage.test.js index e9d1b463..d9e7b547 100644 --- a/src/containers/SearchPage/SearchPage.test.js +++ b/src/containers/SearchPage/SearchPage.test.js @@ -18,7 +18,7 @@ const { LatLng } = types; describe('SearchPageComponent', () => { it('matches snapshot', () => { const tree = renderShallow( - v} dispatch={() => null} />, + v} dispatch={() => null} /> ); expect(tree).toMatchSnapshot(); }); diff --git a/src/index.js b/src/index.js index ca5c878c..f7927ba6 100644 --- a/src/index.js +++ b/src/index.js @@ -74,7 +74,7 @@ if (typeof window !== 'undefined') { if (config.dev) { const actions = bindActionCreators( { showListings, queryListings, searchListings, showMarketplace, showUsers }, - store.dispatch, + store.dispatch ); window.app = { config, sdk, sdkTypes: types, actions, store, sample, routeConfiguration }; } diff --git a/src/util/data.js b/src/util/data.js index 9b000659..451aaeb4 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -48,7 +48,7 @@ export const updatedEntities = (oldEntities, apiResponse) => { entities[type][id.uuid] = entity ? combinedResourceObjects(entity, curr) : curr; return entities; }, - oldEntities, + oldEntities ); /* eslint-enable no-param-reassign */ @@ -100,7 +100,7 @@ export const denormalisedEntities = (entities, type, ids) => { } return ent; }, - entityData, + entityData ); } return entityData; diff --git a/src/util/data.test.js b/src/util/data.test.js index 01d7cdbe..22a142d8 100644 --- a/src/util/data.test.js +++ b/src/util/data.test.js @@ -66,7 +66,7 @@ describe('data utils', () => { const listing1 = { id: new UUID('listing1'), type: 'listing' }; const listing2 = { id: new UUID('listing2'), type: 'listing' }; expect(() => combinedResourceObjects(listing1, listing2)).toThrow( - 'Cannot merge resource objects with different ids or types', + 'Cannot merge resource objects with different ids or types' ); }); @@ -74,7 +74,7 @@ describe('data utils', () => { const listing1 = { id: new UUID('listing1'), type: 'listing' }; const author1 = { id: new UUID('author1'), type: 'author' }; expect(() => combinedResourceObjects(listing1, author1)).toThrow( - 'Cannot merge resource objects with different ids or types', + 'Cannot merge resource objects with different ids or types' ); }); @@ -200,7 +200,7 @@ describe('data utils', () => { it('throws when selecting a nonexistent type', () => { const entities = { listing: { listing1: createListing('listing1') } }; expect(() => denormalisedEntities(entities, 'user', [new UUID('user1')])).toThrow( - 'No entities of type user', + 'No entities of type user' ); }); @@ -208,7 +208,7 @@ describe('data utils', () => { const entities = { listing: { listing1: createListing('listing1') } }; const ids = [new UUID('listing2')]; expect(() => denormalisedEntities(entities, 'listing', ids)).toThrow( - 'Entity listing with id listing2 not found', + 'Entity listing with id listing2 not found' ); }); @@ -218,7 +218,7 @@ describe('data utils', () => { const entities = { listing: { listing1 } }; const ids = [listing1.id]; expect(() => denormalisedEntities(entities, 'listing', ids)).toThrow( - 'No entities of type user', + 'No entities of type user' ); }); diff --git a/src/util/googleMaps.js b/src/util/googleMaps.js index 532bf50f..6b539b87 100644 --- a/src/util/googleMaps.js +++ b/src/util/googleMaps.js @@ -15,7 +15,7 @@ const placeBounds = place => { const sw = place.geometry.viewport.getSouthWest(); return new SDKLatLngBounds( new SDKLatLng(ne.lat(), ne.lng()), - new SDKLatLng(sw.lat(), sw.lng()), + new SDKLatLng(sw.lat(), sw.lng()) ); } return null; @@ -39,9 +39,7 @@ export const getPlaceDetails = placeId => service.getDetails({ placeId }, (place, status) => { if (status !== serviceStatus.OK) { reject( - new Error( - `Could not get details for place id "${placeId}", error status was "${status}"`, - ), + new Error(`Could not get details for place id "${placeId}", error status was "${status}"`) ); } else { resolve({ diff --git a/src/util/propTypes.js b/src/util/propTypes.js index 821999fc..7b64b04f 100644 --- a/src/util/propTypes.js +++ b/src/util/propTypes.js @@ -73,7 +73,7 @@ export const image = shape({ height: number.isRequired, name: string.isRequired, url: string.isRequired, - }), + }) ).isRequired, }), }); diff --git a/src/util/routes.js b/src/util/routes.js index 9fd68827..f21b54e1 100644 --- a/src/util/routes.js +++ b/src/util/routes.js @@ -18,7 +18,7 @@ export const flattenRoutes = routes => } return flatRoutes; }, - [], + [] ); const findRouteByName = (nameToFind, flattenedRoutes) => @@ -66,7 +66,7 @@ export const matchPathname = pathname => { } return matches; }, - [], + [] ); }; diff --git a/src/util/routes.test.js b/src/util/routes.test.js index 5bf6985d..50ae433f 100644 --- a/src/util/routes.test.js +++ b/src/util/routes.test.js @@ -15,13 +15,13 @@ describe('withFlattenedRoutes', () => { const shallowTree = renderShallow( - , + ); expect(shallowTree).toMatchSnapshot(); const deepTree = renderDeep( - , + ); expect(deepTree).toMatchSnapshot(); }); diff --git a/src/util/sagaHelpers.js b/src/util/sagaHelpers.js index d9546990..2a1a7129 100644 --- a/src/util/sagaHelpers.js +++ b/src/util/sagaHelpers.js @@ -13,6 +13,6 @@ export const createRequestTypes = base => acc[type] = `${base}.${type}`; return acc; }, - {}, + {} ); /* eslint-enable import/prefer-default-export */ diff --git a/src/util/test-helpers.js b/src/util/test-helpers.js index 615cc840..d920d0c0 100644 --- a/src/util/test-helpers.js +++ b/src/util/test-helpers.js @@ -45,7 +45,7 @@ export const renderDeep = component => { const comp = renderer.create( {component} - , + ); return comp.toJSON(); };