Files
pwap/mobile/index.ts
T
pezkuwichain 1a47363938 Fix all ESLint errors in mobile app (157 errors -> 0)
Major fixes:
- Replace `any` types with proper TypeScript types across all files
- Convert require() imports to ES module imports
- Add __DEV__ guards to console statements
- Escape special characters in JSX (' and ")
- Fix unused variables (prefix with _ or remove)
- Fix React hooks violations (useCallback, useMemo patterns)
- Convert wasm-crypto-shim.js to TypeScript
- Add eslint-disable comments for valid setState patterns

Files affected: 50+ screens, components, contexts, and services

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 02:55:03 +03:00

62 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// CRITICAL: Import crypto polyfill FIRST before anything else
if (__DEV__) console.warn('🚀 [INDEX] Starting app initialization...');
if (__DEV__) console.warn('📦 [INDEX] Loading react-native-get-random-values...');
import 'react-native-get-random-values';
if (__DEV__) console.warn('✅ [INDEX] react-native-get-random-values loaded');
// React Native polyfills for @pezkuwi packages
if (__DEV__) console.warn('📦 [INDEX] Loading URL polyfill...');
import 'react-native-url-polyfill/auto';
if (__DEV__) console.warn('✅ [INDEX] URL polyfill loaded');
if (__DEV__) console.warn('📦 [INDEX] Setting up Buffer...');
import { Buffer } from 'buffer';
// Global polyfills for Polkadot.js
// @ts-expect-error Global Buffer assignment for polyfill
global.Buffer = Buffer;
if (__DEV__) console.warn('✅ [INDEX] Buffer configured');
// TextEncoder/TextDecoder polyfill
if (__DEV__) console.warn('📦 [INDEX] Setting up TextEncoder/TextDecoder...');
if (typeof global.TextEncoder === 'undefined') {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { TextEncoder, TextDecoder } = require('text-encoding');
// @ts-expect-error Global TextEncoder assignment for polyfill
global.TextEncoder = TextEncoder;
// @ts-expect-error Global TextDecoder assignment for polyfill
global.TextDecoder = TextDecoder;
if (__DEV__) console.warn('✅ [INDEX] TextEncoder/TextDecoder configured');
} else {
if (__DEV__) console.warn('️ [INDEX] TextEncoder/TextDecoder already available');
}
// Filter out known third-party deprecation warnings
const originalWarn = console.warn;
console.warn = (...args: unknown[]) => {
const message = args[0]?.toString() || '';
// Filter react-native-web deprecation warnings
if (message.includes('props.pointerEvents is deprecated')) {
return;
}
// Pass through all other warnings
originalWarn.apply(console, args);
};
if (__DEV__) console.warn('📦 [INDEX] Loading Expo...');
import { registerRootComponent } from 'expo';
if (__DEV__) console.warn('✅ [INDEX] Expo loaded');
if (__DEV__) console.warn('📦 [INDEX] Loading App component...');
import App from './App';
if (__DEV__) console.warn('✅ [INDEX] App component loaded');
if (__DEV__) console.warn('🎯 [INDEX] All imports successful, registering root component...');
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);