From 994c47348d45ac71c7adcfc5555fdf882ed9e894 Mon Sep 17 00:00:00 2001 From: Bjarke Madsen <bjarke@nordu.net> Date: Fri, 24 Jan 2025 14:25:14 +0100 Subject: [PATCH] lint everything --- .../src/components/ColorBadge.tsx | 2 +- .../src/components/ColorBadgeService.tsx | 2 +- .../src/components/ScrollableMatrix.tsx | 2 +- .../src/components/ScrollableTable.tsx | 4 ++-- .../src/components/global/GeantFooter.tsx | 2 +- .../src/helpers/dataconversion.tsx | 6 +++--- compendium-frontend/src/index.tsx | 4 ++-- compendium-frontend/src/matomo/UseMatomo.ts | 4 ++-- .../pages/ConnectedUsers/RemoteCampuses.tsx | 2 +- .../src/pages/Network/CapacityLargestLink.tsx | 2 +- .../src/pages/Network/ExternalConnections.tsx | 4 ++-- .../src/pages/Organization/FundingSource.tsx | 18 +++++++++--------- .../src/providers/ConsentProvider.tsx | 2 +- .../src/providers/PreviewProvider.tsx | 2 +- compendium-frontend/src/survey/ProgressBar.tsx | 14 +++++++------- .../src/survey/SurveyContainerComponent.tsx | 2 +- compendium-frontend/src/survey/api/survey.ts | 2 +- 17 files changed, 37 insertions(+), 37 deletions(-) diff --git a/compendium-frontend/src/components/ColorBadge.tsx b/compendium-frontend/src/components/ColorBadge.tsx index 83547d0a..bc6b55da 100644 --- a/compendium-frontend/src/components/ColorBadge.tsx +++ b/compendium-frontend/src/components/ColorBadge.tsx @@ -1,6 +1,6 @@ import React from "react"; -function ColorBadge({ index: index, active=true }) { +function ColorBadge({ index: index, active = true }) { return ( <div className="d-inline-block m-2" key={index}> {active ? ( diff --git a/compendium-frontend/src/components/ColorBadgeService.tsx b/compendium-frontend/src/components/ColorBadgeService.tsx index c978a92e..8b33e056 100644 --- a/compendium-frontend/src/components/ColorBadgeService.tsx +++ b/compendium-frontend/src/components/ColorBadgeService.tsx @@ -16,7 +16,7 @@ function ColorBadgeService({ year, active, serviceInfo, tickServiceIndex, curren name = name || "N/A"; desc = desc || "N/A"; info = info || "N/A"; - tooltip_text = serviceName +" ("+year+")"+ "\n" + name + "\n\n" + "Description: " + desc + "\n" + "Information: " + info; + tooltip_text = serviceName + " (" + year + ")" + "\n" + name + "\n\n" + "Description: " + desc + "\n" + "Information: " + info; } } diff --git a/compendium-frontend/src/components/ScrollableMatrix.tsx b/compendium-frontend/src/components/ScrollableMatrix.tsx index 2a292611..53498be4 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]: { [key: string]: string|number } }>>>; + 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 }; diff --git a/compendium-frontend/src/components/ScrollableTable.tsx b/compendium-frontend/src/components/ScrollableTable.tsx index 3b31659a..94888ad3 100644 --- a/compendium-frontend/src/components/ScrollableTable.tsx +++ b/compendium-frontend/src/components/ScrollableTable.tsx @@ -25,7 +25,7 @@ export function ScrollableTable<T extends NrenAndYearDatapoint>({ dataLookup, co <div className="scrollable-horizontal"> {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 = { + const style = { '--before-color': `var(--color-of-the-year-muted-${year % 9})`, } as React.CSSProperties @@ -37,7 +37,7 @@ export function ScrollableTable<T extends NrenAndYearDatapoint>({ dataLookup, co <thead> <tr> {Object.keys(columnInfo).map((title) => ( - <th key={title} style={{position: "relative"}}> + <th key={title} style={{ position: "relative" }}> <span style={style}>{title}</span></th> ))} </tr> diff --git a/compendium-frontend/src/components/global/GeantFooter.tsx b/compendium-frontend/src/components/global/GeantFooter.tsx index 5959b797..f7091ad4 100644 --- a/compendium-frontend/src/components/global/GeantFooter.tsx +++ b/compendium-frontend/src/components/global/GeantFooter.tsx @@ -23,7 +23,7 @@ function GeantFooter(): ReactElement { <wbr />| <a className="mx-3 footer-link" href="https://geant.org/Privacy-Notice/">Privacy Policy</a> <wbr />| - <a className="mx-3 footer-link" style={{cursor: "pointer"}} onClick={() => { + <a className="mx-3 footer-link" style={{ cursor: "pointer" }} onClick={() => { localStorage.removeItem('matomo_consent'); window.location.reload(); }}>Analytics Consent</a> diff --git a/compendium-frontend/src/helpers/dataconversion.tsx b/compendium-frontend/src/helpers/dataconversion.tsx index df93348e..83ddd81f 100644 --- a/compendium-frontend/src/helpers/dataconversion.tsx +++ b/compendium-frontend/src/helpers/dataconversion.tsx @@ -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]: { [key: string]: string|number } }>>>(); + 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]: 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 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]; diff --git a/compendium-frontend/src/index.tsx b/compendium-frontend/src/index.tsx index 1be857a3..02df09a3 100644 --- a/compendium-frontend/src/index.tsx +++ b/compendium-frontend/src/index.tsx @@ -6,9 +6,9 @@ import 'bootstrap/dist/css/bootstrap.min.css'; import './main.scss'; const container = document.getElementById('root') as HTMLElement; -const root = createRoot(container); +const root = createRoot(container); root.render( <React.StrictMode> - <App/> + <App /> </React.StrictMode> ) \ No newline at end of file diff --git a/compendium-frontend/src/matomo/UseMatomo.ts b/compendium-frontend/src/matomo/UseMatomo.ts index 13a7cd0b..c3624f01 100644 --- a/compendium-frontend/src/matomo/UseMatomo.ts +++ b/compendium-frontend/src/matomo/UseMatomo.ts @@ -14,7 +14,7 @@ function useMatomo() { [instance], ) -const trackEvent = useCallback( + const trackEvent = useCallback( (params: TrackEventParams) => instance?.trackEvent(params), [instance], ) @@ -32,7 +32,7 @@ const trackEvent = useCallback( const pushInstruction = useCallback( (name: string, ...args: any[]) => { // eslint-disable-line @typescript-eslint/no-explicit-any - + instance?.pushInstruction(name, ...args) }, [instance], diff --git a/compendium-frontend/src/pages/ConnectedUsers/RemoteCampuses.tsx b/compendium-frontend/src/pages/ConnectedUsers/RemoteCampuses.tsx index b130c932..ff97780c 100644 --- a/compendium-frontend/src/pages/ConnectedUsers/RemoteCampuses.tsx +++ b/compendium-frontend/src/pages/ConnectedUsers/RemoteCampuses.tsx @@ -31,7 +31,7 @@ function RemoteCampusesPage() { const countries = campus.connections.map(connection => connection.country).join(', '); obj['countries'] = countries; obj['local_r_and_e_connection'] = campus.connections.map(connection => connection.local_r_and_e_connection ? 'Yes' : 'No').join(', '); - + } }) diff --git a/compendium-frontend/src/pages/Network/CapacityLargestLink.tsx b/compendium-frontend/src/pages/Network/CapacityLargestLink.tsx index d3d7a50d..81138ba2 100644 --- a/compendium-frontend/src/pages/Network/CapacityLargestLink.tsx +++ b/compendium-frontend/src/pages/Network/CapacityLargestLink.tsx @@ -52,7 +52,7 @@ function CapacityLargestLinkPage() { provide the sum of aggregated links, backup capacity was not to be included.` const options = getBarChartOptions({ - + title: title, tooltipUnit: 'Gbit/s', unit: 'Gbit/s', diff --git a/compendium-frontend/src/pages/Network/ExternalConnections.tsx b/compendium-frontend/src/pages/Network/ExternalConnections.tsx index 8bfe733b..8bed655e 100644 --- a/compendium-frontend/src/pages/Network/ExternalConnections.tsx +++ b/compendium-frontend/src/pages/Network/ExternalConnections.tsx @@ -40,8 +40,8 @@ function ExternalConnectionsPage(): React.ReactElement { These include links to their regional backbone (ie. GÉANT), to other research locations, to the commercial internet, peerings to internet exchanges, cross-border dark fibre links, and any other links they may have.</p> <p>NRENs are asked to state the capacity for production purposes, not any additional link that may be there solely for the purpose of giving resilience. - Cross-border fibre links are meant as those links which have been commissioned or established by the NREN from a point on their network, - which is near the border to another point near the border on the network of a neighbouring NREN.</p></> + Cross-border fibre links are meant as those links which have been commissioned or established by the NREN from a point on their network, + which is near the border to another point near the border on the network of a neighbouring NREN.</p></> return ( <DataPage title="NREN External IP Connections" diff --git a/compendium-frontend/src/pages/Organization/FundingSource.tsx b/compendium-frontend/src/pages/Organization/FundingSource.tsx index 958971ac..ae62e3b9 100644 --- a/compendium-frontend/src/pages/Organization/FundingSource.tsx +++ b/compendium-frontend/src/pages/Organization/FundingSource.tsx @@ -1,7 +1,7 @@ import React, { useContext } from 'react'; import { Bar } from 'react-chartjs-2'; import { Col, Row } from "react-bootstrap"; -import { Chart as ChartJS, Tooltip} from 'chart.js'; +import { Chart as ChartJS, Tooltip } from 'chart.js'; import ChartDataLabels from 'chartjs-plugin-datalabels'; import { FundingSource } from "../../Schema"; @@ -30,16 +30,16 @@ const chartOptions = { }, tooltip: { callbacks: { - label: function (tooltipItem) { - let label = tooltipItem.dataset.label || ''; + label: function (tooltipItem) { + let label = tooltipItem.dataset.label || ''; - if (tooltipItem.parsed.y !== null) { - label += `: ${tooltipItem.parsed.x}%` - } - return label; + if (tooltipItem.parsed.y !== null) { + label += `: ${tooltipItem.parsed.x}%` } + return label; + } }, - }, + }, }, scales: { x: { @@ -119,7 +119,7 @@ function FundingSourceLegend() { } ChartJS.register( - Tooltip, + Tooltip, ); function FundingSourcePage() { diff --git a/compendium-frontend/src/providers/ConsentProvider.tsx b/compendium-frontend/src/providers/ConsentProvider.tsx index cba0ec0d..caf79512 100644 --- a/compendium-frontend/src/providers/ConsentProvider.tsx +++ b/compendium-frontend/src/providers/ConsentProvider.tsx @@ -9,7 +9,7 @@ const consentContext = createContext<{ setConsent: (consent: boolean) => void; }>({ consent: null, - setConsent: () => {} + setConsent: () => { } }); diff --git a/compendium-frontend/src/providers/PreviewProvider.tsx b/compendium-frontend/src/providers/PreviewProvider.tsx index 4630a5d9..91e6ac59 100644 --- a/compendium-frontend/src/providers/PreviewProvider.tsx +++ b/compendium-frontend/src/providers/PreviewProvider.tsx @@ -9,7 +9,7 @@ const PreviewContext = createContext<{ setPreview: Dispatch<SetStateAction<boolean>>; }>({ preview: false, - setPreview: () => {} + setPreview: () => { } }); diff --git a/compendium-frontend/src/survey/ProgressBar.tsx b/compendium-frontend/src/survey/ProgressBar.tsx index b88da9f5..e1b44b3d 100644 --- a/compendium-frontend/src/survey/ProgressBar.tsx +++ b/compendium-frontend/src/survey/ProgressBar.tsx @@ -14,17 +14,17 @@ function ProgressBar({ surveyModel, pageNoSetter }) { const filterCallback = (question) => { - if(question.value === null || question.value === undefined || question.value===""){ + if (question.value === null || question.value === undefined || question.value === "") { return false; } // For text and comment and other types - if(question.getType()==="checkbox" && question.value.length == 0) { - return false ; + if (question.getType() === "checkbox" && question.value.length == 0) { + return false; }//For empty checkbox - if (question.getType()==="multipletext" && + if (question.getType() === "multipletext" && ((Object.keys(question.value).length === 1 - && Object.values(question.value)[0]=== undefined) - || Object.keys(question.value).length === 0 )){ - return false + && Object.values(question.value)[0] === undefined) + || Object.keys(question.value).length === 0)) { + return false }// For empty multipletext return true; }; diff --git a/compendium-frontend/src/survey/SurveyContainerComponent.tsx b/compendium-frontend/src/survey/SurveyContainerComponent.tsx index 3e724a58..8fbfd595 100644 --- a/compendium-frontend/src/survey/SurveyContainerComponent.tsx +++ b/compendium-frontend/src/survey/SurveyContainerComponent.tsx @@ -48,7 +48,7 @@ function oldValidateWebsiteUrl(params) { } } -function validateQuestion(this: { question: ValidationQuestion, row? }, params) { +function validateQuestion(this: { question: ValidationQuestion, row?}, params) { try { const question = this.question; const validator = params[0] || undefined; diff --git a/compendium-frontend/src/survey/api/survey.ts b/compendium-frontend/src/survey/api/survey.ts index 44814d46..e61e6ceb 100644 --- a/compendium-frontend/src/survey/api/survey.ts +++ b/compendium-frontend/src/survey/api/survey.ts @@ -16,7 +16,7 @@ export async function fetchActiveSurveyYear(): Promise<string> { const data = await response.json(); if ('year' in data) { const year = data.year; - return year.toString(); + return year.toString(); } else { console.log('Invalid response format: Failed fetching active survey year.'); return ""; -- GitLab