Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unintended Lodash usage, unspecified window-scope calls and unused vars #1413

Merged
merged 24 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8143a99
src/util/googleMaps.js: google.maps is on window's scope.
Gnito Feb 15, 2021
cde2870
SearchMap/SearchMapWithGoogleMaps.js: remove unintended Lodash usage
Gnito Feb 15, 2021
889a35b
Map/DynamicGoogleMap.js: clean unused vars
Gnito Feb 15, 2021
7a94c86
ResponsiveImage.js: alt-prop explicitly added to img-element.
Gnito Feb 15, 2021
384b232
src/ducks/FlashNotification.duck.js: remove unused reducer
Gnito Feb 15, 2021
125ec8d
FieldDateInput.test.js, FieldDateRangeInput.test.js: remove unused tests
Gnito Feb 15, 2021
edbbd38
ManageListingCard.test.js: remove unused vars
Gnito Feb 15, 2021
b288a7b
NamedLink.test.js: remove unused vars
Gnito Feb 15, 2021
c218842
SearchResultsPanel.test.js: remove unused vars
Gnito Feb 15, 2021
a1ac7e0
EditListingPage.js: remove unused vars
Gnito Feb 15, 2021
a616abe
EditListingPage.test.js: remove duplicate props
Gnito Feb 15, 2021
bc2a4b8
InboxPage.test.js: remove unused vars
Gnito Feb 15, 2021
2668cbb
LandingPage.test.js: remove unused vars
Gnito Feb 15, 2021
4b9e199
ListingPage.test.js: remove unused vars
Gnito Feb 15, 2021
55b7116
ProfilePage.test.js: remove unused vars
Gnito Feb 15, 2021
6bf77ed
SearchPage.test.js: remove unused vars
Gnito Feb 15, 2021
2817dee
EditListingPhotosForm.test.js: remove duplicate props
Gnito Feb 15, 2021
c3c0b93
src/app.node.test.js: remove unused vars
Gnito Feb 15, 2021
5187fb8
src/util/data.test.js: remove unused vars
Gnito Feb 15, 2021
634d244
src/util/richText.test.js: remove unnecessary escape char
Gnito Feb 15, 2021
9f2a8d1
src/util/routes.test.js: remove unused vars
Gnito Feb 15, 2021
ec45a34
src/util/validators.test.js: remove unused vars
Gnito Feb 15, 2021
2abc817
src/default-location-searches.js: import/no-anonymous-default-export
Gnito Feb 15, 2021
eb33026
Update changelog
Gnito Feb 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2020-XX-XX

