Skip to content

Commit

Permalink
Merge pull request #1413 from sharetribe/clean-unused-vars-and-follow…
Browse files Browse the repository at this point in the history
…-eslint-rules

Remove unintended Lodash usage, unspecified window-scope calls and unused vars
  • Loading branch information
Gnito authored Feb 17, 2021
2 parents 09a1815 + eb33026 commit 91cf1af
Show file tree
Hide file tree
Showing 27 changed files with 20 additions and 225 deletions.
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

0 comments on commit 91cf1af

Please sign in to comment.