Skip to content

Commit 12aff53

Browse files
authored
chore(app): resolve lint warnings (#990)
* chore(app): resolve lint warnings * update lock * clean up any types * fix types * feedback from cr
1 parent dc9804f commit 12aff53

26 files changed

+332
-4501
lines changed

app/src/RemoteConfig.shared.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ export interface LocalOverride {
1919
}
2020

2121
export interface RemoteConfigBackend {
22-
getValue(key: string): {
23-
asBoolean(): boolean;
24-
asNumber(): number;
25-
asString(): string;
26-
getSource(): string;
27-
};
28-
getAll(): Record<string, any>;
29-
setDefaults(defaults: Record<string, any>): Promise<void> | void;
30-
setConfigSettings(settings: any): Promise<void> | void;
22+
getValue(key: string): RemoteConfigValue;
23+
getAll(): Record<string, RemoteConfigValue>;
24+
setDefaults(defaults: Record<string, FeatureFlagValue>): Promise<void> | void;
25+
setConfigSettings(settings: Record<string, unknown>): Promise<void> | void;
3126
fetchAndActivate(): Promise<boolean>;
3227
}
3328

29+
export interface RemoteConfigValue {
30+
asBoolean(): boolean;
31+
asNumber(): number;
32+
asString(): string;
33+
getSource(): string;
34+
}
35+
3436
export interface StorageBackend {
3537
getItem(key: string): Promise<string | null>;
3638
setItem(key: string, value: string): Promise<void>;

app/src/RemoteConfig.web.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import type {
99
FeatureFlagValue,
1010
RemoteConfigBackend,
11+
RemoteConfigValue,
1112
StorageBackend,
1213
} from '@/RemoteConfig.shared';
1314
import {
@@ -37,10 +38,10 @@ const webStorageBackend: StorageBackend = {
3738
// Mock Firebase Remote Config for web (since Firebase Web SDK for Remote Config is not installed)
3839
// In a real implementation, you would import and use the Firebase Web SDK
3940
class MockFirebaseRemoteConfig implements RemoteConfigBackend {
40-
private config: Record<string, unknown> = {};
41+
private config: Record<string, FeatureFlagValue> = {};
4142
private settings: Record<string, unknown> = {};
4243

43-
setDefaults(defaults: Record<string, unknown>) {
44+
setDefaults(defaults: Record<string, FeatureFlagValue>) {
4445
this.config = { ...defaults };
4546
}
4647

@@ -80,8 +81,12 @@ class MockFirebaseRemoteConfig implements RemoteConfigBackend {
8081
};
8182
}
8283

83-
getAll() {
84-
return this.config;
84+
getAll(): Record<string, RemoteConfigValue> {
85+
const result: Record<string, RemoteConfigValue> = {};
86+
for (const [key, value] of Object.entries(this.config)) {
87+
result[key] = this.getValue(key);
88+
}
89+
return result;
8590
}
8691
}
8792

app/src/Sentry.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
export const captureException = (
1717
error: Error,
18-
context?: Record<string, any>,
18+
context?: Record<string, unknown>,
1919
) => {
2020
if (isSentryDisabled) {
2121
return;
@@ -27,7 +27,7 @@ export const captureException = (
2727

2828
export const captureFeedback = (
2929
feedback: string,
30-
context?: Record<string, any>,
30+
context?: Record<string, unknown>,
3131
) => {
3232
if (isSentryDisabled) {
3333
return;
@@ -36,18 +36,18 @@ export const captureFeedback = (
3636
sentryCaptureFeedback(
3737
{
3838
message: feedback,
39-
name: context?.name,
40-
email: context?.email,
39+
name: context?.name as string | undefined,
40+
email: context?.email as string | undefined,
4141
tags: {
42-
category: context?.category || 'general',
43-
source: context?.source || 'feedback_modal',
42+
category: (context?.category as string) || 'general',
43+
source: (context?.source as string) || 'feedback_modal',
4444
},
4545
},
4646
{
4747
captureContext: {
4848
tags: {
49-
category: context?.category || 'general',
50-
source: context?.source || 'feedback_modal',
49+
category: (context?.category as string) || 'general',
50+
source: (context?.source as string) || 'feedback_modal',
5151
},
5252
},
5353
},
@@ -56,7 +56,7 @@ export const captureFeedback = (
5656

5757
export const captureMessage = (
5858
message: string,
59-
context?: Record<string, any>,
59+
context?: Record<string, unknown>,
6060
) => {
6161
if (isSentryDisabled) {
6262
return;

app/src/Sentry.web.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414

1515
export const captureException = (
1616
error: Error,
17-
context?: Record<string, any>,
17+
context?: Record<string, unknown>,
1818
) => {
1919
if (isSentryDisabled) {
2020
return;
@@ -26,7 +26,7 @@ export const captureException = (
2626

2727
export const captureFeedback = (
2828
feedback: string,
29-
context?: Record<string, any>,
29+
context?: Record<string, unknown>,
3030
) => {
3131
if (isSentryDisabled) {
3232
return;
@@ -35,18 +35,18 @@ export const captureFeedback = (
3535
sentryCaptureFeedback(
3636
{
3737
message: feedback,
38-
name: context?.name,
39-
email: context?.email,
38+
name: context?.name as string | undefined,
39+
email: context?.email as string | undefined,
4040
tags: {
41-
category: context?.category || 'general',
42-
source: context?.source || 'feedback_modal',
41+
category: (context?.category as string) || 'general',
42+
source: (context?.source as string) || 'feedback_modal',
4343
},
4444
},
4545
{
4646
captureContext: {
4747
tags: {
48-
category: context?.category || 'general',
49-
source: context?.source || 'feedback_modal',
48+
category: (context?.category as string) || 'general',
49+
source: (context?.source as string) || 'feedback_modal',
5050
},
5151
},
5252
},
@@ -55,7 +55,7 @@ export const captureFeedback = (
5555

5656
export const captureMessage = (
5757
message: string,
58-
context?: Record<string, any>,
58+
context?: Record<string, unknown>,
5959
) => {
6060
if (isSentryDisabled) {
6161
return;

app/src/components/native/PassportCamera.web.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const PassportCamera: React.FC<PassportCameraProps> = ({
4040

4141
// Web stub - no functionality yet
4242
useEffect(() => {
43-
void _onPassportRead; // noop until web implementation exists
4443
// Simulate that the component is not ready for web
4544
if (isMounted) {
4645
console.warn('PassportCamera: Web implementation not yet available');

app/src/mocks/react-native-gesture-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export const Gesture = {
4444

4545
export const GestureDetector: React.FC<{
4646
children: React.ReactNode;
47-
gesture?: any;
47+
gesture?: unknown;
4848
}> = ({ children, gesture: _gesture }) => {
4949
return createElement('div', {}, children);
5050
};
5151

5252
// Mock GestureHandlerRootView as a simple wrapper
5353
export const GestureHandlerRootView: React.FC<{
5454
children: React.ReactNode;
55-
[key: string]: any;
55+
[key: string]: unknown;
5656
}> = ({ children, ...props }) => {
5757
return createElement('div', props, children);
5858
};

app/src/mocks/react-native-passport-reader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
// Mock PassportReader object with analytics methods
88
export const PassportReader = {
9-
configure: (token: string, enableDebug?: boolean) => {
9+
configure: (_token: string, _enableDebug?: boolean) => {
1010
// No-op for web
1111
return Promise.resolve();
1212
},
13-
trackEvent: (name: string, properties?: Record<string, unknown>) => {
13+
trackEvent: (_name: string, _properties?: Record<string, unknown>) => {
1414
// No-op for web
1515
return Promise.resolve();
1616
},

app/src/providers/passportDataProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export const PassportProvider = ({ children }: PassportProviderProps) => {
239239
getAvailableTypes,
240240
getPassportDataAndSecret,
241241
getSelectedPassportDataAndSecret,
242+
selfClient,
242243
],
243244
);
244245

app/src/providers/selfClientProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { unsafe_getPrivateKey } from '@/providers/authProvider';
1616
import { selfClientDocumentsAdapter } from '@/providers/passportDataProvider';
1717
import analytics from '@/utils/analytics';
1818

19+
type GlobalCrypto = { crypto?: { subtle?: Crypto['subtle'] } };
20+
1921
/**
2022
* Provides a configured Self SDK client instance to all descendants.
2123
*
@@ -61,7 +63,7 @@ export const SelfClientProvider = ({ children }: PropsWithChildren) => {
6163
data: Uint8Array,
6264
algo: 'sha256' = 'sha256',
6365
): Promise<Uint8Array> {
64-
const subtle = (globalThis as any)?.crypto?.subtle;
66+
const subtle = (globalThis as GlobalCrypto)?.crypto?.subtle;
6567
if (!subtle?.digest) {
6668
throw new Error(
6769
'WebCrypto subtle.digest is not available; provide a crypto adapter/polyfill for React Native.',

app/src/screens/dev/MockDataScreen.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import SelfDevCard from '@/images/card-dev.svg';
4040
import IdIcon from '@/images/icons/id_icon.svg';
4141
import NoteIcon from '@/images/icons/note.svg';
4242
import { storePassportData } from '@/providers/passportDataProvider';
43-
import analytics from '@/utils/analytics';
4443
import {
4544
black,
4645
borderColor,

0 commit comments

Comments
 (0)