- [fix] Remove unintended Lodash usage, unspecified window-scope calls and unused vars
[#1413](https://github.com/sharetribe/ftw-daily/pull/1413)
- [add] Route-based code splitting. This is done against sharetribe-scripts v5.0.0 using Loadable
components. Read more from the pull request.
[#1411](https://github.com/sharetribe/ftw-daily/pull/1411)
Expand Down
8 changes: 3 additions & 5 deletions src/app.node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
*/

import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOMServer from 'react-dom/server';
import { Helmet } from 'react-helmet-async';
import forEach from 'lodash/forEach';
import { ClientApp, ServerApp } from './app';
import { ServerApp } from './app';
import configureStore from './store';

const render = (url, context) => {
Expand Down Expand Up @@ -56,7 +54,7 @@ describe('Application - node environment', () => {
};
forEach(urlRedirects, (redirectPath, url) => {
const context = {};
const { body } = render(url, context);
render(url, context);
expect(context.url).toEqual(redirectPath);
});
});
Expand All @@ -65,7 +63,7 @@ describe('Application - node environment', () => {
const urlRedirects = { '/l': '/', '/u': '/' };
forEach(urlRedirects, (redirectPath, url) => {
const context = {};
const { body } = render(url, context);
render(url, context);
expect(context.url).toEqual(redirectPath);
});
});
Expand Down
28 changes: 0 additions & 28 deletions src/components/FieldDateInput/FieldDateInput.test.js

This file was deleted.

33 changes: 0 additions & 33 deletions src/components/FieldDateRangeInput/FieldDateRangeInput.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/ManageListingCard/ManageListingCard.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { renderShallow } from '../../util/test-helpers';
import { createUser, createOwnListing, fakeIntl } from '../../util/test-data';
import { createOwnListing, fakeIntl } from '../../util/test-data';
import { ManageListingCardComponent } from './ManageListingCard';

const noop = () => null;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Map/DynamicGoogleMap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import { number, object, shape, string } from 'prop-types';
import classNames from 'classnames';
import { circlePolyline } from '../../util/maps';
import config from '../../config';

Expand Down Expand Up @@ -91,7 +90,7 @@ class DynamicGoogleMap extends Component {
}
: {};

const marker = new window.google.maps.Marker({
new window.google.maps.Marker({
position: center,
map: this.map,
title: address,
Expand Down
2 changes: 1 addition & 1 deletion src/components/NamedLink/NamedLink.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { renderShallow, renderDeep } from '../../util/test-helpers';
import { renderDeep } from '../../util/test-helpers';
import NamedLink, { NamedLinkComponent } from './NamedLink';

describe('NamedLinkComponent', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/components/ResponsiveImage/ResponsiveImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ const ResponsiveImage = props => {

const imgProps = {
className: classes,
alt,
srcSet,
...rest,
};

return <img {...imgProps} />;
return <img alt={alt} {...imgProps} />;
};

ResponsiveImage.defaultProps = {
Expand Down
10 changes: 2 additions & 8 deletions src/components/SearchMap/SearchMapWithGoogleMaps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import invariant from 'invariant';
import { arrayOf, func, node, number, oneOfType, shape, string } from 'prop-types';
import { arrayOf, func, number, oneOfType, shape, string } from 'prop-types';
import isEqual from 'lodash/isEqual';
import classNames from 'classnames';
import { types as sdkTypes } from '../../util/sdkLoader';
Expand Down Expand Up @@ -152,7 +152,7 @@ class CustomOverlayView extends Component {
...getOffsetOverride(this.containerElement, this.props),
};
const layoutStyles = getLayoutStyles(mapCanvasProjection, offset, this.props);
_.assign(this.containerElement.style, layoutStyles);
Object.assign(this.containerElement.style, layoutStyles);
}

draw() {
Expand Down Expand Up @@ -515,19 +515,13 @@ class SearchMapWithGoogleMaps extends Component {
const {
id,
className,
onMapLoad,
onMapMoveEnd,
center,
bounds,
zoom,
listings,
activeListingId,
infoCardOpen,
onListingClicked,
mapComponentRefreshToken,
onListingInfoCardClicked,
createURLToListing,
...rest
} = this.props;
return (
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { currencyConfig } from '../../util/test-data';
import { fakeIntl } from '../../util/test-data';
import { renderShallow } from '../../util/test-helpers';
import SearchResultsPanel from './SearchResultsPanel';
Expand Down
1 change: 0 additions & 1 deletion src/containers/EditListingPage/EditListingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
requestImageUpload,
updateImageOrder,
removeListingImage,
loadData,
clearUpdatedTab,
savePayoutDetails,
} from './EditListingPage.duck';
Expand Down
1 change: 0 additions & 1 deletion src/containers/EditListingPage/EditListingPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('EditListingPageComponent', () => {
onUpdateListing={noop}
onImageUpload={noop}
onRemoveListingImage={noop}
onManageDisableScrolling={noop}
onPayoutDetailsFormChange={noop}
onPayoutDetailsSubmit={noop}
onUpdateImageOrder={noop}
Expand Down
2 changes: 0 additions & 2 deletions src/containers/InboxPage/InboxPage.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { RoutesProvider } from '../../components';
import { renderShallow, renderDeep } from '../../util/test-helpers';
import {
fakeIntl,
Expand All @@ -9,7 +8,6 @@ import {
createBooking,
} from '../../util/test-data';
import { InboxPageComponent, InboxItem, txState } from './InboxPage';
import routeConfiguration from '../../routeConfiguration';
import { TRANSITION_CONFIRM_PAYMENT } from '../../util/transaction';
import { LINE_ITEM_NIGHT } from '../../util/types';

Expand Down
2 changes: 0 additions & 2 deletions src/containers/LandingPage/LandingPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react';
import { fakeIntl } from '../../util/test-data';
import { renderShallow } from '../../util/test-helpers';
import { LandingPageComponent } from './LandingPage';
import { RoutesProvider } from '../../components';
import routeConfiguration from '../../routeConfiguration';

const noop = () => null;

Expand Down
4 changes: 0 additions & 4 deletions src/containers/ListingPage/ListingPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import {
import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck';
import { showListingRequest, showListingError, showListing } from './ListingPage.duck';

// routeConfiguration needs to be imported before tests for ListingPageComponent can be made.
// Otherwise, ListingPage itself is not initialized correctly when routeConfiguration is imported
// (loadData call fails).
import routeConfiguration from '../../routeConfiguration';
import { ListingPageComponent } from './ListingPage';
import ActionBarMaybe from './ActionBarMaybe';

Expand Down
2 changes: 0 additions & 2 deletions src/containers/ProfilePage/ProfilePage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { renderShallow } from '../../util/test-helpers';
import { createUser, fakeIntl, fakeViewport } from '../../util/test-data';
import { ProfilePageComponent } from './ProfilePage';

const noop = () => null;

describe('ProfilePage', () => {
it('matches snapshot', () => {
const tree = renderShallow(
Expand Down
11 changes: 0 additions & 11 deletions src/containers/SearchPage/SearchPage.test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import React from 'react';
import { renderShallow } from '../../util/test-helpers';
import { fakeIntl } from '../../util/test-data';
import { types as sdkTypes } from '../../util/sdkLoader';
import { SearchPageComponent } from './SearchPage';
import reducer, {
ADD_FILTER,
LOAD_LISTINGS,
addFilter,
callFetchListings,
initialState,
loadListings,
watchLoadListings,
} from './SearchPage.duck';

const { LatLng } = sdkTypes;
const noop = () => null;

describe('SearchPageComponent', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/default-location-searches.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { LatLng, LatLngBounds } = sdkTypes;
//
// Each item in the array should be an object with a unique `id` (String) and a
// `predictionPlace` (util.types.place) properties.
export default [
const defaultLocations = [
{
id: 'default-helsinki',
predictionPlace: {
Expand Down Expand Up @@ -44,3 +44,4 @@ export default [
},
},
];
export default defaultLocations;
51 changes: 0 additions & 51 deletions src/ducks/FlashNotification.duck.js

This file was deleted.

49 changes: 0 additions & 49 deletions src/ducks/FlashNotification.test.js

This file was deleted.

Loading