Skip to content

Commit

Permalink
chore: lint & format
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr committed Jan 13, 2025
1 parent 3d7e8e1 commit c252a26
Show file tree
Hide file tree
Showing 109 changed files with 2,227 additions and 871 deletions.
5 changes: 2 additions & 3 deletions src/AppOnboarded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const AppOnboarded = (): ReactElement => {
const isOnline = useAppSelector(isOnlineSelector);

// on App start
// biome-ignore lint/correctness/useExhaustiveDependencies: onMount
useEffect(() => {
startWalletServices({ selectedNetwork, selectedWallet });

Expand All @@ -49,10 +50,9 @@ const AppOnboarded = (): ReactElement => {
return (): void => {
unsubscribeFromLightningSubscriptions();
};
// onMount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// biome-ignore lint/correctness/useExhaustiveDependencies: onMount
useEffect(() => {
// on AppState change
const appStateSubscription = AppState.addEventListener(
Expand Down Expand Up @@ -84,7 +84,6 @@ const AppOnboarded = (): ReactElement => {
return (): void => {
appStateSubscription.remove();
};
// onMount
}, [selectedNetwork]);

useEffect(() => {
Expand Down
1,888 changes: 1,676 additions & 212 deletions src/assets/tos.tsx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/components/AmountToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ const AmountToggle = ({
decimalLength={decimalLength}
unitType="secondary"
symbol={true}
testID={testID + '-secondary'}
testID={`${testID}-secondary`}
/>
<Money
sats={amount}
decimalLength={decimalLength}
unitType="primary"
symbol={true}
testID={testID + '-primary'}
testID={`${testID}-primary`}
/>
</Pressable>
);
Expand Down
5 changes: 2 additions & 3 deletions src/components/Biometrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ const Biometrics = ({
t('bio_confirm', { biometricsName: data.biometryType || t('bio') }),
);
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [t]);

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
const Icon = useCallback(
() => getIcon(biometryData),
//eslint-disable-next-line react-hooks/exhaustive-deps
[biometryData?.biometryType],
);

Expand All @@ -87,6 +86,7 @@ const Biometrics = ({
}
}, [biometryData?.available, biometryData?.biometryType, t]);

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
const authenticate = useCallback(
(promptMessage?: string): void => {
if (!promptMessage) {
Expand All @@ -112,7 +112,6 @@ const Biometrics = ({
onFailure?.();
});
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[biometryData?.biometryType, t],
);

Expand Down
1 change: 0 additions & 1 deletion src/components/BottomSheetScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const BottomSheetScreen = ({
/>
<View style={styles.content}>
<View
// eslint-disable-next-line react-native/no-inline-styles
style={[styles.imageContainer, { marginBottom: isLarge ? 32 : 0 }]}>
<Image style={styles.image} source={image} />
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/components/BottomSheetWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const BottomSheetWrapper = forwardRef(
}, [data.isOpen]);

useImperativeHandle(ref, () => ({
snapToIndex(index: number = 0): void {
snapToIndex(index = 0): void {
bottomSheetRef.current?.snapToIndex(index);
},
expand(): void {
Expand Down
9 changes: 6 additions & 3 deletions src/components/Camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ const Camera = ({
const checkResponse = await check(cameraPermission);
switch (checkResponse) {
case RESULTS.UNAVAILABLE:
case RESULTS.BLOCKED:
case RESULTS.BLOCKED: {
setCameraStatus(Status.NOT_AUTHORIZED);
break;
case RESULTS.DENIED:
}
case RESULTS.DENIED: {
const rationale = {
title: t('camera_ask_title'),
message: t('camera_ask_msg'),
Expand All @@ -56,10 +57,12 @@ const Camera = ({
: Status.NOT_AUTHORIZED,
);
break;
}
case RESULTS.LIMITED:
case RESULTS.GRANTED:
case RESULTS.GRANTED: {
setCameraStatus(Status.AUTHORIZED);
break;
}
}
})();
}, [t]);
Expand Down
10 changes: 5 additions & 5 deletions src/components/ContactsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ const ContactsList = ({
const name = contact?.name ?? 'Contact Name';
const char = name.slice(0, 1);
if (char) {
sections[char]
? sections[char].push(contact)
: (sections[char] = [contact]);
if (sections[char]) {
sections[char].push(contact);
} else {
sections[char] = [contact];
}
}
});

Expand All @@ -130,7 +132,6 @@ const ContactsList = ({
const List = bottomSheet ? BottomSheetSectionList : SectionList;

const renderSectionHeader = useCallback(
// eslint-disable-next-line react/no-unused-prop-types
({ section: { title } }: { section: { title: string } }): ReactElement => {
const isFirst = title === sectionedContacts[0].title;
return (
Expand All @@ -145,7 +146,6 @@ const ContactsList = ({
);

const renderItem = useCallback(
// eslint-disable-next-line react/no-unused-prop-types
({ item }: { item: IContactRecord }): ReactElement => (
<ContactItem contact={item} onPress={onPress} />
),
Expand Down
2 changes: 1 addition & 1 deletion src/components/LabeledInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const LabeledInput = ({
<BodyS
color="brand"
style={styles.error}
testID={testID ? testID + '-error' : undefined}>
testID={testID ? `${testID}-error` : undefined}>
{error}
</BodyS>
)}
Expand Down
5 changes: 1 addition & 4 deletions src/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,7 @@ const _Item = memo((item: ItemData): ReactElement => {

return (
<TouchableOpacity
style={
// eslint-disable-next-line react-native/no-inline-styles
{ opacity: enabled ? 1 : 0.5 }
}
style={{ opacity: enabled ? 1 : 0.5 }}
activeOpacity={0.7}
disabled={disabled}
testID={testID}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const LoadingView = memo(
const spinValue = useSharedValue(0);
const [showLoading, setShowLoading] = useState(false);

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
if (__E2E__) {
return;
Expand All @@ -47,7 +48,6 @@ const LoadingView = memo(
clearTimeout(timeout);
cancelAnimation(spinValue);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const animatedStyle = useAnimatedStyle(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/LuganoFeedWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const LuganoWidget = ({
const minutes = time.getMinutes().toString().padStart(2, '0');

return {
time: hours + ':' + minutes,
time: `${hours}:${minutes}`,
location: event.location,
name: event.name,
};
Expand Down Expand Up @@ -166,7 +166,7 @@ const LuganoWidget = ({
openURL(
link.url.startsWith('http')
? link.url
: 'https://' + link.url,
: `https://${link.url}`,
);
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Money.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Money = (props: MoneyProps): ReactElement => {
const size = props.size ?? 'display';
const unit =
props.unit ?? (props.unitType === 'secondary' ? nextUnit : primaryUnit);
const showSymbol = props.symbol ?? (unit === 'fiat' ? true : false);
const showSymbol = props.symbol ?? unit === 'fiat';
const color = props.color;
const symbolColor = props.symbolColor;
const hide = (props.enableHide ?? false) && hideBalance;
Expand Down
6 changes: 3 additions & 3 deletions src/components/NavigationHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ const NavigationHeader = ({
const numberOfActions = useMemo(() => {
if (actionIcon && showCloseButton) {
return 2;
} else if (showBack || actionIcon || showCloseButton) {
}
if (showBack || actionIcon || showCloseButton) {
return 1;
} else {
return 0;
}
return 0;
}, [actionIcon, showBack, showCloseButton]);

const actionColumn = useMemo(
Expand Down
1 change: 0 additions & 1 deletion src/components/OnboardingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const OnboardingScreen = ({
<View
style={[
styles.imageContainer,
// eslint-disable-next-line react-native/no-inline-styles
{ marginBottom: imagePosition === 'center' ? 'auto' : 48 },
mirrorImage ? { transform: [{ rotateY: '180deg' }] } : {},
]}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PinPad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const PinPad = ({
biometryData?.biometryType === 'TouchID'
? t('bio_touch_id')
: biometryData?.biometryType === 'FaceID'
? t('bio_face_id')
: biometryData?.biometryType ?? t('bio');
? t('bio_face_id')
: (biometryData?.biometryType ?? t('bio'));

return (
<ThemedView style={styles.root}>
Expand Down
7 changes: 5 additions & 2 deletions src/components/PriceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getChange = (pastValues: number[]): Change => {

return {
color,
formatted: sign + (_change * 100).toFixed(2) + '%',
formatted: `${sign}${(_change * 100).toFixed(2)}%`,
};
};

Expand Down Expand Up @@ -71,7 +71,10 @@ export const Chart = ({
const step = chartWidth / (steps - 1);

const normalized = useMemo(() => {
const min = values.reduce((prev, curr) => Math.min(prev, curr), Infinity);
const min = values.reduce(
(prev, curr) => Math.min(prev, curr),
Number.POSITIVE_INFINITY,
);
const max = values.reduce((prev, curr) => Math.max(prev, curr), 0);

return values.map((value: number) => (value - min) / (max - min));
Expand Down
4 changes: 2 additions & 2 deletions src/components/PriceWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ const PriceWidget = ({

// replace old data while keeping the order
return prev.map((d) => (d !== pairData ? d : updated));
} else {
return prev;
}

return prev;
});
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const ProfileCard = ({

const base64 = result.assets?.[0].base64;
const type = result.assets?.[0].type;
base64 && onChange?.('image', `data:${type};base64,` + base64);
base64 && onChange?.('image', `data:${type};base64,${base64}`);
}}>
<View style={styles.cameraIconOverlay}>
<CameraIcon />
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProfileImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const ProfileImage = ({
if (image?.startsWith('data:image/svg+xml;base64,')) {
const base64 = image.replace('data:image/svg+xml;base64,', '');
return Buffer.from(base64, 'base64').toString();
} else if (image?.startsWith('data:image/svg+xml,')) {
}
if (image?.startsWith('data:image/svg+xml,')) {
const encoded = image.replace('data:image/svg+xml', '');
const decoded = decodeURIComponent(encoded);
return decoded;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const LoadingSpinner = memo(
}) => {
const spinValue = useSharedValue(0);

// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
if (__E2E__) {
return;
Expand All @@ -35,7 +36,6 @@ const LoadingSpinner = memo(
-1,
);
return (): void => cancelAnimation(spinValue);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const animatedStyle = useAnimatedStyle(() => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Suggestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ const Suggestions = (): ReactElement => {
);

const handleRenderItem = useCallback(
// eslint-disable-next-line react/no-unused-prop-types
({ item }: { item: ITodo }): ReactElement => {
const title = t(`${item.id}.title`);
let description = t(`${item.id}.description`);
Expand Down
6 changes: 4 additions & 2 deletions src/components/SvgImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ const SvgImage = ({
const xml = useMemo(() => {
if (image.startsWith('<svg')) {
return image;
} else if (image.startsWith('data:image/svg+xml;base64,')) {
}
if (image.startsWith('data:image/svg+xml;base64,')) {
const base64 = image.replace('data:image/svg+xml;base64,', '');
return Buffer.from(base64, 'base64').toString();
} else if (image.startsWith('data:image/svg+xml,')) {
}
if (image.startsWith('data:image/svg+xml,')) {
const encoded = image.replace('data:image/svg+xml', '');
const decoded = decodeURIComponent(encoded);
return decoded;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Tabs = ({
{tabs.map((tab, index) => (
<Tab
key={tab.id}
text={t('activity_tabs.' + tab.id)}
text={t(`activity_tabs.${tab.id}`)}
active={activeTab === index}
testID={`Tab-${tab.id}`}
onLayout={(event) => handleLayout(tab.id, event, index)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Widgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const Widgets = (): ReactElement => {

const renderItem = useCallback(
({ item, drag }: RenderItemParams<[string, TWidget]>): ReactElement => {
let [url, widget] = item;
const [url, widget] = item;

const _drag = (): void => {
// only allow dragging if there are more than 1 widget
Expand Down
18 changes: 9 additions & 9 deletions src/components/buttons/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ export const RadioButtonGroup = memo(
style={styles.itemLast}
/>
);
} else {
return (
<RadioButton
key={item.value}
label={item.label}
checked={value === item.value}
onPress={(): void => onPress?.(item.value)}
/>
);
}

return (
<RadioButton
key={item.value}
label={item.label}
checked={value === item.value}
onPress={(): void => onPress?.(item.value)}
/>
);
})}
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/displayValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ export const useCurrentDisplayValue = (
const unit = useAppSelector(unitSelector);
const dv = useDisplayValues(...props);
return unit === EUnit.BTC
? '₿' + dv.bitcoinFormatted
? `₿${dv.bitcoinFormatted}`
: dv.fiatSymbol + dv.fiatFormatted;
};
Loading

0 comments on commit c252a26

Please sign in to comment.