diff --git a/compendium-frontend/src/components/ColorBadgeService.tsx b/compendium-frontend/src/components/ColorBadgeService.tsx index 73a3df0fb7921a50d2374cfd4500ede23b97ab61..c978a92eeec639748262f84018a4a1b7f7c5afd2 100644 --- a/compendium-frontend/src/components/ColorBadgeService.tsx +++ b/compendium-frontend/src/components/ColorBadgeService.tsx @@ -7,8 +7,8 @@ function ColorBadgeService({ year, active, serviceInfo, tickServiceIndex, curren let tooltip_text = "No additional information available"; if (serviceInfo !== undefined) { - let serviceName = serviceInfo['service_name'] - let year = serviceInfo['year'] + const serviceName = serviceInfo['service_name'] + const year = serviceInfo['year'] let name = serviceInfo['product_name']; let desc = serviceInfo['official_description']; let info = serviceInfo['additional_information']; diff --git a/compendium-frontend/src/components/ScrollableMatrix.tsx b/compendium-frontend/src/components/ScrollableMatrix.tsx index 14a0060c369089cb5c3f0c2a80b14a74f804c9d7..2a2926118fb42383daf980ea6d688a3d544bc94b 100644 --- a/compendium-frontend/src/components/ScrollableMatrix.tsx +++ b/compendium-frontend/src/components/ScrollableMatrix.tsx @@ -10,7 +10,7 @@ const CELL_SIZE = 8 interface ScrollableMatrixProps { // dataLookup is a map of NRENs, years, and categories that maps to data for that category in that year for that NREN - dataLookup: Map<string, Map<number, Map<string, { [key: string]: any }>>>; + dataLookup: Map<string, Map<number, Map<string, { [key: string]: { [key: string]: string|number } }>>>; // rowInfo is a map of row titles and the lookup key that maps to data for that row rowInfo: { [key: string]: string }; @@ -34,7 +34,7 @@ export function ScrollableMatrix({ dataLookup, rowInfo, categoryLookup, isTickIc Array.from(dataLookup.entries()).sort( ([nrenA], [nrenB]) => nrenA.localeCompare(nrenB) - ).forEach(([nren, nrenData]) => { + ).forEach(([_nren, nrenData]) => { nrenData.forEach((yearData) => { const valuesForCategory = yearData.get(categoryKey); if (!valuesForCategory) return; diff --git a/compendium-frontend/src/components/ScrollableTable.tsx b/compendium-frontend/src/components/ScrollableTable.tsx index 549b135f99000e22fb79fb89f36ec7ddceb7bcd8..3b31659a83d8e1ea126df12df8ce45474fcfe582 100644 --- a/compendium-frontend/src/components/ScrollableTable.tsx +++ b/compendium-frontend/src/components/ScrollableTable.tsx @@ -23,7 +23,7 @@ export function ScrollableTable<T extends NrenAndYearDatapoint>({ dataLookup, co return ( <CollapsibleBox title={nren} key={nren} theme="-table" startCollapsed> <div className="scrollable-horizontal"> - {Array.from(nrenData.entries()).map(([year, yearData], index) => { + {Array.from(nrenData.entries()).map(([year, yearData]) => { // workaround for setting the background color of the ::before element to the color of the year const style = { '--before-color': `var(--color-of-the-year-muted-${year % 9})`, diff --git a/compendium-frontend/src/helpers/charthelpers.tsx b/compendium-frontend/src/helpers/charthelpers.tsx index face2f1ca3335fefc3259a8bd52ae3af051ac52c..941da39a3674642dd2ac3c6944b9dcf7daf381ca 100644 --- a/compendium-frontend/src/helpers/charthelpers.tsx +++ b/compendium-frontend/src/helpers/charthelpers.tsx @@ -6,7 +6,7 @@ interface options { tooltipPrefix?: string; tooltipUnit?: string; tickLimit?: number; - valueTransform?: (value: any) => number | string; + valueTransform?: (value) => number | string; } export const getLineChartOptions = ({ title, unit, tooltipPrefix, tooltipUnit, tickLimit, valueTransform }: options) => { return { diff --git a/compendium-frontend/src/helpers/dataconversion.tsx b/compendium-frontend/src/helpers/dataconversion.tsx index 73b95e0610a7f5ed01e5798c17d05a203fa3133c..df93348eab512e40c73bcce7c7fa2d163c5ef7ae 100644 --- a/compendium-frontend/src/helpers/dataconversion.tsx +++ b/compendium-frontend/src/helpers/dataconversion.tsx @@ -21,7 +21,7 @@ const stringToColour = function (str) { return colour; } -export function addTooltip<T extends NrenAndYearDatapoint>(dataLookup: Map<string, Map<string, Map<number, T>>>, processTooltip = (column: string, datapoint: T): string | undefined => undefined) { +export function addTooltip<T extends NrenAndYearDatapoint>(dataLookup: Map<string, Map<string, Map<number, T>>>, processTooltip = (_column: string, _datapoint: T): string | undefined => undefined) { const withTooltip = new Map<string, Map<string, Map<number, { [key: string]: string | number }>>>(); for (const [nren, nrenMap] of dataLookup) { @@ -193,7 +193,7 @@ export function createCategoryMatrixLookup<T extends NrenAndYearDatapoint>( */ // Row identifier -> NREN -> Year -> Data for that year - const dataLookup = new Map<string, Map<number, Map<string, { [key: string]: any }>>>(); + const dataLookup = new Map<string, Map<number, Map<string, { [key: string]: { [key: string]: string|number } }>>>(); const processMatrixLookup = (data: T[], categoryField: keyof T | undefined, field: string) => { data.forEach(datapoint => { @@ -207,8 +207,8 @@ export function createCategoryMatrixLookup<T extends NrenAndYearDatapoint>( const nren = datapoint.nren; const year = datapoint.year; - const nrenData = dataLookup.get(nren) || new Map<number, Map<string, { [key: string]: any }>>(); // NREN -> Year -> Data for that year - const yearData = nrenData.get(year) || new Map<string, { [key: string]: any }>(); // Year -> Data for that year + const nrenData = dataLookup.get(nren) || new Map<number, Map<string, { [key: string]: string|number }>>(); // NREN -> Year -> Data for that year + const yearData = nrenData.get(year) || new Map<string, { [key: string]: { [key: string]: string|number } }>(); // Year -> Data for that year const values = yearData.get(rowIdentifier as string) || {}; // Data for that year const value = datapoint[field]; @@ -635,7 +635,7 @@ export const createNRENStaffDatasetAbsolute = (data: NrenStaff[], selectedYears: return nrenA.localeCompare(nrenB); }); - function getDataset(year, index) { + function getDataset(year, _index) { const red = "rgba(219, 42, 76, 1)" return { @@ -694,7 +694,7 @@ export const createBarChartDataset = <T extends NrenAndYearDatapoint>(data: T[], }); const labelsYear = [...new Set(data.map((item) => item.year))].sort(); - function getDataset(year, index) { + function getDataset(year, _index) { const red = "rgba(219, 42, 76, 1)" return { diff --git a/compendium-frontend/src/matomo/MatomoTracker.ts b/compendium-frontend/src/matomo/MatomoTracker.ts index 645c598d6fca935a51dc829a63117f0113313b25..1427781fe3ce484fc8b5de59dda910c10c142bf2 100644 --- a/compendium-frontend/src/matomo/MatomoTracker.ts +++ b/compendium-frontend/src/matomo/MatomoTracker.ts @@ -69,7 +69,6 @@ class MatomoTracker { Object.entries(configurations).forEach(([name, instructions]) => { if (instructions instanceof Array) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.pushInstruction(name, ...instructions) } else { this.pushInstruction(name, instructions) diff --git a/compendium-frontend/src/matomo/UseMatomo.ts b/compendium-frontend/src/matomo/UseMatomo.ts index a5f432e28bf955043b2930e39c22197e2f880958..13a7cd0bf006eb41d62f8a46ba7b27c2d6ea6220 100644 --- a/compendium-frontend/src/matomo/UseMatomo.ts +++ b/compendium-frontend/src/matomo/UseMatomo.ts @@ -32,7 +32,7 @@ const trackEvent = useCallback( const pushInstruction = useCallback( (name: string, ...args: any[]) => { // eslint-disable-line @typescript-eslint/no-explicit-any - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + instance?.pushInstruction(name, ...args) }, [instance], diff --git a/compendium-frontend/src/pages/Network/IRUDuration.tsx b/compendium-frontend/src/pages/Network/IRUDuration.tsx index d374400a1146fc479aa330db877f74704e12806b..bcc8df07c0a0d86f5b0dac48aea023cd1234ab23 100644 --- a/compendium-frontend/src/pages/Network/IRUDuration.tsx +++ b/compendium-frontend/src/pages/Network/IRUDuration.tsx @@ -1,5 +1,4 @@ import React, { ReactElement, useContext } from 'react'; -import { Row } from "react-bootstrap"; import { Line } from 'react-chartjs-2'; diff --git a/compendium-frontend/src/pages/Network/NetworkMapUrls.tsx b/compendium-frontend/src/pages/Network/NetworkMapUrls.tsx index 818f45143f8a6a4a375cf4f1cd6ca0cb3b1a9576..eb85dea4b80045fca5be9224e602e514f39364de 100644 --- a/compendium-frontend/src/pages/Network/NetworkMapUrls.tsx +++ b/compendium-frontend/src/pages/Network/NetworkMapUrls.tsx @@ -12,7 +12,7 @@ import NrenYearTable from "../../components/NrenYearTable"; function NetworkMapUrlPage(): React.ReactElement { const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data, years, nrens } = useData<NetworkMapUrls>('/api/network-map-urls', setFilterSelection); + const { data, nrens } = useData<NetworkMapUrls>('/api/network-map-urls', setFilterSelection); const latestData = data ? getLatestData(data) : []; const selectedData = latestData.filter(data => diff --git a/compendium-frontend/src/pages/Network/TrafficUrl.tsx b/compendium-frontend/src/pages/Network/TrafficUrl.tsx index b52de86b1fa6a5202970ccb48d5b72823722b524..a200cb19a05d64b116f22ad1f1584829aaf8e11d 100644 --- a/compendium-frontend/src/pages/Network/TrafficUrl.tsx +++ b/compendium-frontend/src/pages/Network/TrafficUrl.tsx @@ -12,7 +12,7 @@ import NrenYearTable from "../../components/NrenYearTable"; function TrafficUrlPage(): React.ReactElement { const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data, years, nrens } = useData<TrafficStatistics>('/api/traffic-stats', setFilterSelection); + const { data, nrens } = useData<TrafficStatistics>('/api/traffic-stats', setFilterSelection); const latestData = data ? getLatestData(data) : []; const selectedData = latestData.filter(data => diff --git a/compendium-frontend/src/pages/Network/TrafficVolume.tsx b/compendium-frontend/src/pages/Network/TrafficVolume.tsx index 08f2c1df984eae9fbc6813e6e88037fd8d5e826a..8bbb60fff744603328746e434e1c549ec1d39fc7 100644 --- a/compendium-frontend/src/pages/Network/TrafficVolume.tsx +++ b/compendium-frontend/src/pages/Network/TrafficVolume.tsx @@ -37,7 +37,7 @@ ChartJS.register( function TrafficVolumePage(): ReactElement { const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data, years, nrens } = useData<TrafficVolume>('/api/traffic-volume', setFilterSelection); + const { data, nrens } = useData<TrafficVolume>('/api/traffic-volume', setFilterSelection); const selectedData = data.filter(data => filterSelection.selectedNrens.includes(data.nren) // we only allow filtering nrens for this page @@ -65,7 +65,7 @@ function TrafficVolumePage(): ReactElement { return ( <DataPage title="NREN Traffic - NREN Customers & External Networks" description={<span>The four graphs below show the estimates of total annual traffic in PB (1000 TB) to & from NREN customers, - and to & from external networks. NREN customers are taken to mean sources that are part of the NREN's connectivity remit, + and to & from external networks. NREN customers are taken to mean sources that are part of the NREN's connectivity remit, while external networks are understood as outside sources including GÉANT, the general/commercial internet, internet exchanges, peerings, other NRENs, etc.</span>} category={Sections.Network} filter={filterNode} data={selectedData} filename="NREN_traffic_estimates_data"> diff --git a/compendium-frontend/src/pages/Network/WeatherMap.tsx b/compendium-frontend/src/pages/Network/WeatherMap.tsx index 5194066546f2b61464039d75bce584353629a437..54029af8470073b87a9b612df9b3b4b5592022bb 100644 --- a/compendium-frontend/src/pages/Network/WeatherMap.tsx +++ b/compendium-frontend/src/pages/Network/WeatherMap.tsx @@ -12,7 +12,7 @@ import NrenYearTable from "../../components/NrenYearTable"; function NetworkWeatherMapPage(): React.ReactElement { const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data: fetchedData, years, nrens } = useData<WeatherMap>('/api/weather-map', setFilterSelection); + const { data: fetchedData, nrens } = useData<WeatherMap>('/api/weather-map', setFilterSelection); const latestData = fetchedData ? getLatestData(fetchedData) : []; const selectedData = latestData.filter(data => diff --git a/compendium-frontend/src/pages/Standards&Policies/CorporateStrategy.tsx b/compendium-frontend/src/pages/Standards&Policies/CorporateStrategy.tsx index 11c3f0dd4b838a5d3b742063d5fdb6d1a560bb66..33266877b4c9d7f9636852a1b609bd16467aea7e 100644 --- a/compendium-frontend/src/pages/Standards&Policies/CorporateStrategy.tsx +++ b/compendium-frontend/src/pages/Standards&Policies/CorporateStrategy.tsx @@ -15,7 +15,7 @@ function CorporateStrategyPage() { const validityCheck = (data: CorporateStrategy) => !!data[dataField]; const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data, years, nrens } = useData<CorporateStrategy>('/api/policy', setFilterSelection, validityCheck); + const { data, nrens } = useData<CorporateStrategy>('/api/policy', setFilterSelection, validityCheck); const policyData = data ? getLatestData(data) : []; diff --git a/compendium-frontend/src/pages/Standards&Policies/Policy.tsx b/compendium-frontend/src/pages/Standards&Policies/Policy.tsx index 63ab52c2c8b6f68d60bb155a35bac4d376d03280..a4b4d2942049b81c8582511987b69ac2550806fd 100644 --- a/compendium-frontend/src/pages/Standards&Policies/Policy.tsx +++ b/compendium-frontend/src/pages/Standards&Policies/Policy.tsx @@ -13,7 +13,7 @@ import NrenYearTable from '../../components/NrenYearTable'; function PolicyPage() { const { filterSelection, setFilterSelection } = useContext(FilterSelectionContext); - const { data: fetchedData, years, nrens } = useData<Policy>('/api/policy', setFilterSelection); + const { data: fetchedData, nrens } = useData<Policy>('/api/policy', setFilterSelection); const policyData = fetchedData ? getLatestData(fetchedData) : []; diff --git a/compendium-frontend/src/providers/ConfigProvider.tsx b/compendium-frontend/src/providers/ConfigProvider.tsx index 65057d385c64771b05791c62717201760a5182b5..9ec43033026fe608fc09bbe569e805b950dbff59 100644 --- a/compendium-frontend/src/providers/ConfigProvider.tsx +++ b/compendium-frontend/src/providers/ConfigProvider.tsx @@ -21,7 +21,7 @@ const saveConfigToLocalStorage = (config) => { } export type BaseConfig = { - [K: string | number | symbol]: any; + [K: string | number | symbol]: { [key: string]: string | number | boolean | Date | undefined | BaseConfig }; }; type ConfigContext<T extends BaseConfig> = { @@ -41,7 +41,7 @@ interface Props { const ConfigProvider: React.FC<Props> = ({ children }) => { const [config, setConfig] = useState<BaseConfig>(getConfigFromLocalStorage()); - const updateConfig = (key, value?: any, timeout?: Date) => { + const updateConfig = (key, value?, timeout?: Date) => { if (!key) throw new Error('Valid config key must be provided'); if (value == undefined) { const newConfig = { ...config }; diff --git a/compendium-frontend/src/providers/NrenProvider.tsx b/compendium-frontend/src/providers/NrenProvider.tsx index 1d8634b94c2c8bc27bdee36bcd418eda2492d061..a7ac95d3fa58d4fd9dfb68adb81caef9811e88cc 100644 --- a/compendium-frontend/src/providers/NrenProvider.tsx +++ b/compendium-frontend/src/providers/NrenProvider.tsx @@ -10,7 +10,7 @@ async function fetchNrens(): Promise<Nren[]> { const response = await fetch('/api/nren/list'); const userList = await response.json(); return userList - } catch (error) { + } catch { return []; } } diff --git a/compendium-frontend/src/survey/Landing.tsx b/compendium-frontend/src/survey/Landing.tsx index 0bf3f3f16d84550f7a852cd27416deb6ddba6b82..5e721e70550bc5b917e82d281bc2f1ef4dc36e97 100644 --- a/compendium-frontend/src/survey/Landing.tsx +++ b/compendium-frontend/src/survey/Landing.tsx @@ -70,7 +70,7 @@ function Landing(): ReactElement { } } - function convertToExcel(jsonData: { name: string, data: any, meta: any }[]): Blob { + function convertToExcel(jsonData: { name: string, data, meta }[]): Blob { const wb = XLSX.utils.book_new(); jsonData.forEach(sheet => { const ws = XLSX.utils.json_to_sheet(sheet.data); diff --git a/compendium-frontend/src/survey/ShowUser.tsx b/compendium-frontend/src/survey/ShowUser.tsx index 83d5d93b771e947fc1f14ceb04e11e605073a42d..f3aa6696254535602bc8f259c512df6d6c2ce76c 100644 --- a/compendium-frontend/src/survey/ShowUser.tsx +++ b/compendium-frontend/src/survey/ShowUser.tsx @@ -11,7 +11,7 @@ async function fetchUser(): Promise<User> { const response = await fetch('/api/user/'); const user = await response.json(); return user - } catch (error) { + } catch { return { 'name': 'Error Fetching User' } diff --git a/compendium-frontend/src/survey/SurveyContainerComponent.tsx b/compendium-frontend/src/survey/SurveyContainerComponent.tsx index c516fc305cc9d6e16925a157f26b687136fc99eb..3e724a58b423714608711b93e5b560dfc20908d8 100644 --- a/compendium-frontend/src/survey/SurveyContainerComponent.tsx +++ b/compendium-frontend/src/survey/SurveyContainerComponent.tsx @@ -17,13 +17,13 @@ import { userContext } from "../providers/UserProvider"; interface ValidationQuestion { name?: string; - value?: any; + value?: string | number | null; data?: ValidationQuestion; } // Overrides for questions that need to be validated differently from the default expression in their group const questionOverrides = { - data_protection_contact: (...args) => true, // don't validate the contact field, anything goes.. + data_protection_contact: (..._args) => true, // don't validate the contact field, anything goes.. } function oldValidateWebsiteUrl(params) { @@ -43,12 +43,12 @@ function oldValidateWebsiteUrl(params) { const url = new URL(value); return !!url - } catch (err) { + } catch { return false; } } -function validateQuestion(this: { question: ValidationQuestion, row?: any }, params: any) { +function validateQuestion(this: { question: ValidationQuestion, row? }, params) { try { const question = this.question; const validator = params[0] || undefined; @@ -111,13 +111,13 @@ function SurveyContainerComponent({ loadFrom }) { const pageHideListener = useCallback(() => { window.navigator.sendBeacon('/api/response/unlock/' + year + '/' + nren); - }, []); + }, []); // eslint-disable-line react-hooks/exhaustive-deps const onPageExitThroughRouter = useCallback(() => { window.navigator.sendBeacon('/api/response/unlock/' + year + '/' + nren); removeEventListener("beforeunload", beforeUnloadListener, { capture: true }); removeEventListener("pagehide", pageHideListener); - }, []); + }, []); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { async function getModel() { @@ -160,7 +160,7 @@ function SurveyContainerComponent({ loadFrom }) { getModel().catch(error => setError('Error when loading survey: ' + error.message)).then(() => { trackPageView({ documentTitle: `Survey for ${nren} (${year})` }); }) - }, []); + }, []); // eslint-disable-line react-hooks/exhaustive-deps if (!surveyModel) { return error; diff --git a/compendium-frontend/src/survey/SurveyNavigationComponent.tsx b/compendium-frontend/src/survey/SurveyNavigationComponent.tsx index 14a9753a0aa517737006b8395e9b589b145a95db..0d81f8132435b1e52ee899c1439c5340a704cb13 100644 --- a/compendium-frontend/src/survey/SurveyNavigationComponent.tsx +++ b/compendium-frontend/src/survey/SurveyNavigationComponent.tsx @@ -2,7 +2,6 @@ import React, { useContext, useEffect, useState, useCallback } from "react"; import ProgressBar from './ProgressBar'; import { Container, Row } from "react-bootstrap"; import { userContext } from "../providers/UserProvider"; -import { ResponseStatus } from "./Schema"; function SurveyNavigationComponent({ surveyModel, surveyActions, year, nren, children }) { diff --git a/compendium-frontend/src/survey/api/survey.ts b/compendium-frontend/src/survey/api/survey.ts index 48ba53affca0e4c535bd1e6a2ff0258fd8a642e8..44814d468d65bad9b8608f4c94421dc8600b2b8a 100644 --- a/compendium-frontend/src/survey/api/survey.ts +++ b/compendium-frontend/src/survey/api/survey.ts @@ -5,7 +5,7 @@ export async function fetchSurveys(): Promise<Survey[]> { const response = await fetch('/api/survey/list'); const userList = await response.json(); return userList - } catch (error) { + } catch { return []; } } diff --git a/compendium-frontend/src/survey/management/UserManagementComponent.tsx b/compendium-frontend/src/survey/management/UserManagementComponent.tsx index 9a911b5b3f287bcdb5ddc794d0bb662411af83eb..60c59d36065757065340caf4aa2509e147b36728 100644 --- a/compendium-frontend/src/survey/management/UserManagementComponent.tsx +++ b/compendium-frontend/src/survey/management/UserManagementComponent.tsx @@ -13,7 +13,7 @@ async function fetchUsers(): Promise<User[]> { try { const response = await fetch("/api/user/list"); return await response.json() - } catch (error) { + } catch { return []; } } @@ -22,7 +22,7 @@ async function fetchNrens(): Promise<Nren[]> { try { const response = await fetch("/api/nren/list"); return await response.json() - } catch (error) { + } catch { return []; } } diff --git a/compendium-frontend/src/survey/validation/validation.ts b/compendium-frontend/src/survey/validation/validation.ts index a3cba3b88e3485e46f284726ab03db04252c70cf..59c60e564f0ec442cb57e6f84ab48b28a2e6a627 100644 --- a/compendium-frontend/src/survey/validation/validation.ts +++ b/compendium-frontend/src/survey/validation/validation.ts @@ -14,7 +14,7 @@ function validateWebsiteUrl(value, nonEmpty = false) { const url = new URL(value); return !!url - } catch (err) { + } catch { return false; } }