From 50a744aea76d09a41c131aecbae9476b50eaf0e5 Mon Sep 17 00:00:00 2001 From: Adrien Young <60076088+adriencyberspace@users.noreply.github.com> Date: Thu, 7 Nov 2024 10:30:53 -0600 Subject: [PATCH] [Our415-317] Resolve all lint warnings (#263) * remove unused imports * eslint-disable on email signup url * remove unused StrapiAPI types * add Options type and eslint-disable on requests line for simplicity --- app/App.tsx | 2 +- app/components/EmailSignup/Emailsignup.tsx | 2 ++ .../search/SearchResults/SearchResult.tsx | 1 - app/components/ui/SiteSearchInput.tsx | 1 - app/hooks/StrapiAPI.ts | 19 ------------------- .../SearchResultsPage/SearchResultsPage.tsx | 1 - test/helpers/createSearchClient.ts | 8 +++++++- 7 files changed, 10 insertions(+), 24 deletions(-) diff --git a/app/App.tsx b/app/App.tsx index 33db276fe..c028a6042 100644 --- a/app/App.tsx +++ b/app/App.tsx @@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react"; // https://support.google.com/analytics/answer/12938611#zippy=%2Cin-this-article import ReactGA_4 from "react-ga4"; import { Helmet } from "react-helmet-async"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useLocation } from "react-router-dom"; import { GeoCoordinates, getLocation, diff --git a/app/components/EmailSignup/Emailsignup.tsx b/app/components/EmailSignup/Emailsignup.tsx index 494943fa2..2d9947299 100644 --- a/app/components/EmailSignup/Emailsignup.tsx +++ b/app/components/EmailSignup/Emailsignup.tsx @@ -1,3 +1,5 @@ +/* eslint-disable no-script-url */ + import React from "react"; import styles from "./EmailSignup.module.scss"; import { Button } from "components/ui/inline/Button/Button"; diff --git a/app/components/search/SearchResults/SearchResult.tsx b/app/components/search/SearchResults/SearchResult.tsx index a585daac5..91cdf17a9 100644 --- a/app/components/search/SearchResults/SearchResult.tsx +++ b/app/components/search/SearchResults/SearchResult.tsx @@ -2,7 +2,6 @@ import React, { forwardRef } from "react"; import { TransformedSearchHit } from "models"; import { Link } from "react-router-dom"; import { LabelTag } from "components/ui/LabelTag"; -import { Tooltip } from "react-tippy"; import { formatPhoneNumber, renderAddressMetadata } from "utils"; import { removeAsterisksAndHashes } from "utils/strings"; import ReactMarkdown from "react-markdown"; diff --git a/app/components/ui/SiteSearchInput.tsx b/app/components/ui/SiteSearchInput.tsx index 1f687d1a5..61d412b8e 100644 --- a/app/components/ui/SiteSearchInput.tsx +++ b/app/components/ui/SiteSearchInput.tsx @@ -1,5 +1,4 @@ import React, { FormEvent, useEffect, useState } from "react"; -import cn from "classnames"; import { useClearRefinements, useSearchBox } from "react-instantsearch"; import styles from "./SiteSearchInput.module.scss"; import { useNavigate } from "react-router-dom"; diff --git a/app/hooks/StrapiAPI.ts b/app/hooks/StrapiAPI.ts index 4d3825fb8..e57281a5a 100644 --- a/app/hooks/StrapiAPI.ts +++ b/app/hooks/StrapiAPI.ts @@ -120,10 +120,6 @@ interface BaseDatumAttributesResponse { publishedAt?: string; } -interface CategoryResponse extends BaseDatumAttributesResponse { - label: string; -} - export interface LinkResponse { id: number; url: string; @@ -202,21 +198,6 @@ export interface ContentBlockResponse { link: LinkResponse; } -// this corresponds to the "Address" component in Strapi -interface AddressResponse { - id: number; - street: string; - zipcode: string; - geolocation: { - address: string; - geohash: string; - coordinates: { - lat: number; - lng: number; - }; - } | null; -} - export interface FaqItem { question: string; answer: string; diff --git a/app/pages/SearchResultsPage/SearchResultsPage.tsx b/app/pages/SearchResultsPage/SearchResultsPage.tsx index 8cdd087e0..8e767e2e9 100644 --- a/app/pages/SearchResultsPage/SearchResultsPage.tsx +++ b/app/pages/SearchResultsPage/SearchResultsPage.tsx @@ -1,7 +1,6 @@ import React, { useState } from "react"; import SearchResults from "components/search/SearchResults/SearchResults"; import Sidebar from "components/search/Sidebar/Sidebar"; -import { Header } from "components/search/Header/Header"; import styles from "./SearchResultsPage.module.scss"; import { DEFAULT_AROUND_PRECISION, useAppContext } from "utils"; import { Configure } from "react-instantsearch-core"; diff --git a/test/helpers/createSearchClient.ts b/test/helpers/createSearchClient.ts index 9b2433ba0..dfd6fecd2 100644 --- a/test/helpers/createSearchClient.ts +++ b/test/helpers/createSearchClient.ts @@ -1,5 +1,10 @@ +interface SearchClientFacets { + categories: { + [category: string]: number; + }; +} interface Options { - [key: string]: any; + facets: SearchClientFacets; } /** @@ -32,6 +37,7 @@ interface Options { */ export function createSearchClient(options: Options) { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any search: (requests: any) => Promise.resolve({ results: requests.map(() => ({