Skip to content

Commit

Permalink
fix: Import lodash with default imported
Browse files Browse the repository at this point in the history
The previous version appeared to work fine, but Lodash documentation
prefers default import. And, making this change removes the TypeScript
80003 diagnostic[1].

[1]: https://github.com/microsoft/TypeScript/blob/d210074c8844e21662e40e7db27c45d796be31c4/src/compiler/diagnosticMessages.json#L6713
  • Loading branch information
hyperupcall committed May 19, 2023
1 parent f1f1457 commit 6a16512
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/client/app/components/ChartDataSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import * as React from 'react';
import MultiSelectComponent from './MultiSelectComponent';
import { SelectOption } from '../types/items';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/ChartSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as React from 'react';
import * as _ from 'lodash';
import _ from 'lodash';
import { ChartTypes } from '../types/redux/graph';
import { FormattedMessage } from 'react-intl';
import TooltipMarkerComponent from './TooltipMarkerComponent';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/ExportComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as React from 'react';
import { Button } from 'reactstrap';
import * as _ from 'lodash';
import _ from 'lodash';
import graphExport, { downloadRawCSV } from '../utils/exportData';
import { FormattedMessage } from 'react-intl';
import { metersApi } from '../utils/api'
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/InitializationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as React from 'react';
import * as _ from 'lodash';
import _ from 'lodash';
import NotificationSystem from 'react-notification-system';
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/MapChartSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as React from 'react';
import * as _ from 'lodash';
import _ from 'lodash';
import { useDispatch, useSelector } from 'react-redux';
import { State } from '../types/redux/state';
import { SelectOption } from '../types/items';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/RouteComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Route, Router, Switch, Redirect } from 'react-router-dom';
import { IntlProvider } from 'react-intl';
import localeData from '../translations/data';
import { browserHistory } from '../utils/history';
import * as _ from 'lodash';
import _ from 'lodash';
import moment from 'moment';
import HomeComponent from './HomeComponent';
import LoginContainer from '../containers/LoginContainer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import TooltipHelpContainer from '../../containers/TooltipHelpContainer';
import { addConversion } from '../../actions/conversions';
import { UnitDataById } from 'types/redux/units';
import { ConversionData } from 'types/redux/conversions';
import * as _ from 'lodash';
import _ from 'lodash';
import {formInputStyle, tableStyle, requiredStyle, tooltipBaseStyle} from '../../styles/modalStyle';

interface CreateConversionModalComponentProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import * as _ from 'lodash';
import _ from 'lodash';
import * as React from 'react';
import { useState, useEffect } from 'react';
import MultiSelectComponent from '../MultiSelectComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import * as React from 'react';
// Realize that * is already imported from react
import { useState, useEffect } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/groups/GroupsDetailComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { potentialGraphicUnits } from '../../utils/input';
import GroupViewComponent from './GroupViewComponent';
import CreateGroupModalComponent from './CreateGroupModalComponent';
import { GroupDefinition } from 'types/redux/groups';
import * as _ from 'lodash';
import _ from 'lodash';

export default function GroupsDetailComponent() {
const dispatch = useDispatch();
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/meters/MetersDetailComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import CreateMeterModalComponent from './CreateMeterModalComponent';
import { MeterData } from 'types/redux/meters';
import '../../styles/card-page.css';
import { UnitData, UnitType } from '../../types/redux/units';
import * as _ from 'lodash';
import _ from 'lodash';
import { potentialGraphicUnits, noUnitTranslated } from '../../utils/input';

export default function MetersDetailComponent() {
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/containers/BarChartContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import moment from 'moment';
import { connect } from 'react-redux';
import getGraphColor from '../utils/getGraphColor';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/containers/LineChartContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import moment from 'moment';
import { connect } from 'react-redux';
import getGraphColor from '../utils/getGraphColor';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/containers/MapChartContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
calculateScaleFromEndpoints, itemDisplayableOnMap, Dimensions,
CartesianPoint, normalizeImageDimensions, itemMapInfoOk, gpsToUserGrid
} from '../utils/calibration';
import * as _ from 'lodash';
import _ from 'lodash';
import getGraphColor from '../utils/getGraphColor';
import Locales from '../types/locales';
import { DataType } from '../types/Datasources';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/containers/MeterDropdownContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import { connect } from 'react-redux';
import { updateSelectedMeter } from '../actions/admin';
import MeterDropdownComponent from '../components/MeterDropDownComponent';
Expand Down
4 changes: 2 additions & 2 deletions src/client/app/containers/admin/UsersDetailContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as React from 'react';
import * as _ from 'lodash';
import _ from 'lodash';
import { User, UserRole } from '../../types/items';
import UserDetailComponent from '../../components/admin/UsersDetailComponent';
import HeaderContainer from '../HeaderContainer';
Expand Down Expand Up @@ -94,4 +94,4 @@ export default class UsersDetailContainer extends React.Component<UsersDisplayCo
</div>
)
}
}
}
2 changes: 1 addition & 1 deletion src/client/app/reducers/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as _ from 'lodash';
import _ from 'lodash';
import { GroupsAction, GroupsState, DisplayMode } from '../types/redux/groups';
import { ActionType } from '../types/redux/actions';

Expand Down
2 changes: 1 addition & 1 deletion src/client/app/reducers/maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import {MapMetadata, MapsAction, MapState} from '../types/redux/map';
import {ActionType} from '../types/redux/actions';
import * as _ from 'lodash';
import _ from 'lodash';
import {CalibratedPoint} from '../utils/calibration';

const defaultState: MapState = {
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/reducers/meters.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import * as _ from 'lodash';
import _ from 'lodash';
import { MetersAction, MetersState } from '../types/redux/meters';
import { ActionType } from '../types/redux/actions';
import { durationFormat } from '../utils/durationFormat';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/reducers/units.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import * as _ from 'lodash';
import _ from 'lodash';
import { UnitsAction, UnitsState } from '../types/redux/units';
import { ActionType } from '../types/redux/actions';

Expand Down
2 changes: 1 addition & 1 deletion src/client/app/utils/api/ReadingsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import * as _ from 'lodash';
import _ from 'lodash';
import ApiBackend from './ApiBackend';
import {TimeInterval} from '../../../../common/TimeInterval';
import {BarReadings, LineReading, LineReadings} from '../../types/readings';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/utils/determineCompatibleUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { store } from '../store';
import * as _ from 'lodash';
import _ from 'lodash';
import { MeterData } from '../types/redux/meters';
import { ConversionArray } from '../types/conversionArray';
import { UnitData, UnitType } from '../types/redux/units';
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/utils/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { GPSPoint } from './calibration';
import { UnitData, DisplayableType, UnitRepresentType, UnitType, UnitDataById } from '../types/redux/units';
import translate from './translate';
import * as _ from 'lodash';
import _ from 'lodash';

// Notifies user of msg.
// TODO isValidGPSInput uses alert so continue that. Maybe all should be changed but this impacts other parts of the code.
Expand Down

0 comments on commit 6a16512

Please sign in to comment.