mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 15:18:18 -05:00
fix lint issues (#1208)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -68,7 +68,7 @@ const _getSecurely = async function <T>(
|
||||
const _getWithBiometrics = async function <T>(
|
||||
fn: () => Promise<string | false>,
|
||||
formatter: (dataString: string) => T,
|
||||
options: GetSecureOptions,
|
||||
_options: GetSecureOptions,
|
||||
): Promise<SignedPayload<T> | null> {
|
||||
try {
|
||||
const simpleCheck = await biometrics.simplePrompt({
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -79,7 +79,7 @@ const ConfirmBelongingScreen: React.FC<ConfirmBelongingScreenProps> = () => {
|
||||
};
|
||||
}
|
||||
setDocumentMetadata(metadata);
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
// setting defaults on error
|
||||
setDocumentMetadata({
|
||||
documentCategory: 'passport',
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<LoadingScreenProps> = ({ route }) => {
|
||||
|
||||
// Get document metadata from navigation params
|
||||
const {
|
||||
documentCategory,
|
||||
signatureAlgorithm: paramSignatureAlgorithm,
|
||||
curveOrExponent: paramCurveOrExponent,
|
||||
} = route?.params || {};
|
||||
@@ -84,7 +77,6 @@ const LoadingScreen: React.FC<LoadingScreenProps> = ({ 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<LoadingScreenProps> = ({ 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<LoadingScreenProps> = ({ 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<LoadingScreenProps> = ({ route }) => {
|
||||
);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function checkBiometricsAvailable(): Promise<boolean> {
|
||||
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<boolean> {
|
||||
// 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<SECURITY_LEVEL> {
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user