From 0d75473f02cad4bf02a95f3195a926d32ef8ec16 Mon Sep 17 00:00:00 2001 From: Ken-ichi Date: Wed, 7 Aug 2024 17:25:46 -0700 Subject: [PATCH] Tried to clear out some eslint warnings (#1937) --- .gitguardian.yml | 2 +- src/components/Camera/AICamera/AICamera.js | 2 +- .../Explore/Modals/ExploreLocationSearchModal.tsx | 2 +- .../Explore/Modals/ExploreProjectSearchModal.tsx | 2 +- .../Explore/Modals/ExploreUserSearchModal.tsx | 2 +- src/components/Explore/Modals/FilterModal.tsx | 11 ++++++----- .../SharedComponents/Buttons/CloseButton.tsx | 3 +-- src/components/SharedComponents/SearchBar.tsx | 4 ++-- src/types/declarations.d.ts | 10 +++++++++- 9 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.gitguardian.yml b/.gitguardian.yml index 96bf04942..16c32a158 100644 --- a/.gitguardian.yml +++ b/.gitguardian.yml @@ -1,7 +1,7 @@ version: 2 secret: # Exclude files and paths by globbing - ignored-paths: + ignored_paths: - '**/README.md' - 'node_modules/*' - 'package-lock.json' diff --git a/src/components/Camera/AICamera/AICamera.js b/src/components/Camera/AICamera/AICamera.js index 5c8556249..3cfbb54ac 100644 --- a/src/components/Camera/AICamera/AICamera.js +++ b/src/components/Camera/AICamera/AICamera.js @@ -42,7 +42,7 @@ type Props = { camera: Object, device: Object, flipCamera: Function, - handleCheckmarkPress: ( _result: any | null ) => void, + handleCheckmarkPress: Function, isLandscapeMode: boolean }; diff --git a/src/components/Explore/Modals/ExploreLocationSearchModal.tsx b/src/components/Explore/Modals/ExploreLocationSearchModal.tsx index e6bdffeda..07ff8dea5 100644 --- a/src/components/Explore/Modals/ExploreLocationSearchModal.tsx +++ b/src/components/Explore/Modals/ExploreLocationSearchModal.tsx @@ -6,7 +6,7 @@ interface Props { showModal: boolean; closeModal: () => void; // TODO: Param not typed yet, because ExploreLocationSearch is not typed yet - updateLocation: ( _location: any ) => void; + updateLocation: ( location: "worldwide" | { name: string } ) => void; } const ExploreLocationSearchModal = ( { diff --git a/src/components/Explore/Modals/ExploreProjectSearchModal.tsx b/src/components/Explore/Modals/ExploreProjectSearchModal.tsx index b5aaf93c4..80b4c8fdc 100644 --- a/src/components/Explore/Modals/ExploreProjectSearchModal.tsx +++ b/src/components/Explore/Modals/ExploreProjectSearchModal.tsx @@ -6,7 +6,7 @@ interface Props { showModal: boolean; closeModal: () => void; // TODO: Param not typed yet, because ExploreProjectSearch is not typed yet - updateProject: ( _project: any ) => void; + updateProject: ( project: null | { title: string } ) => void; } const ExploreProjectSearchModal = ( { diff --git a/src/components/Explore/Modals/ExploreUserSearchModal.tsx b/src/components/Explore/Modals/ExploreUserSearchModal.tsx index 1d2b3e991..ee315eff8 100644 --- a/src/components/Explore/Modals/ExploreUserSearchModal.tsx +++ b/src/components/Explore/Modals/ExploreUserSearchModal.tsx @@ -6,7 +6,7 @@ interface Props { showModal: boolean; closeModal: () => void; // TODO: Param not typed yet, because ExploreUserSearch is not typed yet - updateUser: ( _user: any ) => void; + updateUser: ( user: null | { login: string } ) => void; } const ExploreUserSearchModal = ( { diff --git a/src/components/Explore/Modals/FilterModal.tsx b/src/components/Explore/Modals/FilterModal.tsx index 80afcda6b..4a9eb100a 100644 --- a/src/components/Explore/Modals/FilterModal.tsx +++ b/src/components/Explore/Modals/FilterModal.tsx @@ -50,7 +50,7 @@ import ExploreProjectSearchModal from "./ExploreProjectSearchModal"; import ExploreTaxonSearchModal from "./ExploreTaxonSearchModal"; import ExploreUserSearchModal from "./ExploreUserSearchModal"; -const DROP_SHADOW = getShadowForColor( colors.darkGray, { +const DROP_SHADOW = getShadowForColor( colors?.darkGray, { offsetHeight: 4, elevation: 6 } ); @@ -60,13 +60,14 @@ const { useRealm } = RealmContext; interface Props { closeModal: () => void; filterByIconicTaxonUnknown: () => void; - updateTaxon: ( _taxon: Object | null ) => void; + // TODO: type this properly when taxon has a type + updateTaxon: ( taxon: null | { name: string } ) => void; // TODO: Param not typed yet, because ExploreLocationSearch is not typed yet - updateLocation: ( _location: any ) => void; + updateLocation: ( location: "worldwide" | { name: string } ) => void; // TODO: Param not typed yet, because ExploreUserSearch is not typed yet - updateUser: ( _user: any ) => void; + updateUser: ( user: null | { login: string } ) => void; // TODO: Param not typed yet, because ExploreProjectSearch is not typed yet - updateProject: ( _project: any ) => void; + updateProject: ( project: null | { title: string } ) => void; } const FilterModal = ( { diff --git a/src/components/SharedComponents/Buttons/CloseButton.tsx b/src/components/SharedComponents/Buttons/CloseButton.tsx index 755c9bcb0..a8c077ef3 100644 --- a/src/components/SharedComponents/Buttons/CloseButton.tsx +++ b/src/components/SharedComponents/Buttons/CloseButton.tsx @@ -5,8 +5,7 @@ import React from "react"; import { useTheme } from "react-native-paper"; interface Props { - // TODO: navigation type - handleClose?: ( _navigation: any ) => void; + handleClose?: ( ) => void; black?: boolean; buttonClassName?: string; size?: number; diff --git a/src/components/SharedComponents/SearchBar.tsx b/src/components/SharedComponents/SearchBar.tsx index 9fa10642b..ca058a79c 100644 --- a/src/components/SharedComponents/SearchBar.tsx +++ b/src/components/SharedComponents/SearchBar.tsx @@ -3,6 +3,7 @@ import classNames from "classnames"; import { INatIcon, INatIconButton } from "components/SharedComponents"; import { View } from "components/styledComponents"; import React from "react"; +import { TextInput as RNTextInput } from "react-native"; import { TextInput, useTheme } from "react-native-paper"; import { useTranslation } from "sharedHooks"; import { getShadowForColor } from "styles/global"; @@ -16,8 +17,7 @@ interface Props { containerClass?: string; handleTextChange: ( _text: string ) => void; hasShadow?: boolean; - // TODO: check react-native-paper docs for correct type - input?: any, + input?: React.RefObject, placeholder?: string; testID?: string; value: string; diff --git a/src/types/declarations.d.ts b/src/types/declarations.d.ts index 3b6d7657f..586cabca5 100644 --- a/src/types/declarations.d.ts +++ b/src/types/declarations.d.ts @@ -1,6 +1,7 @@ +import { RootStackParamList } from "@react-navigation/native"; + // Using typescript with react-native-svg-transformer // from https://www.npmjs.com/package/react-native-svg-transformer?activeTab - declare module "*.svg" { import React from "react"; import { SvgProps } from "react-native-svg"; @@ -8,3 +9,10 @@ declare module "*.svg" { const content: React.FC; export default content; } + +declare global { + namespace ReactNavigation { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface RootParamList extends RootStackParamList {} + } +}