mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Don't print trailing comma in fn args since it breaks in Node
This commit is contained in:
parent
5a38f6c280
commit
cfab06d813
24 changed files with 34 additions and 36 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
<ServerApp url={url} context={serverContext} store={store} />,
|
||||
<ServerApp url={url} context={serverContext} store={store} />
|
||||
);
|
||||
const head = Helmet.rewind();
|
||||
return { head, body };
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class AddImagesTest extends Component {
|
|||
};
|
||||
});
|
||||
},
|
||||
1000,
|
||||
1000
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe('BookingInfo', () => {
|
|||
bookingPeriod="Jan 2nd - Jan 4th"
|
||||
bookingDuration="3 days"
|
||||
total="165\u20AC"
|
||||
/>,
|
||||
/>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe('HeroSection', () => {
|
|||
const tree = renderDeep(
|
||||
<HeroSection params={{ displayName: 'most-awesome-shop' }}>
|
||||
test
|
||||
</HeroSection>,
|
||||
</HeroSection>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ LocationPredictionsList.propTypes = {
|
|||
id: string.isRequired,
|
||||
description: string.isRequired,
|
||||
place_id: string.isRequired,
|
||||
}),
|
||||
})
|
||||
).isRequired,
|
||||
highlightedIndex: number,
|
||||
onSelectItem: func.isRequired,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe('NamedLinkComponent', () => {
|
|||
<div>
|
||||
<NamedLinkComponent {...aProps}>link to a</NamedLinkComponent>
|
||||
<NamedLinkComponent {...bProps}>link to b</NamedLinkComponent>
|
||||
</div>,
|
||||
</div>
|
||||
);
|
||||
const aLink = tree.children[0];
|
||||
const bLink = tree.children[1];
|
||||
|
|
@ -46,7 +46,7 @@ describe('NamedLink', () => {
|
|||
const tree = renderDeep(
|
||||
<RoutesProvider flattenedRoutes={routesConf}>
|
||||
<NamedLink name="SomePage" params={{ id }}>to SomePage</NamedLink>
|
||||
</RoutesProvider>,
|
||||
</RoutesProvider>
|
||||
);
|
||||
expect(tree.type).toEqual('a');
|
||||
expect(tree.props.href).toEqual(`/somepage/${id}`);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe('RoutesProvider', () => {
|
|||
Child.contextTypes = { flattenedRoutes: React.PropTypes.array };
|
||||
|
||||
const tree = renderDeep(
|
||||
<RoutesProvider flattenedRoutes={routesConf}><Child /></RoutesProvider>,
|
||||
<RoutesProvider flattenedRoutes={routesConf}><Child /></RoutesProvider>
|
||||
);
|
||||
expect(tree.children).toContain('SomePage');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ const mapDispatchToProps = dispatch => ({
|
|||
});
|
||||
|
||||
const AuthenticationPage = connect(mapStateToProps, mapDispatchToProps)(
|
||||
AuthenticationPageComponent,
|
||||
AuthenticationPageComponent
|
||||
);
|
||||
|
||||
export default AuthenticationPage;
|
||||
|
|
|
|||
|
|
@ -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' });
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe('EditListingForm', () => {
|
|||
onImageUpload={v => v}
|
||||
onSubmit={v => v}
|
||||
onUpdateImageOrder={v => v}
|
||||
/>,
|
||||
/>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe('EditListingPageComponent', () => {
|
|||
onUpdateImageOrder={v => v}
|
||||
page={{ imageOrder: [], images: {} }}
|
||||
type="new"
|
||||
/>,
|
||||
/>
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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)]]);
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ const lookupMap = included =>
|
|||
|
||||
return memo;
|
||||
},
|
||||
{},
|
||||
{}
|
||||
);
|
||||
|
||||
// Format the data as ListingCard component expects it and
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ const { LatLng } = types;
|
|||
describe('SearchPageComponent', () => {
|
||||
it('matches snapshot', () => {
|
||||
const tree = renderShallow(
|
||||
<SearchPageComponent onLoadListings={v => v} dispatch={() => null} />,
|
||||
<SearchPageComponent onLoadListings={v => v} dispatch={() => null} />
|
||||
);
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const image = shape({
|
|||
height: number.isRequired,
|
||||
name: string.isRequired,
|
||||
url: string.isRequired,
|
||||
}),
|
||||
})
|
||||
).isRequired,
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const flattenRoutes = routes =>
|
|||
}
|
||||
return flatRoutes;
|
||||
},
|
||||
[],
|
||||
[]
|
||||
);
|
||||
|
||||
const findRouteByName = (nameToFind, flattenedRoutes) =>
|
||||
|
|
@ -66,7 +66,7 @@ export const matchPathname = pathname => {
|
|||
}
|
||||
return matches;
|
||||
},
|
||||
[],
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ describe('withFlattenedRoutes', () => {
|
|||
const shallowTree = renderShallow(
|
||||
<RoutesProvider flattenedRoutes={routes}>
|
||||
<Comp />
|
||||
</RoutesProvider>,
|
||||
</RoutesProvider>
|
||||
);
|
||||
expect(shallowTree).toMatchSnapshot();
|
||||
const deepTree = renderDeep(
|
||||
<RoutesProvider flattenedRoutes={routes}>
|
||||
<Comp />
|
||||
</RoutesProvider>,
|
||||
</RoutesProvider>
|
||||
);
|
||||
expect(deepTree).toMatchSnapshot();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ export const createRequestTypes = base =>
|
|||
acc[type] = `${base}.${type}`;
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
{}
|
||||
);
|
||||
/* eslint-enable import/prefer-default-export */
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export const renderDeep = component => {
|
|||
const comp = renderer.create(
|
||||
<TestProvider>
|
||||
{component}
|
||||
</TestProvider>,
|
||||
</TestProvider>
|
||||
);
|
||||
return comp.toJSON();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue