From 0e99cb9259c2a9299e53d264ed153ae20f0e9184 Mon Sep 17 00:00:00 2001 From: Brandon Domen Date: Fri, 4 Aug 2023 17:13:27 +0000 Subject: [PATCH] fixing linting --- .../reporting-ui/library/reporting_client/memoize.ts | 9 +++++---- .../reporting-ui/library/reporting_client/real_api.ts | 4 ++-- .../src/main/react/reporting-ui/src/index.tsx | 7 ++++--- .../src/main/react/reporting-ui/src/report_web_vitals.ts | 1 + .../src/test/react/reporting-ui/app.test.tsx | 2 +- .../src/test/react/reporting-ui/fake/src/fake_api.ts | 5 ++--- .../src/test/react/reporting-ui/fake/src/index.tsx | 6 +++--- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/memoize.ts b/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/memoize.ts index f34a0ae57d7..408094359de 100644 --- a/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/memoize.ts +++ b/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/memoize.ts @@ -14,16 +14,17 @@ // Return a function that is wrapped with the memoization logic export class Memoizer { + /* eslint-disable @typescript-eslint/no-explicit-any */ cache: Map = new Map(); memoizePromiseFn = fn => { return (...args) => { const key = JSON.stringify(args); - + if (this.cache.has(key)) { return this.cache.get(key); } - + this.cache.set( key, fn(...args).catch(error => { @@ -32,8 +33,8 @@ export class Memoizer { return Promise.reject(error); }) ); - + return this.cache.get(key); }; }; -}; +} diff --git a/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/real_api.ts b/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/real_api.ts index 470692b26c7..dc2e9ac8d7d 100644 --- a/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/real_api.ts +++ b/experimental/reporting-ui/src/main/react/reporting-ui/library/reporting_client/real_api.ts @@ -33,7 +33,7 @@ export class RealApi implements ReportingClient { const reports = await res.json(); const response = Object.freeze({ reports, - }) + }); return response; } @@ -42,7 +42,7 @@ export class RealApi implements ReportingClient { const report = await res.json(); const response = Object.freeze({ report, - }) + }); return response; } } diff --git a/experimental/reporting-ui/src/main/react/reporting-ui/src/index.tsx b/experimental/reporting-ui/src/main/react/reporting-ui/src/index.tsx index b52a2f423eb..b6185a26efa 100644 --- a/experimental/reporting-ui/src/main/react/reporting-ui/src/index.tsx +++ b/experimental/reporting-ui/src/main/react/reporting-ui/src/index.tsx @@ -18,11 +18,12 @@ import './index.css'; import App from './app'; import reportWebVitals from './report_web_vitals'; import AppConfig from '../library/initialize'; -import { RealApi } from '../library/reporting_client/real_api'; +import {RealApi} from '../library/reporting_client/real_api'; const configProps = { - reportingApi: new RealApi({endpoint: new URL('http://localhost:3000')}) -} + // eslint-disable-next-line node/no-unsupported-features/node-builtins + reportingApi: new RealApi({endpoint: new URL('http://localhost:3000')}), +}; AppConfig.initialize(configProps); diff --git a/experimental/reporting-ui/src/main/react/reporting-ui/src/report_web_vitals.ts b/experimental/reporting-ui/src/main/react/reporting-ui/src/report_web_vitals.ts index 0a00a166dc7..3b815ab5bbc 100644 --- a/experimental/reporting-ui/src/main/react/reporting-ui/src/report_web_vitals.ts +++ b/experimental/reporting-ui/src/main/react/reporting-ui/src/report_web_vitals.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +/* eslint-disable @typescript-eslint/no-explicit-any */ const reportWebVitals = (onPerfEntry: any) => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({getCLS, getFID, getFCP, getLCP, getTTFB}) => { diff --git a/experimental/reporting-ui/src/test/react/reporting-ui/app.test.tsx b/experimental/reporting-ui/src/test/react/reporting-ui/app.test.tsx index 93e2a68bf3d..7efbe909097 100644 --- a/experimental/reporting-ui/src/test/react/reporting-ui/app.test.tsx +++ b/experimental/reporting-ui/src/test/react/reporting-ui/app.test.tsx @@ -14,7 +14,7 @@ import '@testing-library/jest-dom'; import '@testing-library/jest-dom/extend-expect'; -import { render, screen } from '@testing-library/react'; +import {render, screen} from '@testing-library/react'; import React from 'react'; import App from '../../../main/react/reporting-ui/src/app'; diff --git a/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/fake_api.ts b/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/fake_api.ts index e5fc8c69c22..a6f2cd0f12a 100644 --- a/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/fake_api.ts +++ b/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/fake_api.ts @@ -15,12 +15,11 @@ import { GetReportRequest, GetReportResponse, - InitApiProps, ListReportsResponse, Report, UniqueReach, } from '../../../../../main/react/reporting-ui/library/reporting_client/models'; -import { ReportingClient } from '../../../../../main/react/reporting-ui/library/reporting_client/reporting_client'; +import {ReportingClient} from '../../../../../main/react/reporting-ui/library/reporting_client/reporting_client'; function regenerateTimeData() { const chartData: UniqueReach[] = []; @@ -297,7 +296,7 @@ export class FakeApi implements ReportingClient { } listReports(): Promise { - const response = Object.freeze({reports: this.reports}) + const response = Object.freeze({reports: this.reports}); return Promise.resolve(response); } diff --git a/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/index.tsx b/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/index.tsx index 7d29054dd2f..94a1f9caf2f 100644 --- a/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/index.tsx +++ b/experimental/reporting-ui/src/test/react/reporting-ui/fake/src/index.tsx @@ -17,11 +17,11 @@ import ReactDOM from 'react-dom/client'; import '../../../../../main/react/reporting-ui/src/index.css'; import App from '../../../../../main/react/reporting-ui/src/app'; import AppConfig from '../../../../../main/react/reporting-ui/library/initialize'; -import { FakeApi } from './fake_api'; +import {FakeApi} from './fake_api'; const configProps = { - reportingApi: new FakeApi() -} + reportingApi: new FakeApi(), +}; AppConfig.initialize(configProps);