Fix ESLint errors: escape entities, fix any types, remove unused imports

This commit is contained in:
2026-01-18 01:45:31 +03:00
parent 4c3a70be92
commit 1f6e449041
3 changed files with 35 additions and 25 deletions
+5 -5
View File
@@ -28,8 +28,8 @@ const VerifyHumanScreen: React.FC<VerifyHumanScreenProps> = ({ onVerified }) =>
// Save verification status
try {
await AsyncStorage.setItem(HUMAN_VERIFIED_KEY, 'true');
} catch (error) {
console.error('Failed to save verification:', error);
} catch (_error) {
if (__DEV__) console.error('Failed to save verification:', _error);
}
// Animate and navigate
@@ -84,7 +84,7 @@ const VerifyHumanScreen: React.FC<VerifyHumanScreenProps> = ({ onVerified }) =>
{isChecked && <Text style={styles.checkmark}></Text>}
</View>
<Text style={styles.verificationText}>
I'm not a robot
I&apos;m not a robot
</Text>
</TouchableOpacity>
@@ -252,8 +252,8 @@ export const checkHumanVerification = async (): Promise<boolean> => {
try {
const verified = await AsyncStorage.getItem(HUMAN_VERIFIED_KEY);
return verified === 'true';
} catch (error) {
console.error('Failed to check verification:', error);
} catch (_error) {
if (__DEV__) console.error('Failed to check verification:', _error);
return false;
}
};
+22 -15
View File
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import {
View,
Text,
@@ -11,26 +11,33 @@ import {
Alert,
Platform,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { useNavigation, NavigationProp, ParamListBase } from '@react-navigation/native';
import { LinearGradient } from 'expo-linear-gradient';
import { KurdistanColors } from '../theme/colors';
import { usePezkuwi } from '../contexts/PezkuwiContext';
import { mnemonicGenerate, mnemonicValidate } from '@pezkuwi/util-crypto';
// Alert button type for cross-platform compatibility
interface AlertButton {
text: string;
onPress?: () => void;
style?: 'default' | 'cancel' | 'destructive';
}
// Cross-platform alert helper
const showAlert = (title: string, message: string, buttons?: Array<{text: string; onPress?: () => void; style?: string}>) => {
const showAlert = (title: string, message: string, buttons?: AlertButton[]) => {
if (Platform.OS === 'web') {
window.alert(`${title}\n\n${message}`);
if (buttons?.[0]?.onPress) buttons[0].onPress();
} else {
Alert.alert(title, message, buttons as any);
Alert.alert(title, message, buttons);
}
};
type SetupStep = 'choice' | 'create-show' | 'create-verify' | 'import' | 'wallet-name' | 'success';
const WalletSetupScreen: React.FC = () => {
const navigation = useNavigation<any>();
const navigation = useNavigation<NavigationProp<ParamListBase>>();
const { createWallet, importWallet, connectWallet, isReady } = usePezkuwi();
const [step, setStep] = useState<SetupStep>('choice');
@@ -111,9 +118,9 @@ const WalletSetupScreen: React.FC = () => {
setCreatedAddress(address);
await connectWallet();
setStep('success');
} catch (error: any) {
console.error('[WalletSetup] Create wallet error:', error);
showAlert('Error', error.message || 'Failed to create wallet');
} catch (error: unknown) {
if (__DEV__) console.error('[WalletSetup] Create wallet error:', error);
showAlert('Error', error instanceof Error ? error.message : 'Failed to create wallet');
} finally {
setIsLoading(false);
}
@@ -166,9 +173,9 @@ const WalletSetupScreen: React.FC = () => {
setCreatedAddress(address);
await connectWallet();
setStep('success');
} catch (error: any) {
console.error('[WalletSetup] Import wallet error:', error);
showAlert('Error', error.message || 'Failed to import wallet');
} catch (error: unknown) {
if (__DEV__) console.error('[WalletSetup] Import wallet error:', error);
showAlert('Error', error instanceof Error ? error.message : 'Failed to import wallet');
} finally {
setIsLoading(false);
}
@@ -179,8 +186,8 @@ const WalletSetupScreen: React.FC = () => {
navigation.replace('Wallet');
};
// Go back to previous step
const handleBack = () => {
// Go back to previous step (TODO: add back button UI)
const _handleBack = () => {
switch (step) {
case 'create-show':
case 'import':
@@ -297,7 +304,7 @@ const WalletSetupScreen: React.FC = () => {
onPress={handleMnemonicConfirmed}
testID="wallet-setup-continue-button"
>
<Text style={styles.primaryButtonText}>I've Written It Down</Text>
<Text style={styles.primaryButtonText}>I&apos;ve Written It Down</Text>
</TouchableOpacity>
</View>
);
@@ -306,7 +313,7 @@ const WalletSetupScreen: React.FC = () => {
<View style={styles.stepContainer} testID="wallet-setup-verify-seed">
<Text style={styles.title}>Verify Your Phrase</Text>
<Text style={styles.subtitle}>
Select the correct words to verify you've saved your recovery phrase
Select the correct words to verify you&apos;ve saved your recovery phrase
</Text>
<View style={styles.verificationContainer}>
+8 -5
View File
@@ -14,6 +14,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import { KurdistanColors } from '../theme/colors';
import PrivacyPolicyModal from '../components/PrivacyPolicyModal';
import TermsOfServiceModal from '../components/TermsOfServiceModal';
import kurdistanMapImage from '../../assets/kurdistan-map.png';
interface WelcomeScreenProps {
onContinue?: () => void;
@@ -29,9 +30,11 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
try {
await AsyncStorage.setItem('@pezkuwi/privacy_consent_accepted', 'true');
onContinue && onContinue();
} catch (error) {
if (__DEV__) console.error('Error saving privacy consent:', error);
if (onContinue) {
onContinue();
}
} catch (_error) {
if (__DEV__) console.error('Error saving privacy consent:', _error);
}
};
@@ -52,7 +55,7 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
<View style={styles.header}>
<View style={styles.logoContainer}>
<Image
source={require('../../assets/kurdistan-map.png')}
source={kurdistanMapImage}
style={styles.logoImage}
resizeMode="contain"
/>
@@ -68,7 +71,7 @@ const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onContinue }) => {
</Text>
<Text style={styles.introText}>
Pezkuwi is a pioneering experiment in digital statehood, merging technology with sociology, economy with politics. Starting with the Kurdish digital nation, we are building the world's first territory-independent nation governed by algorithmic sovereignty and social trust rather than borders and bureaucracy.
Pezkuwi is a pioneering experiment in digital statehood, merging technology with sociology, economy with politics. Starting with the Kurdish digital nation, we are building the world&apos;s first territory-independent nation governed by algorithmic sovereignty and social trust rather than borders and bureaucracy.
</Text>
<Text style={styles.introText}>