From 62921c5e1bdca3e1b3145bf8feb2ac932ecd37b5 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 31 May 2024 19:20:30 +0100 Subject: [PATCH] fix: minor frontend issues, remove prop-types --- src/frontend/src/api/CreateProjectService.ts | 2 +- .../OpenLayersComponent/LayerSwitcher/index.js | 2 -- .../OpenLayersComponent/Layers/VectorLayer.js | 2 -- .../OpenLayersComponent/MapContainer/index.jsx | 1 - .../MapComponent/OpenLayersComponent/Popup/index.jsx | 1 - src/frontend/src/components/common/CustomTable.tsx | 2 -- .../src/components/common/InputTextField.tsx | 1 - src/frontend/src/main.tsx | 12 +++++++++++- src/frontend/src/utilities/BasicTabs.tsx | 1 - src/frontend/vite.config.ts | 2 -- 10 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/frontend/src/api/CreateProjectService.ts b/src/frontend/src/api/CreateProjectService.ts index 8e5d64789d..e54530a5d1 100755 --- a/src/frontend/src/api/CreateProjectService.ts +++ b/src/frontend/src/api/CreateProjectService.ts @@ -7,7 +7,7 @@ import { OrganisationListModel, } from '@/models/createproject/createProjectModel'; import { CommonActions } from '@/store/slices/CommonSlice'; -import { ValidateCustomFormResponse } from 'store/types/ICreateProject'; +import { ValidateCustomFormResponse } from '@/store/types/ICreateProject'; import { task_split_type } from '@/types/enums'; const CreateProjectService: Function = ( diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js index 56555caf71..c2331c7fb1 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/LayerSwitcher/index.js @@ -1,9 +1,7 @@ -/* eslint-disable react/prop-types */ /* eslint-disable no-unused-vars */ import 'ol-layerswitcher/dist/ol-layerswitcher.css'; // import "../../node_modules/ol-layerswitcher/dist/ol-layerswitcher.css"; import LayerGroup from 'ol/layer/Group'; -import Collection from 'ol/Collection.js'; import LayerTile from 'ol/layer/Tile'; import SourceOSM from 'ol/source/OSM'; import LayerSwitcher from 'ol-layerswitcher'; diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js index da3f558808..0410c40f0c 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/Layers/VectorLayer.js @@ -1,8 +1,6 @@ /* eslint-disable no-console */ /* eslint-disable consistent-return */ -/* eslint-disable react/forbid-prop-types */ import React, { useEffect, useState } from 'react'; -import PropTypes from 'prop-types'; import { get } from 'ol/proj'; import { Circle as CircleStyle, Fill, Stroke, Style } from 'ol/style.js'; import GeoJSON from 'ol/format/GeoJSON'; diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/MapContainer/index.jsx b/src/frontend/src/components/MapComponent/OpenLayersComponent/MapContainer/index.jsx index 086684f135..87ffbbbd0f 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/MapContainer/index.jsx +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/MapContainer/index.jsx @@ -2,7 +2,6 @@ /* eslint-disable react/jsx-props-no-spreading */ /* eslint-disable react/jsx-no-useless-fragment */ import React from 'react'; -import PropTypes from 'prop-types'; import '../map.scss'; const { Children, cloneElement, forwardRef } = React; diff --git a/src/frontend/src/components/MapComponent/OpenLayersComponent/Popup/index.jsx b/src/frontend/src/components/MapComponent/OpenLayersComponent/Popup/index.jsx index f963ab8453..401306b810 100644 --- a/src/frontend/src/components/MapComponent/OpenLayersComponent/Popup/index.jsx +++ b/src/frontend/src/components/MapComponent/OpenLayersComponent/Popup/index.jsx @@ -1,4 +1,3 @@ -// /* eslint-disable react/prop-types */ // /* eslint-disable jsx-a11y/anchor-has-content */ // /* eslint-disable func-names */ // /* eslint-disable jsx-a11y/control-has-associated-label */ diff --git a/src/frontend/src/components/common/CustomTable.tsx b/src/frontend/src/components/common/CustomTable.tsx index bf079227ef..64cc28f5a6 100644 --- a/src/frontend/src/components/common/CustomTable.tsx +++ b/src/frontend/src/components/common/CustomTable.tsx @@ -1,7 +1,5 @@ -/* eslint-disable react/prop-types */ /* eslint-disable react/no-unknown-property */ /* eslint-disable react/self-closing-comp */ -/* eslint-disable react/no-unused-prop-types */ /* eslint-disable react/no-array-index-key */ /* eslint-disable react/no-unstable-nested-components */ /* eslint-disable no-unused-vars */ diff --git a/src/frontend/src/components/common/InputTextField.tsx b/src/frontend/src/components/common/InputTextField.tsx index 6ee6e68c90..d29c813a4a 100644 --- a/src/frontend/src/components/common/InputTextField.tsx +++ b/src/frontend/src/components/common/InputTextField.tsx @@ -1,6 +1,5 @@ /* eslint-disable react/no-unstable-nested-components */ import React from 'react'; -// import PropTypes from 'prop-types'; export const blockInvalidChar = (e) => ['e', 'E', '+', '-'].includes(e.key) && e.preventDefault(); interface IInputTextFieldProps { diff --git a/src/frontend/src/main.tsx b/src/frontend/src/main.tsx index e9f26f702f..546eac21e2 100644 --- a/src/frontend/src/main.tsx +++ b/src/frontend/src/main.tsx @@ -72,4 +72,14 @@ axios.interceptors.request.use( })(); // React 18 setup -createRoot(document.getElementById('app')!).render(); +createRoot(document.getElementById('app')!, { + // // React 19 exposes hooks for Sentry + // // Callback called when an error is thrown and not caught by an Error Boundary. + // onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => { + // console.warn('Uncaught error', error, errorInfo.componentStack); + // }), + // // Callback called when React catches an error in an Error Boundary. + // onCaughtError: Sentry.reactErrorHandler(), + // // Callback called when React automatically recovers from errors. + // onRecoverableError: Sentry.reactErrorHandler(), +}).render(); diff --git a/src/frontend/src/utilities/BasicTabs.tsx b/src/frontend/src/utilities/BasicTabs.tsx index b6902e6a87..71ecdbb8e1 100755 --- a/src/frontend/src/utilities/BasicTabs.tsx +++ b/src/frontend/src/utilities/BasicTabs.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import PropTypes from 'prop-types'; import windowDimention from '@/hooks/WindowDimension'; import CoreModules from '@/shared/CoreModules'; diff --git a/src/frontend/vite.config.ts b/src/frontend/vite.config.ts index fadae5c9d4..e2df3ae6b1 100644 --- a/src/frontend/vite.config.ts +++ b/src/frontend/vite.config.ts @@ -70,8 +70,6 @@ export default defineConfig(({ mode }) => { }, test: { globals: true, - environment: 'jsdom', - setupFiles: './setupTests.ts', exclude: [...configDefaults.exclude, 'e2e', 'playwright-tests-examples'], }, };