From 727075c4a5da51671e301461508d42621389dba2 Mon Sep 17 00:00:00 2001 From: Gabriel Bruno Date: Thu, 19 Dec 2024 13:30:52 -0500 Subject: [PATCH] The lint warnings from transition-frontend (other than "unexpected any") have been removed. 112 warnings got removed (223 to 111). --- packages/transition-frontend/jest.config.js | 2 + .../src/app-transition.tsx | 3 +- .../dashboard/TransitionBottomPanel.tsx | 2 +- .../dashboard/TransitionDashboard.tsx | 2 +- .../dashboard/TransitionFullSizePanel.tsx | 4 +- .../dashboard/TransitionToolbar.tsx | 2 +- .../AccessibilityMapBatchForm.tsx | 9 +--- .../accessibilityMap/AccessibilityMapForm.tsx | 4 +- .../AccessibilityMapStatsComponent.tsx | 1 - .../forms/agency/TransitAgencyList.tsx | 1 - .../forms/agency/TransitAgencyPanel.tsx | 8 +++- .../batchCalculation/BatchCalculationList.tsx | 3 +- .../BatchCalculationPanel.tsx | 11 +++-- .../components/forms/gtfs/GtfsExportForm.tsx | 4 +- .../gtfs/GtfsImportAgenciesComponent.tsx | 1 - .../components/forms/gtfs/GtfsImportForm.tsx | 6 +-- .../components/forms/line/TransitLineEdit.tsx | 1 - .../forms/node/TransitNodeCollectionEdit.tsx | 2 +- .../components/forms/node/TransitNodeEdit.tsx | 1 - .../forms/node/TransitNodePanel.tsx | 1 - .../forms/node/TransitNodeStatistics.tsx | 27 ++++++----- .../components/forms/path/TransitPathEdit.tsx | 9 ++-- .../forms/path/TransitPathStatistics.tsx | 1 - .../forms/preferences/PreferencesEdit.tsx | 3 -- .../PreferencesResetToDefaultButton.tsx | 2 +- .../sections/PreferencesSectionFeatures.tsx | 2 - .../PreferencesSectionTransitLineMode.tsx | 2 +- .../PreferencesSectionTransitPaths.tsx | 5 +- .../PreferencesSectionTransitScenarios.tsx | 1 - .../forms/scenario/TransitScenarioEdit.tsx | 2 +- .../forms/scenario/TransitScenarioList.tsx | 1 - .../forms/scenario/TransitScenarioPanel.tsx | 1 - .../forms/service/TransitServiceList.tsx | 1 - .../forms/service/TransitServicePanel.tsx | 8 +--- .../forms/simulation/SimulationList.tsx | 5 +- .../forms/simulation/SimulationPanel.tsx | 10 ++-- .../widgets/SimulationRunButton.tsx | 2 +- .../simulation/widgets/SimulationRunList.tsx | 1 - .../transitRouting/RoutingResultComponent.tsx | 1 - .../RoutingResultsComponent.tsx | 5 +- .../transitRouting/TransitRoutingForm.tsx | 2 +- .../TransitRoutingResultComponent.tsx | 1 - .../src/components/map/TransitionMainMap.tsx | 4 +- .../parts/CollectionSaveToCacheButtons.tsx | 1 - .../src/components/parts/FileImportForm.tsx | 6 +-- .../executableJob/ExecutableJobComponent.tsx | 46 +++++++++---------- .../executableJob/ExpandableFileWidget.tsx | 4 +- .../parts/executableJob/ExpandableText.tsx | 4 +- .../src/components/path/TransitPathHelp.tsx | 1 - .../BatchAccessibilityMapCalculator.ts | 3 +- .../definitions/DefinitionsService.ts | 1 - .../map/events/NodeSectionMapEvents.ts | 6 +-- .../map/events/PathSectionMapEvents.ts | 4 +- .../src/services/routing/RoutingUtils.ts | 1 - .../transitService/TransitServiceUtils.ts | 2 +- .../transition-frontend/src/types/global.d.ts | 1 + 56 files changed, 100 insertions(+), 144 deletions(-) diff --git a/packages/transition-frontend/jest.config.js b/packages/transition-frontend/jest.config.js index 4f34cd4a..881b0d90 100644 --- a/packages/transition-frontend/jest.config.js +++ b/packages/transition-frontend/jest.config.js @@ -5,6 +5,8 @@ * License text available at https://opensource.org/licenses/MIT */ /* eslint-disable n/no-unpublished-require */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ const baseConfig = require('../../tests/jest.config.base'); module.exports = { diff --git a/packages/transition-frontend/src/app-transition.tsx b/packages/transition-frontend/src/app-transition.tsx index 60d17d1e..96742a54 100644 --- a/packages/transition-frontend/src/app-transition.tsx +++ b/packages/transition-frontend/src/app-transition.tsx @@ -8,13 +8,12 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import { I18nextProvider } from 'react-i18next'; -import { BrowserRouter, Router } from 'react-router'; +import { BrowserRouter } from 'react-router'; import i18n from 'chaire-lib-frontend/lib/config/i18n.config'; import TransitionRouter from './components/routers/TransitionRouter'; import MainMap from './components/map/TransitionMainMap'; import configureStore from 'chaire-lib-frontend/lib/store/configureStore'; -import { login, logout } from 'chaire-lib-frontend/lib/actions/Auth'; import { LoadingPage } from 'chaire-lib-frontend/lib/components/pages'; import config from 'chaire-lib-frontend/lib/config/project.config'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; diff --git a/packages/transition-frontend/src/components/dashboard/TransitionBottomPanel.tsx b/packages/transition-frontend/src/components/dashboard/TransitionBottomPanel.tsx index 76940538..2e5579af 100644 --- a/packages/transition-frontend/src/components/dashboard/TransitionBottomPanel.tsx +++ b/packages/transition-frontend/src/components/dashboard/TransitionBottomPanel.tsx @@ -11,7 +11,7 @@ import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import Path from 'transition-common/lib/services/path/Path'; import { LayoutSectionProps } from 'chaire-lib-frontend/lib/services/dashboard/DashboardContribution'; -const BottomPanel: React.FunctionComponent = (props: LayoutSectionProps) => { +const BottomPanel: React.FunctionComponent = (_props: LayoutSectionProps) => { const [path, setPath] = React.useState<{ path: Path | undefined }>({ path: serviceLocator.selectedObjectsManager.get('path') }); diff --git a/packages/transition-frontend/src/components/dashboard/TransitionDashboard.tsx b/packages/transition-frontend/src/components/dashboard/TransitionDashboard.tsx index 5ae6e5c0..199d66b5 100644 --- a/packages/transition-frontend/src/components/dashboard/TransitionDashboard.tsx +++ b/packages/transition-frontend/src/components/dashboard/TransitionDashboard.tsx @@ -218,7 +218,7 @@ class Dashboard extends React.Component { } }; - onPreferencesChange = (updates: any) => { + onPreferencesChange = (_updates: any) => { const infoPanelPosition = Preferences.get('infoPanelPosition'); this.setState({ infoPanelPosition }); }; diff --git a/packages/transition-frontend/src/components/dashboard/TransitionFullSizePanel.tsx b/packages/transition-frontend/src/components/dashboard/TransitionFullSizePanel.tsx index e4c39764..0e3bab6e 100644 --- a/packages/transition-frontend/src/components/dashboard/TransitionFullSizePanel.tsx +++ b/packages/transition-frontend/src/components/dashboard/TransitionFullSizePanel.tsx @@ -17,7 +17,7 @@ interface TransitionFSPanelState { selectedSchedule?: Schedule; } -const FullSizePanel: React.FunctionComponent = (props: LayoutSectionProps) => { +const FullSizePanel: React.FunctionComponent = (_props: LayoutSectionProps) => { const [state, setState] = React.useState({ selectedLine: serviceLocator.selectedObjectsManager.get('line'), selectedSchedule: serviceLocator.selectedObjectsManager.get('schedule') @@ -25,11 +25,13 @@ const FullSizePanel: React.FunctionComponent = (props: Layou React.useEffect(() => { const onSelectedLineUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedLine, ...rest }) => ({ ...rest, selectedLine: serviceLocator.selectedObjectsManager.get('line') })); const onSelectedScheduleUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedSchedule, ...rest }) => ({ ...rest, selectedSchedule: serviceLocator.selectedObjectsManager.get('schedule') diff --git a/packages/transition-frontend/src/components/dashboard/TransitionToolbar.tsx b/packages/transition-frontend/src/components/dashboard/TransitionToolbar.tsx index 1a64ab0d..06b29b39 100644 --- a/packages/transition-frontend/src/components/dashboard/TransitionToolbar.tsx +++ b/packages/transition-frontend/src/components/dashboard/TransitionToolbar.tsx @@ -78,7 +78,7 @@ class Toolbar extends React.Component { layersVisibility[layerName] = serviceLocator.layerManager.layerIsVisible(layerName); }); - this.setState((oldState) => { + this.setState((_oldState) => { return { layersVisibility }; diff --git a/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapBatchForm.tsx b/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapBatchForm.tsx index 889d3109..18dde6cd 100644 --- a/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapBatchForm.tsx +++ b/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapBatchForm.tsx @@ -10,11 +10,8 @@ import { withTranslation, WithTranslation } from 'react-i18next'; import Loader from 'react-spinners/BeatLoader'; import { faUpload } from '@fortawesome/free-solid-svg-icons/faUpload'; -import _get from 'lodash/get'; import _cloneDeep from 'lodash/cloneDeep'; import _toString from 'lodash/toString'; -import { parseCsvFile } from 'chaire-lib-common/lib/utils/files/CsvFile'; -import slugify from 'slugify'; import InputString from 'chaire-lib-frontend/lib/components/input/InputString'; import InputWrapper from 'chaire-lib-frontend/lib/components/input/InputWrapper'; @@ -132,7 +129,7 @@ class AccessibilityMapBatchForm extends ChangeEventsForm< // ** File upload // upload csv file to server: - const uploadIds = this.props.fileUploader.upload(this.props.fileImportRef.current, { + this.props.fileUploader.upload(this.props.fileImportRef.current, { uploadTo: 'imports', data: { objects: 'csv', @@ -142,7 +139,7 @@ class AccessibilityMapBatchForm extends ChangeEventsForm< this.state.object.updateRoutingPrefs(); - this.setState((oldState) => { + this.setState((_oldState) => { return { csvUploadedToServer: true }; @@ -203,8 +200,6 @@ class AccessibilityMapBatchForm extends ChangeEventsForm< !_isBlank(accessMapRouting.attributes.timeFormat) && !_isBlank(accessMapRouting.attributes.timeAttributeDepartureOrArrival); - const slugifiedCalculationName = slugify(accessMapRouting.attributes.calculationName || ''); - const errors = this.state.errors; const warnings = this.state.warnings; diff --git a/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapForm.tsx b/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapForm.tsx index 400dc3c3..8001e995 100644 --- a/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapForm.tsx +++ b/packages/transition-frontend/src/components/forms/accessibilityMap/AccessibilityMapForm.tsx @@ -34,7 +34,7 @@ import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import DownloadsUtils from 'chaire-lib-frontend/lib/services/DownloadsService'; import { ChangeEventsForm, ChangeEventsState } from 'chaire-lib-frontend/lib/components/forms/ChangeEventsForm'; import LoadingPage from 'chaire-lib-frontend/lib/components/pages/LoadingPage'; -import { _toInteger, _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; +import { _toInteger } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { secondsSinceMidnightToTimeStr, secondsToMinutes, @@ -135,7 +135,7 @@ class AccessibilityMapForm extends ChangeEventsForm = (props: AgencyPan React.useEffect(() => { const onAgencyCollectionUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ agencyCollection, ...rest }) => ({ ...rest, agencyCollection: serviceLocator.collectionManager.get('agencies') })); const onSelectedAgencyUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedAgency, ...rest }) => ({ ...rest, selectedAgency: serviceLocator.selectedObjectsManager.get('agency') })); const onLineCollectionUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ lineCollection, ...rest }) => ({ ...rest, lineCollection: serviceLocator.collectionManager.get('lines') })); const onSelectedLineUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedLine, ...rest }) => ({ ...rest, selectedLine: serviceLocator.selectedObjectsManager.get('line') })); const onPathCollectionUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ pathCollection, ...rest }) => ({ ...rest, pathCollection: serviceLocator.collectionManager.get('paths') })); const onSelectedPathUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedPath, ...rest }) => ({ ...rest, selectedPath: serviceLocator.selectedObjectsManager.get('path') })); const onSelectedScheduleUpdate = () => + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ setState(({ selectedSchedule, ...rest }) => ({ ...rest, selectedSchedule: serviceLocator.selectedObjectsManager.get('schedule') diff --git a/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationList.tsx b/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationList.tsx index 14b612af..ec7ec9b1 100644 --- a/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationList.tsx +++ b/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationList.tsx @@ -6,7 +6,6 @@ */ import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _get from 'lodash/get'; import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'; import { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; @@ -56,7 +55,7 @@ const BatchCalculationList: React.FunctionComponent = icon={faPlus} iconClass="_icon" label={props.t('transit:batchCalculation:New')} - onClick={(e) => props.onNewAnalysis()} + onClick={() => props.onNewAnalysis()} /> {errors.length > 0 && } diff --git a/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationPanel.tsx b/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationPanel.tsx index 9bd5854b..571ba0e9 100644 --- a/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationPanel.tsx +++ b/packages/transition-frontend/src/components/forms/batchCalculation/BatchCalculationPanel.tsx @@ -8,7 +8,6 @@ import React from 'react'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import BatchCalculationList from './BatchCalculationList'; -import ScenarioCollection from 'transition-common/lib/services/scenario/ScenarioCollection'; import BatchCalculationForm from './BatchCalculationForm'; import { BatchCalculationParameters } from 'transition-common/lib/services/batchCalculation/types'; import { TransitBatchRoutingDemandAttributes } from 'transition-common/lib/services/transitDemand/types'; @@ -18,9 +17,11 @@ export interface CalculationPanelPanelProps { } const CalculationPanel: React.FunctionComponent = (props: CalculationPanelPanelProps) => { - const [scenarioCollection, setScenarioCollection] = React.useState( - serviceLocator.collectionManager.get('scenarios') - ); + // TODO: scenarioCollection is never read. Implement a use for it, or remove the hook and onScenarioCollectionUpdate() entirely. + // const [scenarioCollection, setScenarioCollection] = React.useState( + // serviceLocator.collectionManager.get('scenarios') + // ); + const [isNewAnalysis, setIsNewAnalysis] = React.useState(false); const [initialValues, setInitialValues] = React.useState< | { @@ -32,7 +33,7 @@ const CalculationPanel: React.FunctionComponent = (p >(undefined); const onScenarioCollectionUpdate = () => { - setScenarioCollection(serviceLocator.collectionManager.get('scenarios')); + //setScenarioCollection(serviceLocator.collectionManager.get('scenarios')); }; const onNewAnalysis = (parameters?: { diff --git a/packages/transition-frontend/src/components/forms/gtfs/GtfsExportForm.tsx b/packages/transition-frontend/src/components/forms/gtfs/GtfsExportForm.tsx index 2ba2b54b..6d1abf15 100644 --- a/packages/transition-frontend/src/components/forms/gtfs/GtfsExportForm.tsx +++ b/packages/transition-frontend/src/components/forms/gtfs/GtfsExportForm.tsx @@ -4,10 +4,9 @@ * This file is licensed under the MIT License. * License text available at https://opensource.org/licenses/MIT */ -import React, { JSX } from 'react'; +import React from 'react'; import { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload'; import { faTasks } from '@fortawesome/free-solid-svg-icons/faTasks'; -import _get from 'lodash/get'; import { withTranslation, WithTranslation } from 'react-i18next'; import slugify from 'slugify'; import { v4 as uuidV4 } from 'uuid'; @@ -19,7 +18,6 @@ import FormErrors from 'chaire-lib-frontend/lib/components/pageParts/FormErrors' import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import GtfsExporter from 'transition-common/lib/services/gtfs/GtfsExporter'; import { ChangeEventsForm, ChangeEventsState } from 'chaire-lib-frontend/lib/components/forms/ChangeEventsForm'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { GtfsConstants, GtfsExportStatus } from 'transition-common/lib/api/gtfs'; class GtfsExportForm extends ChangeEventsForm> { diff --git a/packages/transition-frontend/src/components/forms/gtfs/GtfsImportAgenciesComponent.tsx b/packages/transition-frontend/src/components/forms/gtfs/GtfsImportAgenciesComponent.tsx index 566b1991..74142816 100644 --- a/packages/transition-frontend/src/components/forms/gtfs/GtfsImportAgenciesComponent.tsx +++ b/packages/transition-frontend/src/components/forms/gtfs/GtfsImportAgenciesComponent.tsx @@ -5,7 +5,6 @@ * License text available at https://opensource.org/licenses/MIT */ import React from 'react'; -import { withTranslation, WithTranslation } from 'react-i18next'; import { AgencyImportData } from 'transition-common/lib/services/gtfs/GtfsImportTypes'; import { InputCheckbox } from 'chaire-lib-frontend/lib/components/input/InputCheckbox'; diff --git a/packages/transition-frontend/src/components/forms/gtfs/GtfsImportForm.tsx b/packages/transition-frontend/src/components/forms/gtfs/GtfsImportForm.tsx index a5990b57..e4fcc158 100644 --- a/packages/transition-frontend/src/components/forms/gtfs/GtfsImportForm.tsx +++ b/packages/transition-frontend/src/components/forms/gtfs/GtfsImportForm.tsx @@ -7,7 +7,6 @@ import React from 'react'; import { faUpload } from '@fortawesome/free-solid-svg-icons/faUpload'; import { faFileImport } from '@fortawesome/free-solid-svg-icons/faFileImport'; -import _get from 'lodash/get'; import Loader from 'react-spinners/BeatLoader'; import SocketIOFileClient from 'socket.io-file-client'; import { withTranslation, WithTranslation } from 'react-i18next'; @@ -248,8 +247,9 @@ class GtfsImportForm extends React.Component { } }; - importGtfsData = (e) => { + importGtfsData = (_e) => { const validator = this.state.validator; + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ const { periodsGroupShortname, ...rest } = this.state.availableImportData; // import if (this.state.operationInProgress) { @@ -336,7 +336,7 @@ class GtfsImportForm extends React.Component { id={`formFieldTransitGtfsImporterFile${validatorId}`} accept=".zip" inputRef={this._fileImportRef} - onChange={(e) => { + onChange={() => { this.setState({ validator: new GtfsValidator({}), uploadError: false diff --git a/packages/transition-frontend/src/components/forms/line/TransitLineEdit.tsx b/packages/transition-frontend/src/components/forms/line/TransitLineEdit.tsx index 6751463d..43a0a7a8 100644 --- a/packages/transition-frontend/src/components/forms/line/TransitLineEdit.tsx +++ b/packages/transition-frontend/src/components/forms/line/TransitLineEdit.tsx @@ -8,7 +8,6 @@ import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; import Collapsible from 'react-collapsible'; import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'; -import _get from 'lodash/get'; import InputString from 'chaire-lib-frontend/lib/components/input/InputString'; import InputText from 'chaire-lib-frontend/lib/components/input/InputText'; diff --git a/packages/transition-frontend/src/components/forms/node/TransitNodeCollectionEdit.tsx b/packages/transition-frontend/src/components/forms/node/TransitNodeCollectionEdit.tsx index 6629665c..c679dc8a 100644 --- a/packages/transition-frontend/src/components/forms/node/TransitNodeCollectionEdit.tsx +++ b/packages/transition-frontend/src/components/forms/node/TransitNodeCollectionEdit.tsx @@ -20,7 +20,7 @@ import InputColor from 'chaire-lib-frontend/lib/components/input/InputColor'; import InputWrapper from 'chaire-lib-frontend/lib/components/input/InputWrapper'; import { InputCheckboxBoolean } from 'chaire-lib-frontend/lib/components/input/InputCheckbox'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import { _isBlank, _toInteger } from 'chaire-lib-common/lib/utils/LodashExtensions'; +import { _toInteger } from 'chaire-lib-common/lib/utils/LodashExtensions'; import FormErrors from 'chaire-lib-frontend/lib/components/pageParts/FormErrors'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import ConfirmModal from 'chaire-lib-frontend/lib/components/modal/ConfirmModal'; diff --git a/packages/transition-frontend/src/components/forms/node/TransitNodeEdit.tsx b/packages/transition-frontend/src/components/forms/node/TransitNodeEdit.tsx index 72f4afbe..61cf2ab0 100644 --- a/packages/transition-frontend/src/components/forms/node/TransitNodeEdit.tsx +++ b/packages/transition-frontend/src/components/forms/node/TransitNodeEdit.tsx @@ -10,7 +10,6 @@ import { withTranslation, WithTranslation } from 'react-i18next'; import _cloneDeep from 'lodash/cloneDeep'; import _toString from 'lodash/toString'; import { featureCollection as turfFeatureCollection } from '@turf/turf'; -import _uniq from 'lodash/uniq'; import InputString from 'chaire-lib-frontend/lib/components/input/InputString'; import InputText from 'chaire-lib-frontend/lib/components/input/InputText'; diff --git a/packages/transition-frontend/src/components/forms/node/TransitNodePanel.tsx b/packages/transition-frontend/src/components/forms/node/TransitNodePanel.tsx index 7048d003..6bfc03a6 100644 --- a/packages/transition-frontend/src/components/forms/node/TransitNodePanel.tsx +++ b/packages/transition-frontend/src/components/forms/node/TransitNodePanel.tsx @@ -11,7 +11,6 @@ import { faFileUpload } from '@fortawesome/free-solid-svg-icons/faFileUpload'; import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import CollectionDownloadButtons from 'chaire-lib-frontend/lib/components/pageParts/CollectionDownloadButtons'; import ConfirmModal from 'chaire-lib-frontend/lib/components/modal/ConfirmModal'; diff --git a/packages/transition-frontend/src/components/forms/node/TransitNodeStatistics.tsx b/packages/transition-frontend/src/components/forms/node/TransitNodeStatistics.tsx index 640fa49f..c99a83ae 100644 --- a/packages/transition-frontend/src/components/forms/node/TransitNodeStatistics.tsx +++ b/packages/transition-frontend/src/components/forms/node/TransitNodeStatistics.tsx @@ -8,26 +8,25 @@ import React from 'react'; import _uniq from 'lodash/uniq'; import { withTranslation, WithTranslation } from 'react-i18next'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; -import { roundToDecimals } from 'chaire-lib-common/lib/utils/MathUtils'; import Node from 'transition-common/lib/services/nodes/Node'; import Line from 'transition-common/lib/services/line/Line'; import Path from 'transition-common/lib/services/path/Path'; import PathCollection from 'transition-common/lib/services/path/PathCollection'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; -const SimpleRow: React.FunctionComponent<{ header: string; value?: string | number; isHeader?: boolean }> = ({ - header, - value = '', - isHeader = false -}) => { - return ( - - {header} - {value} - - ); -}; +// This component is currently unused. +// const SimpleRow: React.FunctionComponent<{ header: string; value?: string | number; isHeader?: boolean }> = ({ +// header, +// value = '', +// isHeader = false +// }) => { +// return ( +// +// {header} +// {value} +// +// ); +// }; const SingleColumn: React.FunctionComponent<{ header: string; values?: string[] | number[]; isHeader?: boolean }> = ({ header, diff --git a/packages/transition-frontend/src/components/forms/path/TransitPathEdit.tsx b/packages/transition-frontend/src/components/forms/path/TransitPathEdit.tsx index b2afc52b..c5c8e502 100644 --- a/packages/transition-frontend/src/components/forms/path/TransitPathEdit.tsx +++ b/packages/transition-frontend/src/components/forms/path/TransitPathEdit.tsx @@ -32,7 +32,6 @@ import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import PathStatistics from './TransitPathStatistics'; import ConfirmModal from 'chaire-lib-frontend/lib/components/modal/ConfirmModal'; import lineModesConfig from 'transition-common/lib/config/lineModes'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { SaveableObjectForm, SaveableObjectState } from 'chaire-lib-frontend/lib/components/forms/SaveableObjectForm'; import { parseIntOrNull, parseFloatOrNull } from 'chaire-lib-common/lib/utils/MathUtils'; import Path, { pathDirectionArray } from 'transition-common/lib/services/path/Path'; @@ -235,7 +234,7 @@ class TransitPathEdit extends SaveableObjectForm { + this.setState((_oldState) => { return { waypointDraggingAfterNodeIndex: waypointGeojson.properties.afterNodeIndex, waypointDraggingIndex: waypointGeojson.properties.waypointIndex @@ -294,7 +293,7 @@ class TransitPathEdit extends SaveableObjectForm { + .then((_response) => { this.props.path.validate(); serviceLocator.selectedObjectsManager.update('path', this.props.path); serviceLocator.eventManager.emit('selected.updateLayers.path'); @@ -737,7 +736,7 @@ class TransitPathEdit extends SaveableObjectForm { + .then((_response) => { serviceLocator.selectedObjectsManager.update('path', path); this.updateLayers(); serviceLocator.eventManager.emit('progress', { @@ -774,7 +773,7 @@ class TransitPathEdit extends SaveableObjectForm { + path.save(serviceLocator.socketEventManager).then((_response) => { serviceLocator.selectedObjectsManager.deselect('path'); line.refreshPaths(); serviceLocator.eventManager.emit('progress', { diff --git a/packages/transition-frontend/src/components/forms/path/TransitPathStatistics.tsx b/packages/transition-frontend/src/components/forms/path/TransitPathStatistics.tsx index 48bf219e..ffdafba0 100644 --- a/packages/transition-frontend/src/components/forms/path/TransitPathStatistics.tsx +++ b/packages/transition-frontend/src/components/forms/path/TransitPathStatistics.tsx @@ -9,7 +9,6 @@ import { withTranslation, WithTranslation } from 'react-i18next'; import MathJax from 'react-mathjax'; import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; -import { roundToDecimals } from 'chaire-lib-common/lib/utils/MathUtils'; import SpeedUnitFormatter from 'chaire-lib-frontend/lib/components/pageParts/SpeedUnitFormatter'; import DistanceUnitFormatter from 'chaire-lib-frontend/lib/components/pageParts/DistanceUnitFormatter'; import DurationUnitFormatter from 'chaire-lib-frontend/lib/components/pageParts/DurationUnitFormatter'; diff --git a/packages/transition-frontend/src/components/forms/preferences/PreferencesEdit.tsx b/packages/transition-frontend/src/components/forms/preferences/PreferencesEdit.tsx index c70b0166..ca4920ad 100644 --- a/packages/transition-frontend/src/components/forms/preferences/PreferencesEdit.tsx +++ b/packages/transition-frontend/src/components/forms/preferences/PreferencesEdit.tsx @@ -6,13 +6,11 @@ */ import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _cloneDeep from 'lodash/cloneDeep'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import { PreferencesClass, default as preferences } from 'chaire-lib-common/lib/config/Preferences'; import { default as FormErrors } from 'chaire-lib-frontend/lib/components/pageParts/FormErrors'; import { SaveableObjectForm, SaveableObjectState } from 'chaire-lib-frontend/lib/components/forms/SaveableObjectForm'; -import { _toInteger, _toBool, _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import SelectedObjectButtons from 'chaire-lib-frontend/lib/components/pageParts/SelectedObjectButtons'; import ConfirmModal from 'chaire-lib-frontend/lib/components/modal/ConfirmModal'; import PreferencesSectionGeneral from './sections/PreferencesSectionGeneral'; @@ -84,7 +82,6 @@ class PreferencesPanel extends SaveableObjectForm props.resetPrefToDefault(props.path)} + onClick={() => props.resetPrefToDefault(props.path)} title={props.t('main:preferences:ResetToDefault')} /> ); diff --git a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionFeatures.tsx b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionFeatures.tsx index c295b32f..998c98e3 100644 --- a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionFeatures.tsx +++ b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionFeatures.tsx @@ -15,8 +15,6 @@ import PreferencesSectionProps from '../PreferencesSectionProps'; const PreferencesSectionFeatures: React.FunctionComponent = ( props: PreferencesSectionProps & WithTranslation ) => { - const prefs = props.preferences.getAttributes(); - return (
diff --git a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitLineMode.tsx b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitLineMode.tsx index e2f3d48c..3b31d43b 100644 --- a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitLineMode.tsx +++ b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitLineMode.tsx @@ -13,7 +13,7 @@ import InputWrapper from 'chaire-lib-frontend/lib/components/input/InputWrapper' import InputSelect from 'chaire-lib-frontend/lib/components/input/InputSelect'; import InputStringFormatted from 'chaire-lib-frontend/lib/components/input/InputStringFormatted'; import PreferencesSectionLineModeProps from '../PreferencesSectionLineModeProps'; -import { parseIntOrNull, parseFloatOrNull } from 'chaire-lib-common/lib/utils/MathUtils'; +import { parseFloatOrNull } from 'chaire-lib-common/lib/utils/MathUtils'; const PreferencesSectionTransitLineMode: React.FunctionComponent = ( props: PreferencesSectionLineModeProps & WithTranslation diff --git a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitPaths.tsx b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitPaths.tsx index 88ba15bc..678df782 100644 --- a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitPaths.tsx +++ b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitPaths.tsx @@ -8,11 +8,10 @@ import React from 'react'; import PreferencesSectionProps from '../PreferencesSectionProps'; +// TODO: Implement this component or delete it. const PreferencesSectionTransitPaths: React.FunctionComponent = ( - props: PreferencesSectionProps + _props: PreferencesSectionProps ) => { - const prefs = props.preferences.getAttributes(); - return null; }; diff --git a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitScenarios.tsx b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitScenarios.tsx index 9154cbb6..115e78cb 100644 --- a/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitScenarios.tsx +++ b/packages/transition-frontend/src/components/forms/preferences/sections/PreferencesSectionTransitScenarios.tsx @@ -7,7 +7,6 @@ import React from 'react'; import Collapsible from 'react-collapsible'; import { WithTranslation, withTranslation } from 'react-i18next'; -import _toString from 'lodash/toString'; import PreferencesResetToDefaultButton from '../PreferencesResetToDefaultButton'; import InputWrapper from 'chaire-lib-frontend/lib/components/input/InputWrapper'; import InputColor from 'chaire-lib-frontend/lib/components/input/InputColor'; diff --git a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioEdit.tsx b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioEdit.tsx index ba7b010c..edc2da97 100644 --- a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioEdit.tsx +++ b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioEdit.tsx @@ -73,7 +73,7 @@ class TransitScenarioEdit extends SaveableObjectForm( 'map.updateLayer', { diff --git a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioList.tsx b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioList.tsx index 32708de9..f1f41aed 100644 --- a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioList.tsx +++ b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioList.tsx @@ -6,7 +6,6 @@ */ import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _get from 'lodash/get'; import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'; import TransitScenario from 'transition-common/lib/services/scenario/Scenario'; diff --git a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioPanel.tsx b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioPanel.tsx index e1b931b8..1b5c3bea 100644 --- a/packages/transition-frontend/src/components/forms/scenario/TransitScenarioPanel.tsx +++ b/packages/transition-frontend/src/components/forms/scenario/TransitScenarioPanel.tsx @@ -9,7 +9,6 @@ import { withTranslation, WithTranslation } from 'react-i18next'; import { faFileUpload } from '@fortawesome/free-solid-svg-icons/faFileUpload'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import CollectionDownloadButtons from 'chaire-lib-frontend/lib/components/pageParts/CollectionDownloadButtons'; import CollectionSaveToCacheButtons from '../../parts/CollectionSaveToCacheButtons'; diff --git a/packages/transition-frontend/src/components/forms/service/TransitServiceList.tsx b/packages/transition-frontend/src/components/forms/service/TransitServiceList.tsx index 8e40f646..0e2885a3 100644 --- a/packages/transition-frontend/src/components/forms/service/TransitServiceList.tsx +++ b/packages/transition-frontend/src/components/forms/service/TransitServiceList.tsx @@ -6,7 +6,6 @@ */ import React, { useState } from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _get from 'lodash/get'; import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'; import { faTrash } from '@fortawesome/free-solid-svg-icons/faTrash'; diff --git a/packages/transition-frontend/src/components/forms/service/TransitServicePanel.tsx b/packages/transition-frontend/src/components/forms/service/TransitServicePanel.tsx index 0efb567b..f736014a 100644 --- a/packages/transition-frontend/src/components/forms/service/TransitServicePanel.tsx +++ b/packages/transition-frontend/src/components/forms/service/TransitServicePanel.tsx @@ -9,7 +9,6 @@ import { withTranslation, WithTranslation } from 'react-i18next'; import { faFileUpload } from '@fortawesome/free-solid-svg-icons/faFileUpload'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import CollectionDownloadButtons from 'chaire-lib-frontend/lib/components/pageParts/CollectionDownloadButtons'; import ServiceCollection from 'transition-common/lib/services/service/ServiceCollection'; @@ -33,7 +32,6 @@ const ServicesPanel: React.FunctionComponent = (props: WithTran serviceCollection: serviceLocator.collectionManager.get('services'), selectedService: serviceLocator.selectedObjectsManager.get('service') }); - const [_servicesReloaded, setServiceReloaded] = React.useState(false); const onServiceCollectionUpdate = () => setState(({ selectedService }) => ({ @@ -52,11 +50,7 @@ const ServicesPanel: React.FunctionComponent = (props: WithTran serviceLocator.eventManager.on('selected.deselect.service', onSelectedServiceUpdate); // Reload the service collections at mount time, to make sure it is up to date if (state.serviceCollection) { - state.serviceCollection - .loadFromServer(serviceLocator.socketEventManager, serviceLocator.collectionManager) - .then(() => { - setServiceReloaded(true); - }); + state.serviceCollection.loadFromServer(serviceLocator.socketEventManager, serviceLocator.collectionManager); } return () => { serviceLocator.eventManager.off('collection.update.services', onServiceCollectionUpdate); diff --git a/packages/transition-frontend/src/components/forms/simulation/SimulationList.tsx b/packages/transition-frontend/src/components/forms/simulation/SimulationList.tsx index 636b02f7..62cfe7e8 100644 --- a/packages/transition-frontend/src/components/forms/simulation/SimulationList.tsx +++ b/packages/transition-frontend/src/components/forms/simulation/SimulationList.tsx @@ -4,9 +4,8 @@ * This file is licensed under the MIT License. * License text available at https://opensource.org/licenses/MIT */ -import React, { useState } from 'react'; +import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _get from 'lodash/get'; import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus'; import Simulation from 'transition-common/lib/services/simulation/Simulation'; @@ -23,8 +22,6 @@ interface SimulationListProps extends WithTranslation { } const SimulationList: React.FunctionComponent = (props: SimulationListProps) => { - const [showModal, setShowModal] = useState(false); - const newSimulation = function () { const defaultColor = Preferences.get('transit.simulations.defaultColor', '#0086FF'); const newSimulation = new Simulation({ color: defaultColor }, true, serviceLocator.collectionManager); diff --git a/packages/transition-frontend/src/components/forms/simulation/SimulationPanel.tsx b/packages/transition-frontend/src/components/forms/simulation/SimulationPanel.tsx index e46c4e64..739b37c0 100644 --- a/packages/transition-frontend/src/components/forms/simulation/SimulationPanel.tsx +++ b/packages/transition-frontend/src/components/forms/simulation/SimulationPanel.tsx @@ -31,7 +31,6 @@ const SimulationsPanel: React.FunctionComponent = () => { const [dataLoaded, setDataLoaded] = React.useState( serviceCollection !== undefined && agencyCollection !== undefined && lineCollection !== undefined ); - const [_simulationReloaded, setSimulationReloaded] = React.useState(false); const onSimulationCollectionUpdate = () => setState(({ selectedSimulation }) => ({ @@ -63,11 +62,10 @@ const SimulationsPanel: React.FunctionComponent = () => { serviceLocator.eventManager.on('selected.deselect.simulation', onSelectedSimulationUpdate); // Reload the service collections at mount time, to make sure it is up to date if (state.simulationCollection) { - state.simulationCollection - .loadFromServer(serviceLocator.socketEventManager, serviceLocator.collectionManager) - .then(() => { - setSimulationReloaded(true); - }); + state.simulationCollection.loadFromServer( + serviceLocator.socketEventManager, + serviceLocator.collectionManager + ); } if (!dataLoaded) { serviceLocator.eventManager.on('collection.update.agencies', onOtherCollectionUpdate); diff --git a/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunButton.tsx b/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunButton.tsx index df096309..9db1b12e 100644 --- a/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunButton.tsx +++ b/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunButton.tsx @@ -108,7 +108,7 @@ const SimulationRunButton: React.FunctionComponent = ( cancel: { label: props.t('transit:simulation:SimulationRunDeleteCancel'), color: 'grey', - action: (e) => setDeleteCascadeModalIsOpen(false) + action: (_e) => setDeleteCascadeModalIsOpen(false) }, ignore: { label: props.t('transit:simulation:SimulationRunDeleteNoCascade'), diff --git a/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunList.tsx b/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunList.tsx index e908b804..7ff76fc2 100644 --- a/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunList.tsx +++ b/packages/transition-frontend/src/components/forms/simulation/widgets/SimulationRunList.tsx @@ -6,7 +6,6 @@ */ import React, { useState } from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import _get from 'lodash/get'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import Simulation from 'transition-common/lib/services/simulation/Simulation'; diff --git a/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultComponent.tsx b/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultComponent.tsx index dd8d3adb..4cf56100 100644 --- a/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultComponent.tsx +++ b/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultComponent.tsx @@ -10,7 +10,6 @@ import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft'; import TransitRoutingResults from './TransitRoutingResultComponent'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { RoutingResult } from 'chaire-lib-common/lib/services/routing/RoutingResult'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import { default as FormErrors } from 'chaire-lib-frontend/lib/components/pageParts/FormErrors'; diff --git a/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultsComponent.tsx b/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultsComponent.tsx index 99880b83..709c486b 100644 --- a/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultsComponent.tsx +++ b/packages/transition-frontend/src/components/forms/transitRouting/RoutingResultsComponent.tsx @@ -4,11 +4,10 @@ * This file is licensed under the MIT License. * License text available at https://opensource.org/licenses/MIT */ -import React, { useState } from 'react'; +import React from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { RoutingOrTransitMode } from 'chaire-lib-common/lib/config/routingModes'; import RoutingResultComponent from './RoutingResultComponent'; import { TransitRoutingAttributes } from 'transition-common/lib/services/transitRouting/TransitRouting'; @@ -50,7 +49,7 @@ const RoutingResults: React.FunctionComponent = (pro this.saveRoutingForBatch(routing)} + onClick={() => this.saveRoutingForBatch(routing)} />
{this.state.object.getAttributes().savedForBatch.length > 0 && ( diff --git a/packages/transition-frontend/src/components/forms/transitRouting/TransitRoutingResultComponent.tsx b/packages/transition-frontend/src/components/forms/transitRouting/TransitRoutingResultComponent.tsx index 991d5a30..bb8ab76e 100644 --- a/packages/transition-frontend/src/components/forms/transitRouting/TransitRoutingResultComponent.tsx +++ b/packages/transition-frontend/src/components/forms/transitRouting/TransitRoutingResultComponent.tsx @@ -13,7 +13,6 @@ import RouteButton from './RouteButton'; import DistanceUnitFormatter from 'chaire-lib-frontend/lib/components/pageParts/DistanceUnitFormatter'; import DurationUnitFormatter from 'chaire-lib-frontend/lib/components/pageParts/DurationUnitFormatter'; import { secondsToMinutes, secondsSinceMidnightToTimeStr } from 'chaire-lib-common/lib/utils/DateTimeUtils'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import { TrRoutingV2 } from 'chaire-lib-common/lib/api/TrRouting'; import { Route } from 'chaire-lib-common/lib/services/routing/RoutingService'; import { RoutingOrTransitMode } from 'chaire-lib-common/lib/config/routingModes'; diff --git a/packages/transition-frontend/src/components/map/TransitionMainMap.tsx b/packages/transition-frontend/src/components/map/TransitionMainMap.tsx index 01f1e563..d09a39a0 100644 --- a/packages/transition-frontend/src/components/map/TransitionMainMap.tsx +++ b/packages/transition-frontend/src/components/map/TransitionMainMap.tsx @@ -347,7 +347,7 @@ class MainMap extends React.Component { this.handleDrawPolygonService(polygon); }, - (polygon) => { + (_polygon) => { /* Nothing to do */ } ); @@ -428,7 +428,7 @@ class MainMap extends React.Component n.getId())) - .then((response) => { + .then((_response) => { serviceLocator.selectedObjectsManager.deselect('node'); serviceLocator.collectionManager.refresh('nodes'); serviceLocator.eventManager.emit('map.updateLayers', { diff --git a/packages/transition-frontend/src/components/parts/CollectionSaveToCacheButtons.tsx b/packages/transition-frontend/src/components/parts/CollectionSaveToCacheButtons.tsx index d72a52e9..8ffffef3 100644 --- a/packages/transition-frontend/src/components/parts/CollectionSaveToCacheButtons.tsx +++ b/packages/transition-frontend/src/components/parts/CollectionSaveToCacheButtons.tsx @@ -10,7 +10,6 @@ import { faArchive } from '@fortawesome/free-solid-svg-icons/faArchive'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; -import { _isBlank } from 'chaire-lib-common/lib/utils/LodashExtensions'; import GenericCollection from 'chaire-lib-common/lib/utils/objects/GenericCollection'; interface CollectionSaveToCacheProps extends WithTranslation { diff --git a/packages/transition-frontend/src/components/parts/FileImportForm.tsx b/packages/transition-frontend/src/components/parts/FileImportForm.tsx index e0adf9a6..dac1b184 100644 --- a/packages/transition-frontend/src/components/parts/FileImportForm.tsx +++ b/packages/transition-frontend/src/components/parts/FileImportForm.tsx @@ -12,7 +12,6 @@ import { faUpload } from '@fortawesome/free-solid-svg-icons/faUpload'; import InputFile from 'chaire-lib-frontend/lib/components/input/InputFile'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; -import FormErrors from 'chaire-lib-frontend/lib/components/pageParts/FormErrors'; import FileUploaderHOC, { FileUploaderHOCProps } from 'chaire-lib-frontend/lib/components/input/FileUploaderHOC'; interface FileImportFormProps extends FileUploaderHOCProps { @@ -26,8 +25,6 @@ interface FileImportFormProps extends FileUploaderHOCProps { const FileImportForm: React.FunctionComponent = ( props: FileImportFormProps & WithTranslation ) => { - const [fileSelected, setFileSelected] = React.useState(false); - return (
setFileSelected(true)} /> @@ -61,7 +57,7 @@ const FileImportForm: React.FunctionComponent { // upload - const uploadIds = props.fileUploader.upload(props.fileImportRef.current, { + props.fileUploader.upload(props.fileImportRef.current, { uploadTo: 'imports', data: { objects: props.pluralizedObjectsName, diff --git a/packages/transition-frontend/src/components/parts/executableJob/ExecutableJobComponent.tsx b/packages/transition-frontend/src/components/parts/executableJob/ExecutableJobComponent.tsx index 2a1e4a49..2c92e847 100644 --- a/packages/transition-frontend/src/components/parts/executableJob/ExecutableJobComponent.tsx +++ b/packages/transition-frontend/src/components/parts/executableJob/ExecutableJobComponent.tsx @@ -66,7 +66,7 @@ const cancelJobFromServer = (id: number): Promise> => { }; const ExecutableJobComponent: React.FunctionComponent = ( - props: ExecutableJobComponentProps & WithTranslation + componentProps: ExecutableJobComponentProps & WithTranslation ) => { // We'll start our table without any data const [data, setData] = React.useState([]); @@ -86,7 +86,7 @@ const ExecutableJobComponent: React.FunctionComponent { const columns = [ { - Header: props.t('transit:jobs:Date'), + Header: componentProps.t('transit:jobs:Date'), accessor: 'created_at', width: 100, Cell: (props) => moment(props.value).format(Preferences.get('dateTimeFormat')) }, { - Header: props.t('transit:jobs:EndTime'), + Header: componentProps.t('transit:jobs:EndTime'), accessor: 'updated_at', width: 100, Cell: (cellProps) => @@ -146,17 +146,17 @@ const ExecutableJobComponent: React.FunctionComponent (
- {props.t(`transit:jobs:Status_${cellProps.value}`)} + {componentProps.t(`transit:jobs:Status_${cellProps.value}`)}
) }, { - Header: props.t('transit:jobs:Data'), + Header: componentProps.t('transit:jobs:Data'), accessor: 'data', Cell: (cellProps) => ( @@ -171,14 +171,14 @@ const ExecutableJobComponent: React.FunctionComponent cellProps.value !== true ? ( '--' ) : ( ) @@ -195,8 +195,8 @@ const ExecutableJobComponent: React.FunctionComponent deleteJob(cellProps.value), - message: props.t('transit:jobs:ConfirmDelete'), - altText: props.t('transit:jobs:Delete') + message: componentProps.t('transit:jobs:ConfirmDelete'), + altText: componentProps.t('transit:jobs:Delete') }} > {(cellProps.row.original.status === 'pending' || @@ -204,21 +204,21 @@ const ExecutableJobComponent: React.FunctionComponent cancelJob(cellProps.value)} - title={props.t('transit:jobs:Cancel')} - message={props.t('transit:jobs:ConfirmCancel')} - confirmButtonText={props.t('transit:jobs:Cancel')} + title={componentProps.t('transit:jobs:Cancel')} + message={componentProps.t('transit:jobs:ConfirmCancel')} + confirmButtonText={componentProps.t('transit:jobs:Cancel')} > )} - {props.customActions !== undefined && - props.customActions.length > 0 && - props.customActions.map((action, index) => ( + {componentProps.customActions !== undefined && + componentProps.customActions.length > 0 && + componentProps.customActions.map((action, index) => ( action.callback(cellProps.value)} - title={props.t(action.title)} + title={componentProps.t(action.title)} > @@ -228,14 +228,14 @@ const ExecutableJobComponent: React.FunctionComponent[]; - if (props.jobType === undefined) { + if (componentProps.jobType === undefined) { columns.push({ - Header: props.t('transit:jobs:JobType') as string, + Header: componentProps.t('transit:jobs:JobType') as string, accessor: 'name' }); } return columns; - }, [props.t, props.jobType]); + }, [componentProps.t, componentProps.jobType]); return (
@@ -246,8 +246,8 @@ const ExecutableJobComponent: React.FunctionComponent
); diff --git a/packages/transition-frontend/src/components/parts/executableJob/ExpandableFileWidget.tsx b/packages/transition-frontend/src/components/parts/executableJob/ExpandableFileWidget.tsx index 2c84b49d..1e707dbe 100644 --- a/packages/transition-frontend/src/components/parts/executableJob/ExpandableFileWidget.tsx +++ b/packages/transition-frontend/src/components/parts/executableJob/ExpandableFileWidget.tsx @@ -47,7 +47,7 @@ const ExpandableFileWidget: React.FunctionComponent { + onClick={() => { setExpanded(true); setLoadRequested(true); }} @@ -59,7 +59,7 @@ const ExpandableFileWidget: React.FunctionComponent - setExpanded(false)} icon={faChevronUp} /> + setExpanded(false)} icon={faChevronUp} /> {files && Object.keys(files).map((fileName, fileIdx) => (

diff --git a/packages/transition-frontend/src/components/parts/executableJob/ExpandableText.tsx b/packages/transition-frontend/src/components/parts/executableJob/ExpandableText.tsx index cb115b74..96efa73d 100644 --- a/packages/transition-frontend/src/components/parts/executableJob/ExpandableText.tsx +++ b/packages/transition-frontend/src/components/parts/executableJob/ExpandableText.tsx @@ -19,14 +19,14 @@ const ExpandableText: React.FunctionComponent - setExpanded(false)} icon={faChevronUp} /> + setExpanded(false)} icon={faChevronUp} /> {props.children} ); } const stringToShorten = props.textToShorten || ''; const shortenedText = stringToShorten.length <= 20 ? stringToShorten : `${stringToShorten.substring(0, 20)}...`; - return

setExpanded(true)}>{shortenedText}
; + return
setExpanded(true)}>{shortenedText}
; }; export default ExpandableText; diff --git a/packages/transition-frontend/src/components/path/TransitPathHelp.tsx b/packages/transition-frontend/src/components/path/TransitPathHelp.tsx index 6737fccb..15a88f9c 100644 --- a/packages/transition-frontend/src/components/path/TransitPathHelp.tsx +++ b/packages/transition-frontend/src/components/path/TransitPathHelp.tsx @@ -6,7 +6,6 @@ */ import React, { useState } from 'react'; import { withTranslation, WithTranslation } from 'react-i18next'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle } from '@fortawesome/free-solid-svg-icons/faInfoCircle'; import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes'; import Button from 'chaire-lib-frontend/lib/components/input/Button'; diff --git a/packages/transition-frontend/src/services/accessibilityMap/BatchAccessibilityMapCalculator.ts b/packages/transition-frontend/src/services/accessibilityMap/BatchAccessibilityMapCalculator.ts index ae5bfb63..d6ff92e1 100644 --- a/packages/transition-frontend/src/services/accessibilityMap/BatchAccessibilityMapCalculator.ts +++ b/packages/transition-frontend/src/services/accessibilityMap/BatchAccessibilityMapCalculator.ts @@ -58,8 +58,7 @@ export class BatchAccessibilityMapCalculator { static async calculate( accessMap: TransitBatchAccessibilityMap, - updatePreferences = false, - options = {} + updatePreferences = false ): Promise { if (!accessMap.validate()) { const trError = new TrError( diff --git a/packages/transition-frontend/src/services/definitions/DefinitionsService.ts b/packages/transition-frontend/src/services/definitions/DefinitionsService.ts index 02fd5dc3..6cd40cf2 100644 --- a/packages/transition-frontend/src/services/definitions/DefinitionsService.ts +++ b/packages/transition-frontend/src/services/definitions/DefinitionsService.ts @@ -7,7 +7,6 @@ import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import * as Status from 'chaire-lib-common/lib/utils/Status'; -import { de } from 'date-fns/locale'; import { Dictionary } from 'lodash'; // Cache the definitions once they are fetched. This is to avoid fetching the diff --git a/packages/transition-frontend/src/services/map/events/NodeSectionMapEvents.ts b/packages/transition-frontend/src/services/map/events/NodeSectionMapEvents.ts index 14a09ac2..a3f31156 100644 --- a/packages/transition-frontend/src/services/map/events/NodeSectionMapEvents.ts +++ b/packages/transition-frontend/src/services/map/events/NodeSectionMapEvents.ts @@ -5,12 +5,9 @@ * License text available at https://opensource.org/licenses/MIT */ import MapboxGL from 'mapbox-gl'; -import _uniq from 'lodash/uniq'; import { MapEventHandlerDescription } from 'chaire-lib-frontend/lib/services/map/IMapEventHandler'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; -import { metersToPixels } from 'chaire-lib-common/lib/utils/geometry/ConversionUtils'; -import { permutationsWithRepetition } from 'chaire-lib-common/lib/utils/MathUtils'; import TransitNode from 'transition-common/lib/services/nodes/Node'; import Preferences from 'chaire-lib-common/lib/config/Preferences'; @@ -37,7 +34,6 @@ const onNodeSectionMapClick = (e: MapboxGL.MapMouseEvent) => { { layers: ['transitNodes'] } ); - const map = e.target; // TODO: If there are multiple selected features, offer the choice instead of editing the first one const selectedFeature = features.length > 0 ? features[0] : undefined; @@ -54,7 +50,7 @@ const onNodeSectionMapClick = (e: MapboxGL.MapMouseEvent) => { const attributes = selectedFeature.properties || {}; serviceLocator.socketEventManager.emit('transitNode.read', attributes.id, null, (response) => { const transitNodeEdit = new TransitNode({ ...response.node }, false, serviceLocator.collectionManager); - transitNodeEdit.loadFromCache(serviceLocator.socketEventManager).then((response) => { + transitNodeEdit.loadFromCache(serviceLocator.socketEventManager).then((_response) => { transitNodeEdit.startEditing(); serviceLocator.selectedObjectsManager.select('node', transitNodeEdit); }); diff --git a/packages/transition-frontend/src/services/map/events/PathSectionMapEvents.ts b/packages/transition-frontend/src/services/map/events/PathSectionMapEvents.ts index aa5844da..1172469b 100644 --- a/packages/transition-frontend/src/services/map/events/PathSectionMapEvents.ts +++ b/packages/transition-frontend/src/services/map/events/PathSectionMapEvents.ts @@ -139,7 +139,7 @@ const onPathSectionMapClick = async (e: MapboxGL.MapMouseEvent) => { ) { const attributes = features[clickedWaypointIndex].properties || {}; const path = selectedPath as TransitPath; - path.removeWaypoint(attributes.afterNodeIndex, attributes.waypointIndex).then((response) => { + path.removeWaypoint(attributes.afterNodeIndex, attributes.waypointIndex).then((_response) => { serviceLocator.selectedObjectsManager.update('path', path); serviceLocator.eventManager.emit('selected.updateLayers.path'); }); @@ -153,7 +153,7 @@ const onPathSectionMapClick = async (e: MapboxGL.MapMouseEvent) => { const waypointType = path.getAttributes().data.temporaryManualRouting ? 'manual' : path.getData('routingEngine', 'engine'); - path.insertWaypoint(e.lngLat.toArray(), waypointType, null, null).then((response) => { + path.insertWaypoint(e.lngLat.toArray(), waypointType, null, null).then((_response) => { path.validate(); serviceLocator.selectedObjectsManager.update('path', path); serviceLocator.eventManager.emit('selected.updateLayers.path'); diff --git a/packages/transition-frontend/src/services/routing/RoutingUtils.ts b/packages/transition-frontend/src/services/routing/RoutingUtils.ts index c60b1789..c5861b29 100644 --- a/packages/transition-frontend/src/services/routing/RoutingUtils.ts +++ b/packages/transition-frontend/src/services/routing/RoutingUtils.ts @@ -4,7 +4,6 @@ * This file is licensed under the MIT License. * License text available at https://opensource.org/licenses/MIT */ -import _cloneDeep from 'lodash/cloneDeep'; import serviceLocator from 'chaire-lib-common/lib/utils/ServiceLocator'; import * as Status from 'chaire-lib-common/lib/utils/Status'; import { RoutingResultsByMode } from 'chaire-lib-common/lib/services/routing/types'; diff --git a/packages/transition-frontend/src/services/transitService/TransitServiceUtils.ts b/packages/transition-frontend/src/services/transitService/TransitServiceUtils.ts index a5391e18..0e2a9a7a 100644 --- a/packages/transition-frontend/src/services/transitService/TransitServiceUtils.ts +++ b/packages/transition-frontend/src/services/transitService/TransitServiceUtils.ts @@ -79,7 +79,7 @@ export const serviceMatches = ( if (serviceName && !(serviceName.includes(filter.name) || serviceName.match(filter.name))) { return false; } - } catch (error) { + } catch { console.error(`Error interpreting regular expression ${filter.name}. Returning false`); return false; } diff --git a/packages/transition-frontend/src/types/global.d.ts b/packages/transition-frontend/src/types/global.d.ts index 98a4b5d9..8bcfb290 100644 --- a/packages/transition-frontend/src/types/global.d.ts +++ b/packages/transition-frontend/src/types/global.d.ts @@ -122,6 +122,7 @@ declare module 'react-table' { UseResizeColumnsColumnProps, UseSortByColumnProps {} + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ export interface Cell = Record, V = any> extends UseGroupByCellProps, UseRowStateCellProps {}