Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ updates:
interval: "daily"

# Maintain dependencies for yarn
- package-ecosystem: "yarn"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
if: (github.actor != 'dependabot[bot]')
steps:
- uses: amannn/action-semantic-pull-request@v3.4.2
env:
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: returntocorp/semgrep-action@v1
with:
generateSarif: "1"
auditOn: push
config: >- # more at semgrep.dev/explore
p/security-audit
p/typescript
Expand All @@ -29,25 +30,6 @@ jobs:
p/react
p/r2c-ci
p/owasp-top-ten
p/r2c-best-practices

# == Optional settings in the `with:` block

# Instead of `config:`, use rules set in Semgrep App.
# Get your token from semgrep.dev/manage/settings.
# publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}

# Never fail the build due to findings on pushes.
# Instead, just collect findings for semgrep.dev/manage/findings
# auditOn: push

# Upload findings to GitHub Advanced Security Dashboard [step 1/2]
# See also the next step.


# Change job timeout (default is 1800 seconds; set to 0 to disable)
# env:
# SEMGREP_TIMEOUT: 300

# Upload findings to GitHub Advanced Security Dashboard [step 2/2]
- name: Upload SARIF file for GitHub Advanced Security Dashboard
Expand Down
2 changes: 1 addition & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class App extends React.PureComponent {
render() {
return (
<>
{!__DEV__ && <WithCodePush />}
{!__DEV__ ? <WithCodePush /> : null}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I propose not to use negation
{__DEV__ ? null : <WithCodePush /> }

<I18nextProvider i18n={i18n}>
<Provider store={store}>
<AppStateManager
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Chip extends React.PureComponent<Props> {
<Text style={[styles.label, this.props.textStyle]} testID={this.props.testID}>
{this.props.label}
</Text>
{this.props.removable && <Image source={icons.blackCross} style={styles.icon} />}
{this.props.removable ? <Image source={icons.blackCross} style={styles.icon} /> : null}
</View>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Dropdown = ({ title, label, testID, onSelectPress }: Props) => {
<View style={styles.header}>
<TouchableOpacity testID={testID} style={styles.chooseWalletButton} onPress={onSelectPress}>
<Text style={styles.chooseWalletButtonText}>{title}</Text>
{onSelectPress && <Image source={icons.iconDropdown} style={styles.icon} />}
{onSelectPress ? <Image source={icons.iconDropdown} style={styles.icon} /> : null}
</TouchableOpacity>
<View style={styles.descriptionContainer}>{label}</View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class InputItem extends Component<Props, State> {
return (
<View style={styles.container}>
<Animated.Text style={[styles.label, { top, fontSize }]}>{label}</Animated.Text>
{!!suffix && <Text style={styles.suffix}>{suffix}</Text>}
{!!suffix ? <Text style={styles.suffix}>{suffix}</Text> : null}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also no need in !!

<BaseTextInput
ref={this.inputItemRef}
autoCorrect={false}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PinInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PinInput extends PureComponent<Props> {
keyboardType="number-pad"
renderCell={({ index, symbol, isFocused }) => (
<View key={index.toString()} style={[styles.cell, isFocused && styles.cellFocused]}>
{!!symbol && <View style={styles.cellMask} />}
{!!symbol ? <View style={styles.cellMask} /> : null}
</View>
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PinView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class PinView extends Component<Props> {
},
]}
>
{isFilled && <View style={styles.cellMask} />}
{isFilled ? <View style={styles.cellMask} /> : null}
</View>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const TransactionItem = ({ item, onPress, testID }: Props) => {
<Image source={icons.wallet} style={styles.wallet} resizeMode="contain" />
<EllipsisText style={styles.walletLabel}>{item.walletLabel}</EllipsisText>
</View>
{!!item.note && <Text style={typography.caption}>{item.note}</Text>}
{!!item.note ? <Text style={typography.caption}>{item.note}</Text> : null}
<Text style={styles.label}>
{item.time ? dayjs(item.received).format('LT') : i18n.transactions.details.timePending}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const WalletItem = (props: WalletItemProps) => {
<TouchableOpacity testID={testID} style={styles.container} onPress={onWalletPress}>
<View>
<Avatar variant={variant} title={title} />
{selected && <Image style={styles.image} source={images.successBadge} />}
{selected ? <Image style={styles.image} source={images.successBadge} /> : null}
</View>
<View style={styles.textContainer}>
<Text style={typography.headline5}>{i18n.formatBalance(Number(value), unit, true)}</Text>
Expand Down
8 changes: 4 additions & 4 deletions src/navigators/Navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ class Navigator extends React.Component<Props, State> {
shouldRenderNotification={this.shouldRenderNotification()}
userVersion={userVersion}
/>
{isAuthenticated && <Toasts />}
{isToast && <Toasts onClick={this.handleClickToast} />}
{this.shouldRenderConnectionIssues() && <ConnectionIssuesScreen />}
{this.shouldRenderUnlockScreen() && <UnlockScreen key={unlockKey} />}
{isAuthenticated ? <Toasts /> : null}
{isToast ? <Toasts onClick={this.handleClickToast} /> : null}
{this.shouldRenderConnectionIssues() ? <ConnectionIssuesScreen /> : null}
{this.shouldRenderUnlockScreen() ? <UnlockScreen key={unlockKey} /> : null}
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/ExportWalletScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ExportWalletScreen = ({ route }: Props) => {
<ScreenTemplate header={<Header title={i18n.wallets.exportWallet.header} isBackArrow />}>
<Text style={styles.title}>{i18n.wallets.exportWallet.title}</Text>
<View testID="export-wallet-qr-code" style={styles.qrCodeContainer}>
{secret && <QRCode quietZone={10} value={secret} size={140} ecl={'H'} />}
{secret ? <QRCode quietZone={10} value={secret} size={140} ecl={'H'} /> : null}
</View>
<Mnemonic testID="export-wallet-seed-phrase" mnemonic={secret} />

Expand Down
2 changes: 1 addition & 1 deletion src/screens/MessageScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const MessageScreen = (props: Props) => {
<Text style={styles.title}>{title}</Text>
<Image testID={testID} source={source} style={[styles.image, imageStyle]} resizeMode="contain" />
<Text style={styles.description}>{description}</Text>
{buttonProps && <Button testID="message-close-button" {...buttonProps} />}
{buttonProps ? <Button testID="message-close-button" {...buttonProps} /> : null}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR but maybe for later we should not use spread on components props?

</View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Notifications/ConfirmEmailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class ConfirmEmailScreen extends Component<Props, State> {
onTextChange={this.onChange}
isError={!!notificationError}
/>
{!!notificationError && <Text style={styles.error}>{notificationError}</Text>}
{!!notificationError ? <Text style={styles.error}>{notificationError}</Text> : null}
</View>
</>
</ScreenTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const SeedPhraseConfirmView: FC<Props> = ({
<View style={[styles.mnemonicPhraseContainer, error ? { borderColor: palette.primary } : {}]}>
<Tags words={orderedMnemonics} onTagsOrderChange={onSeedOrderChange} onRemove={onSeedRemovePress} removable />
</View>
{error && <Text style={styles.errorText}>{i18n.wallets.confirmSeed.error}</Text>}
{error ? <Text style={styles.errorText}>{i18n.wallets.confirmSeed.error}</Text> : null}
<View style={styles.mnemonicPhraseUnselectedContainer}>
<Tags words={unorderedMnemonics} onTouch={onTouch} touchable />
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/SendCoinsConfirmScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class SendCoinsConfirmScreen extends Component<Props> {

return (
<View style={styles.balancesContainer}>
{isAlert && <Warning />}
{isAlert ? <Warning /> : null}
<View style={styles.balanceWrapper}>
<Text style={styles.balanceText}>
{roundBtcToSatoshis(availableBalance)} {fromWallet.preferredBalanceUnit}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/SendCoinsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class SendCoinsScreen extends Component<Props, State> {
unit={wallet.preferredBalanceUnit}
/>
<View style={styles.inputsContainer}>
{this.isAlert(wallet) && <Warning />}
{this.isAlert(wallet) ? <Warning /> : null}
{this.renderAmountInput()}

<View style={styles.fee}>
Expand Down