Skip to content

Commit

Permalink
Add curly brace eslint rule (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardier16 authored Mar 13, 2024
1 parent 907c9f8 commit e5aa34f
Show file tree
Hide file tree
Showing 59 changed files with 510 additions and 455 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module.exports = {
],
'react-i18n/no-dynamic-translation-keys': 'error',
'react-i18n/no-missing-interpolation-keys': 'error',
'react/jsx-curly-brace-presence': ['warn', 'never'],
// disable unnecessary rules from recommendations
'react/display-name': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const App: FC<HTMLAttributes<HTMLDivElement>> = () => {
<AppRoutes />
) : (
<Stack alignItems='center' justifyContent='center' flex={1}>
<CircularProgress color={'secondary'} />
<CircularProgress color='secondary' />
</Stack>
)}
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/common/AppNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const NavbarLink = ({ children, to }: NavbarLinkProps) => {
return (
<NavLink to={to}>
<Stack
alignItems={'center'}
justifyContent={'center'}
alignItems='center'
justifyContent='center'
sx={{
width: spacing(10),
height: spacing(10),
Expand Down Expand Up @@ -54,7 +54,7 @@ const AppNavbar = () => {
{ route: RoutePaths.Dashboard, iconComponent: <UiIcon name={Icons.House} size={5} /> },
{
route: RoutePaths.Credentials,
iconComponent: <UiIcon componentName={'layers'} size={6} />,
iconComponent: <UiIcon componentName='layers' size={6} />,
},
{ route: RoutePaths.Rewards, iconComponent: <UiIcon name={Icons.Gift} size={5} /> },
],
Expand All @@ -67,15 +67,15 @@ const AppNavbar = () => {

return (
<Stack
justifyContent={'space-between'}
alignItems={'center'}
justifyContent='space-between'
alignItems='center'
py={6}
px={4}
borderRight={1}
borderColor={palette.divider}
>
<Stack spacing={4}>
<Stack component={NavLink} to={RoutePaths.Dashboard} alignItems={'center'}>
<Stack component={NavLink} to={RoutePaths.Dashboard} alignItems='center'>
<UiIcon name={Icons.Rarime} size={10} sx={{ color: palette.text.primary }} />
</Stack>
<Divider />
Expand Down
2 changes: 1 addition & 1 deletion src/common/BackLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function BackLink({ to, ...rest }: Props) {
variant='text'
color='secondary'
size='small'
startIcon={<UiIcon componentName={'chevronLeft'} size={5} />}
startIcon={<UiIcon componentName='chevronLeft' size={5} />}
{...rest}
sx={{ width: 'fit-content', ...rest.sx }}
>
Expand Down
6 changes: 3 additions & 3 deletions src/common/CredentialCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ function DotsDecoration({ ...rest }: StackProps) {

// TODO: alpha(palette.common.white, ...) should be configured together with bg
return (
<Stack {...rest} alignItems={'flex-end'} spacing={betweenDotsSpacing}>
<Stack {...rest} alignItems='flex-end' spacing={betweenDotsSpacing}>
{Array.from({ length: rowsCount }, (v, i) => i).map(rowIdx => (
<Stack key={rowIdx} direction='row' spacing={betweenDotsSpacing}>
{Array.from({ length: maxDots - rowIdx }, (v, i) => i).map(boxIdx => (
<Box
key={boxIdx}
width={8}
height={8}
borderRadius={'50%'}
borderRadius='50%'
bgcolor={alpha(palette.common.white, 0.16)}
/>
))}
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function CredentialCard({ vc, issuerDetails, ...rest }: Props) {
height={40}
color={palette.common.white}
bgcolor={alpha(palette.common.white, 0.1)}
borderRadius={'50%'}
borderRadius='50%'
p={2}
>
{/*TODO: define map for credential types*/}
Expand Down
12 changes: 6 additions & 6 deletions src/common/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default function ErrorView({
return (
<Stack
spacing={4}
alignItems={'center'}
width={'100%'}
justifyContent={'center'}
alignItems='center'
width='100%'
justifyContent='center'
p={8}
border={1}
borderColor={palette.error.light}
Expand All @@ -33,8 +33,8 @@ export default function ErrorView({
{...rest}
>
<Stack
alignItems={'center'}
justifyContent={'center'}
alignItems='center'
justifyContent='center'
bgcolor={palette.error.lighter}
color={palette.error.main}
borderRadius={250}
Expand All @@ -43,7 +43,7 @@ export default function ErrorView({
>
{icon}
</Stack>
<Stack spacing={1} textAlign={'center'}>
<Stack spacing={1} textAlign='center'>
<Typography variant='body3'>{title}</Typography>
{description && (
<Typography variant='body3' color={palette.text.secondary}>
Expand Down
4 changes: 2 additions & 2 deletions src/common/InfiniteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function InfiniteList<D>({
{children}
{loadingState === LoadingStates.NextLoading ? (
<Stack alignItems='center'>
<CircularProgress color={'secondary'} size={spacing(6)} />
<CircularProgress color='secondary' size={spacing(6)} />
</Stack>
) : loadingState === LoadingStates.Error ? (
<Stack alignItems='center'>
Expand All @@ -47,7 +47,7 @@ export default function InfiniteList<D>({
</Stack>
) : loadingState === LoadingStates.Loading ? (
<Stack alignItems='center' p={20}>
<CircularProgress color={'secondary'} />
<CircularProgress color='secondary' />
</Stack>
) : loadingState === LoadingStates.Error ? (
<ErrorView
Expand Down
12 changes: 6 additions & 6 deletions src/common/NoDataView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default function NoDataView({
return (
<Stack
spacing={4}
alignItems={'center'}
width={'100%'}
justifyContent={'center'}
alignItems='center'
width='100%'
justifyContent='center'
p={8}
border={1}
borderColor={palette.action.hover}
Expand All @@ -33,8 +33,8 @@ export default function NoDataView({
{...rest}
>
<Stack
alignItems={'center'}
justifyContent={'center'}
alignItems='center'
justifyContent='center'
bgcolor={palette.action.active}
color={palette.text.secondary}
borderRadius={250}
Expand All @@ -43,7 +43,7 @@ export default function NoDataView({
>
{icon}
</Stack>
<Stack spacing={1} textAlign={'center'}>
<Stack spacing={1} textAlign='center'>
<Typography variant='body3'>{title}</Typography>
{description && (
<Typography variant='body3' color={palette.text.secondary}>
Expand Down
12 changes: 3 additions & 9 deletions src/common/PageListFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ export default function PageListFilters({ tabs, onSearchInput, actionBar, ...res
const handleSearchInput = debounce((value: string) => onSearchInput?.(value), 500)

return (
<Stack
{...rest}
direction='row'
alignItems='center'
justifyContent={'space-between'}
spacing={5}
>
<Stack {...rest} direction='row' alignItems='center' justifyContent='space-between' spacing={5}>
{tabs && <UiNavTabs tabs={tabs} />}

<Stack direction={'row'} alignItems={'center'} spacing={6}>
<Stack direction='row' alignItems='center' spacing={6}>
<UiSearchField
size={'small'}
size='small'
placeholder={t('page-list-filters.search-input-placeholder')}
onChange={e => handleSearchInput(e.target.value)}
/>
Expand Down
22 changes: 11 additions & 11 deletions src/common/ProfileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ export default function ProfileMenu({ userDid }: ProfileMenuProps) {
},
}}
>
<Stack direction={'column'} p={4} alignItems={'center'}>
<Stack direction='column' p={4} alignItems='center'>
<UserAvatar userDid={userDid} size={12} />
<Stack direction={'row'} mt={3} spacing={2}>
<Stack direction='row' mt={3} spacing={2}>
<Typography
variant={'subtitle4'}
overflow={'hidden'}
textOverflow={'ellipsis'}
variant='subtitle4'
overflow='hidden'
textOverflow='ellipsis'
maxWidth={spacing(40)}
>
{formatDid(userDid)}
Expand All @@ -102,9 +102,9 @@ export default function ProfileMenu({ userDid }: ProfileMenuProps) {
{/*TODO: Add handler*/}
<MenuItem onClick={exportIdentity} sx={menuItemSx} disabled={isExporting}>
<ListItemIcon>
<UiIcon componentName={'key'} size={5} sx={{ color: palette.text.secondary }} />
<UiIcon componentName='key' size={5} sx={{ color: palette.text.secondary }} />
</ListItemIcon>
<Typography variant={'caption1'}>
<Typography variant='caption1'>
{isExporting ? 'Exporting...' : 'Export Identity'}
</Typography>
</MenuItem>
Expand All @@ -116,15 +116,15 @@ export default function ProfileMenu({ userDid }: ProfileMenuProps) {
sx={menuItemSx}
>
<ListItemIcon>
<UiIcon componentName={'openInNew'} size={5} sx={{ color: palette.text.secondary }} />
<UiIcon componentName='openInNew' size={5} sx={{ color: palette.text.secondary }} />
</ListItemIcon>
<Typography variant={'caption1'}>Help Center</Typography>
<Typography variant='caption1'>Help Center</Typography>
</MenuItem>
<MenuItem onClick={logout} sx={menuItemSx}>
<ListItemIcon>
<UiIcon componentName={'logOut'} size={5} sx={{ color: palette.error.main }} />
<UiIcon componentName='logOut' size={5} sx={{ color: palette.error.main }} />
</ListItemIcon>
<Typography variant={'caption1'} color={palette.error.main}>
<Typography variant='caption1' color={palette.error.main}>
Disconnect
</Typography>
</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/toasts-manager/toasts/DefaultToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const DefaultToast = forwardRef<HTMLDivElement, Props>((props: Props, ref) => {
onClose={() => closeSnackbar(id)}
>
<AlertTitle>{title}</AlertTitle>
<Typography variant={'body4'}>{message}</Typography>
<Typography variant='body4'>{message}</Typography>
</Alert>
</SnackbarContent>
)
Expand Down
37 changes: 16 additions & 21 deletions src/layouts/AuthLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ const PublicLayout = ({ children }: PropsWithChildren) => {
const { palette, spacing } = useTheme()

return (
<Stack direction={'row'} height={vh(100)}>
<Stack direction='row' height={vh(100)}>
<Stack pl={14} pr={8} py={8} flex={1}>
<Box flex={1} position={'relative'}>
<Stack direction={'row'} justifyContent={'space-between'} alignItems={'center'}>
<Box component={'img'} src='/branding/logo-sign-in.svg' alt={config.APP_NAME} />
<Box flex={1} position='relative'>
<Stack direction='row' justifyContent='space-between' alignItems='center'>
<Box component='img' src='/branding/logo-sign-in.svg' alt={config.APP_NAME} />
<Button
component={'a'}
href={'https://rarime.com'}
target={'_blank'}
component='a'
href='https://rarime.com'
target='_blank'
variant='text'
color={'secondary'}
size={'medium'}
color='secondary'
size='medium'
>
Visit Landing page
</Button>
</Stack>

<Stack
position={'absolute'}
top={'50%'}
left={'50%'}
width={'100%'}
position='absolute'
top='50%'
left='50%'
width='100%'
maxWidth={spacing(100)}
sx={{ transform: 'translate(-50%, -50%)' }}
>
Expand All @@ -38,16 +38,11 @@ const PublicLayout = ({ children }: PropsWithChildren) => {
</Box>
</Stack>

<Stack
justifyContent={'center'}
alignItems={'end'}
pl={8}
bgcolor={palette.additional.pureBlack}
>
<Stack justifyContent='center' alignItems='end' pl={8} bgcolor={palette.additional.pureBlack}>
<Box
component={'img'}
component='img'
src='/imgs/dashboard.png'
alt={'Dashboard image'}
alt='Dashboard image'
height={vh(90)}
sx={{ objectFit: 'contain' }}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const MainLayout = ({ children }: PropsWithChildren) => {
const { spacing } = useTheme()

return (
<Stack direction='row' spacing={4} height={vh(100)} width={'100%'}>
<Stack direction='row' spacing={4} height={vh(100)} width='100%'>
<AppNavbar />
<Stack py={8} flex={1} overflow={'hidden auto'}>
<Stack mx={'auto'} maxWidth={spacing(220)} width={'100%'}>
<Stack py={8} flex={1} overflow='hidden auto'>
<Stack mx='auto' maxWidth={spacing(220)} width='100%'>
{children}
</Stack>
</Stack>
Expand Down
24 changes: 12 additions & 12 deletions src/layouts/PublicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ const PublicLayout = ({ children }: PropsWithChildren) => {
bgcolor={palette.background.default}
>
<Stack
direction={'row'}
justifyContent={'space-between'}
alignItems={'center'}
width={'100%'}
direction='row'
justifyContent='space-between'
alignItems='center'
width='100%'
px={8}
py={3}
bgcolor={palette.background.paper}
>
<Box component={'img'} src='/branding/logo-sign-in.svg' alt={config.APP_NAME} />
<Box component='img' src='/branding/logo-sign-in.svg' alt={config.APP_NAME} />
<Button
component={'a'}
href={'https://rarime.com'}
target={'_blank'}
color={'secondary'}
size={'medium'}
component='a'
href='https://rarime.com'
target='_blank'
color='secondary'
size='medium'
>
Visit Landing page
</Button>
</Stack>

<Stack py={6} flex={1} overflow={'hidden auto'} width={'100%'}>
<Stack mx={'auto'} maxWidth={spacing(220)} width={'100%'} height={'100%'}>
<Stack py={6} flex={1} overflow='hidden auto' width='100%'>
<Stack mx='auto' maxWidth={spacing(220)} width='100%' height='100%'>
{children}
</Stack>
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function ActionButton({
justifyContent='center'
alignItems='center'
bgcolor={palette.background.paper}
borderRadius={'50%'}
borderRadius='50%'
sx={{
transition: Transitions.Default,
}}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Credentials/pages/CredentialsId/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default function CredentialsId() {
</Stack>
) : (
<NoDataView
title={'Credential not found'}
title='Credential not found'
action={
<Button component={NavLink} to={RoutePaths.CredentialsList} size='medium'>
View all credentials
Expand Down
Loading

0 comments on commit e5aa34f

Please sign in to comment.