From efacb8db9467eaede24369f6a842e114cccc3934 Mon Sep 17 00:00:00 2001 From: Justin Hernandez Date: Sat, 4 Oct 2025 09:20:21 -0700 Subject: [PATCH] fix lint issues (#1208) --- app/src/components/loading/LoadingUI.tsx | 2 -- app/src/providers/authProvider.tsx | 2 +- app/src/screens/dev/DevLoadingScreen.tsx | 2 +- .../document/ConfirmBelongingScreen.tsx | 2 +- .../screens/document/CountryPickerScreen.tsx | 6 ++-- .../document/DocumentNFCScanScreen.tsx | 2 -- app/src/screens/system/Loading.tsx | 29 ++++++++++--------- app/src/utils/keychainSecurity.ts | 6 ++-- app/src/utils/nfcScanner.ts | 1 - app/tests/utils/nfcScanner.test.ts | 5 ---- 10 files changed, 24 insertions(+), 33 deletions(-) diff --git a/app/src/components/loading/LoadingUI.tsx b/app/src/components/loading/LoadingUI.tsx index 7e79cab75..5df1f2485 100644 --- a/app/src/components/loading/LoadingUI.tsx +++ b/app/src/components/loading/LoadingUI.tsx @@ -11,9 +11,7 @@ import CloseWarningIcon from '@/images/icons/close-warning.svg'; import Plus from '@/images/icons/plus_slate600.svg'; import { black, - blue600, cyan300, - red500, slate400, slate600, white, diff --git a/app/src/providers/authProvider.tsx b/app/src/providers/authProvider.tsx index 72842e7c0..084031f1c 100644 --- a/app/src/providers/authProvider.tsx +++ b/app/src/providers/authProvider.tsx @@ -68,7 +68,7 @@ const _getSecurely = async function ( const _getWithBiometrics = async function ( fn: () => Promise, formatter: (dataString: string) => T, - options: GetSecureOptions, + _options: GetSecureOptions, ): Promise | null> { try { const simpleCheck = await biometrics.simplePrompt({ diff --git a/app/src/screens/dev/DevLoadingScreen.tsx b/app/src/screens/dev/DevLoadingScreen.tsx index 4b18f43e9..08ba959e9 100644 --- a/app/src/screens/dev/DevLoadingScreen.tsx +++ b/app/src/screens/dev/DevLoadingScreen.tsx @@ -99,7 +99,7 @@ const DevLoadingScreen: React.FC = () => { } setCanCloseApp(safeToCloseStates.includes(currentState)); setShouldLoopAnimation(!terminalStates.includes(currentState)); - }, [currentState, documentType]); + }, [currentState, documentType, safeToCloseStates, terminalStates]); const [open, setOpen] = useState(false); const [documentTypeOpen, setDocumentTypeOpen] = useState(false); diff --git a/app/src/screens/document/ConfirmBelongingScreen.tsx b/app/src/screens/document/ConfirmBelongingScreen.tsx index 74e48f873..8a480a8ab 100644 --- a/app/src/screens/document/ConfirmBelongingScreen.tsx +++ b/app/src/screens/document/ConfirmBelongingScreen.tsx @@ -79,7 +79,7 @@ const ConfirmBelongingScreen: React.FC = () => { }; } setDocumentMetadata(metadata); - } catch (error) { + } catch (_error) { // setting defaults on error setDocumentMetadata({ documentCategory: 'passport', diff --git a/app/src/screens/document/CountryPickerScreen.tsx b/app/src/screens/document/CountryPickerScreen.tsx index 10b071565..2fd010126 100644 --- a/app/src/screens/document/CountryPickerScreen.tsx +++ b/app/src/screens/document/CountryPickerScreen.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. -import countries from 'i18n-iso-countries'; +import { alpha2ToAlpha3 } from 'i18n-iso-countries'; import { memo, useCallback, useEffect, useMemo, useState } from 'react'; import { FlatList, TouchableOpacity, View } from 'react-native'; import { Spinner, XStack, YStack } from 'tamagui'; @@ -16,7 +16,7 @@ import { RoundFlag } from '@/components/flag/RoundFlag'; import { DocumentFlowNavBar } from '@/components/NavBar/DocumentFlowNavBar'; import { BodyText } from '@/components/typography/BodyText'; import type { RootStackParamList } from '@/navigation'; -import { black, slate100, slate300, slate500 } from '@/utils/colors'; +import { black, slate100, slate500 } from '@/utils/colors'; import { advercase, dinot } from '@/utils/fonts'; import { buttonTap } from '@/utils/haptic'; import { getCountry } from '@/utils/locale'; @@ -131,7 +131,7 @@ const CountryPickerScreen: React.FC = () => { try { const countryCode2Letter = getCountry(); // Returns 2-letter code like "US" if (countryCode2Letter) { - const countryCode3Letter = countries.alpha2ToAlpha3(countryCode2Letter); + const countryCode3Letter = alpha2ToAlpha3(countryCode2Letter); if ( countryCode3Letter && commonNames[countryCode3Letter as keyof typeof commonNames] diff --git a/app/src/screens/document/DocumentNFCScanScreen.tsx b/app/src/screens/document/DocumentNFCScanScreen.tsx index 21af6beaf..f6dfe491a 100644 --- a/app/src/screens/document/DocumentNFCScanScreen.tsx +++ b/app/src/screens/document/DocumentNFCScanScreen.tsx @@ -31,8 +31,6 @@ import { import { CircleHelp } from '@tamagui/lucide-icons'; import type { PassportData } from '@selfxyz/common/types'; -import { getSKIPEM } from '@selfxyz/common/utils/csca'; -import { initPassportDataParsing } from '@selfxyz/common/utils/passports'; import { hasAnyValidRegisteredDocument, useSelfClient, diff --git a/app/src/screens/system/Loading.tsx b/app/src/screens/system/Loading.tsx index 6af902454..803a7145b 100644 --- a/app/src/screens/system/Loading.tsx +++ b/app/src/screens/system/Loading.tsx @@ -3,26 +3,20 @@ // NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. import LottieView from 'lottie-react-native'; -import React, { useEffect, useState } from 'react'; -import { StyleSheet, View } from 'react-native'; -import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import { Text, YStack } from 'tamagui'; +import { useCallback, useEffect, useState } from 'react'; +import { StyleSheet } from 'react-native'; import type { StaticScreenProps } from '@react-navigation/native'; import { useFocusEffect, useIsFocused } from '@react-navigation/native'; import type { DocumentCategory } from '@selfxyz/common/utils/types'; -import { IDDocument } from '@selfxyz/common/utils/types'; import { loadSelectedDocument, useSelfClient } from '@selfxyz/mobile-sdk-alpha'; import { ProvingStateType } from '@selfxyz/mobile-sdk-alpha/browser'; import failAnimation from '@/assets/animations/loading/fail.json'; import proveLoadingAnimation from '@/assets/animations/loading/prove.json'; import LoadingUI from '@/components/loading/LoadingUI'; -import CloseWarningIcon from '@/images/icons/close-warning.svg'; -import { loadPassportDataAndSecret } from '@/providers/passportDataProvider'; import { useSettingStore } from '@/stores/settingStore'; -import { black, slate400, white, zinc500, zinc900 } from '@/utils/colors'; -import { extraYPadding } from '@/utils/constants'; +import { black, slate400, white, zinc900 } from '@/utils/colors'; import { advercase, dinot } from '@/utils/fonts'; import { loadingScreenProgress } from '@/utils/haptic'; import { setupNotifications } from '@/utils/notifications/notificationService'; @@ -71,7 +65,6 @@ const LoadingScreen: React.FC = ({ route }) => { // Get document metadata from navigation params const { - documentCategory, signatureAlgorithm: paramSignatureAlgorithm, curveOrExponent: paramCurveOrExponent, } = route?.params || {}; @@ -84,7 +77,6 @@ const LoadingScreen: React.FC = ({ route }) => { const init = useProvingStore(state => state.init); const circuitType = useProvingStore(state => state.circuitType); const isFocused = useIsFocused(); - const { bottom } = useSafeAreaInsets(); // States where it's safe to close the app const safeToCloseStates = ['proving', 'post_proving', 'completed']; @@ -106,7 +98,7 @@ const LoadingScreen: React.FC = ({ route }) => { } else { await init(selfClient, 'dsc', true); } - } catch (error) { + } catch (_error) { console.error('Error loading selected document:'); await init(selfClient, 'dsc', true); } finally { @@ -186,11 +178,19 @@ const LoadingScreen: React.FC = ({ route }) => { setAnimationSource(proveLoadingAnimation); break; } - }, [currentState, fcmToken, isInitializing]); + }, [ + currentState, + fcmToken, + isInitializing, + circuitType, + paramCurveOrExponent, + paramSignatureAlgorithm, + isFocused, + ]); // Handle haptic feedback using useFocusEffect for immediate response useFocusEffect( - React.useCallback(() => { + useCallback(() => { // Start haptic feedback as soon as the screen is focused loadingScreenProgress(true); @@ -219,6 +219,7 @@ const LoadingScreen: React.FC = ({ route }) => { ); }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars const styles = StyleSheet.create({ container: { flex: 1, diff --git a/app/src/utils/keychainSecurity.ts b/app/src/utils/keychainSecurity.ts index 701ccf0f3..39978bb50 100644 --- a/app/src/utils/keychainSecurity.ts +++ b/app/src/utils/keychainSecurity.ts @@ -45,7 +45,7 @@ export async function checkBiometricsAvailable(): Promise { const rnBiometrics = new ReactNativeBiometrics(); const { available } = await rnBiometrics.isSensorAvailable(); return available; - } catch (error) { + } catch (_error) { console.log('Biometrics not available'); return false; } @@ -64,7 +64,7 @@ export async function checkPasscodeAvailable(): Promise { // Clean up test entry await Keychain.resetGenericPassword({ service: testService }); return true; - } catch (error) { + } catch (_error) { console.log('Device passcode not available'); return false; } @@ -187,7 +187,7 @@ export async function getMaxSecurityLevel(): Promise { // Try to get the device's security level const securityLevel = await Keychain.getSecurityLevel(); return securityLevel || Keychain.SECURITY_LEVEL.ANY; - } catch (error) { + } catch (_error) { console.log('Could not determine security level, defaulting to ANY'); return Keychain.SECURITY_LEVEL.ANY; } diff --git a/app/src/utils/nfcScanner.ts b/app/src/utils/nfcScanner.ts index 0ece35034..d89a08e3f 100644 --- a/app/src/utils/nfcScanner.ts +++ b/app/src/utils/nfcScanner.ts @@ -9,7 +9,6 @@ import type { PassportData } from '@selfxyz/common/types'; import type { NFCScanContext } from '@selfxyz/mobile-sdk-alpha'; import { logNFCEvent } from '@/Sentry'; -import { configureNfcAnalytics } from '@/utils/analytics'; import { PassportReader, reset, diff --git a/app/tests/utils/nfcScanner.test.ts b/app/tests/utils/nfcScanner.test.ts index 244fb173c..faaa317c5 100644 --- a/app/tests/utils/nfcScanner.test.ts +++ b/app/tests/utils/nfcScanner.test.ts @@ -259,11 +259,6 @@ describe('scan', () => { dataGroupHashes: JSON.stringify({}), }); - const mockConfigureNfcAnalytics = - configureNfcAnalytics as jest.MockedFunction< - typeof configureNfcAnalytics - >; - (PassportReader as any).scanPassport = mockScanPassport; await scan(mockInputs);