mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 07:57:55 +00:00
fix(mobile): resolve all 46 remaining ESLint issues - 100% clean
Fixed all remaining ESLint errors and warnings to achieve perfect code quality: ✅ Category 1: Unused Variables/Imports (8 errors fixed) - Removed unused useState, useEffect from ReferralScreen - Removed unused proposalHash from GovernanceScreen - Removed unused unlock from LockScreen - Removed unused error variables from catch blocks - Prefixed unused function parameters with underscore - Cleaned up 12 additional unused imports (Pressable, FlatList, Image, Badge, Skeleton) ✅ Category 2: Unescaped JSX Entities (3 errors fixed) - BeCitizenScreen.tsx: Escaped apostrophes in "Father's Name", "Mother's Name" - SecurityScreen.tsx: Escaped apostrophe in "device's secure" ✅ Category 3: TypeScript Any Types (14 errors fixed) - Replaced all `any` types with proper types: - `error: any` → `error: unknown` in all catch blocks - Added proper type guards for error handling - `thread: any` → `thread: Record<string, unknown>` - Removed unnecessary `as any` type assertions - Properly typed blockchain query results ✅ Category 4: React Hooks Issues (9 errors fixed) - Wrapped functions in useCallback for proper dependency tracking: - handleBiometricAuth in LockScreen - fetchNFTs in NFTGalleryScreen - fetchOffers in P2PScreen - fetchProposals in GovernanceScreen - fetchStakingData in StakingScreen - Fixed LoadingSkeleton refs access by using useState instead of useRef - Added proper eslint-disable comments for initialization patterns Files Modified: 15 screens, 2 contexts, 1 component Final Status: ✅ npm run lint: 0 errors, 0 warnings ✅ 100% ESLint compliance ✅ Production-ready code quality
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
View,
|
||||
Text,
|
||||
StyleSheet,
|
||||
Image,
|
||||
Pressable,
|
||||
Alert,
|
||||
} from 'react-native';
|
||||
@@ -25,27 +24,26 @@ export default function LockScreen() {
|
||||
biometricType,
|
||||
authenticate,
|
||||
verifyPinCode,
|
||||
unlock,
|
||||
} = useBiometricAuth();
|
||||
|
||||
const [showPinInput, setShowPinInput] = useState(false);
|
||||
const [pin, setPin] = useState('');
|
||||
const [verifying, setVerifying] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Auto-trigger biometric on mount if enabled
|
||||
if (isBiometricEnabled && isBiometricSupported && isBiometricEnrolled) {
|
||||
handleBiometricAuth();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleBiometricAuth = async () => {
|
||||
const handleBiometricAuth = React.useCallback(async () => {
|
||||
const success = await authenticate();
|
||||
if (!success) {
|
||||
// Biometric failed, show PIN option
|
||||
setShowPinInput(true);
|
||||
}
|
||||
};
|
||||
}, [authenticate]);
|
||||
|
||||
useEffect(() => {
|
||||
// Auto-trigger biometric on mount if enabled
|
||||
if (isBiometricEnabled && isBiometricSupported && isBiometricEnrolled) {
|
||||
handleBiometricAuth();
|
||||
}
|
||||
}, [isBiometricEnabled, isBiometricSupported, isBiometricEnrolled, handleBiometricAuth]);
|
||||
|
||||
const handlePinSubmit = async () => {
|
||||
if (!pin || pin.length < 4) {
|
||||
@@ -61,7 +59,7 @@ export default function LockScreen() {
|
||||
Alert.alert('Error', 'Incorrect PIN. Please try again.');
|
||||
setPin('');
|
||||
}
|
||||
} catch (_error) {
|
||||
} catch {
|
||||
Alert.alert('Error', 'Failed to verify PIN');
|
||||
} finally {
|
||||
setVerifying(false);
|
||||
|
||||
Reference in New Issue
Block a user