Skip to content

Commit

Permalink
chore: eslint + import sort
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Nov 28, 2024
1 parent dcc3273 commit 634991f
Show file tree
Hide file tree
Showing 62 changed files with 218 additions and 93 deletions.
10 changes: 9 additions & 1 deletion apps/wallet/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['@react-native', 'prettier'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
rules: {
'prettier/prettier': [
'error',
Expand All @@ -14,12 +19,15 @@ module.exports = {
semi: false,
},
],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'react-native/no-inline-styles': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_', varsIgnorePattern: '^_'},
],
'@typescript-eslint/no-shadow': 'off',
},
ignorePatterns: ['node_modules/', 'android/', 'ios/', 'coverage/'],
plugins: ['eslint-plugin-simple-import-sort'],
ignorePatterns: ['node_modules/', 'android/', 'ios/', 'coverage/', 'stories/'],
}
1 change: 1 addition & 0 deletions apps/wallet/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.9.0
3 changes: 3 additions & 0 deletions apps/wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@
"@types/react": "~18.2.79",
"@types/react-test-renderer": "^18.0.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"babel-jest": "^29.6.3",
"dependency-cruiser": "^13.1.1",
"eslint": "^8.19.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"i18n-unused": "^0.16.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {isString} from '@yoroi/common'
import {useTheme} from '@yoroi/theme'
import React, {forwardRef, ReactNode} from 'react'
import {
type ViewProps,
StyleSheet,
Text,
TouchableOpacity,
View,
type ViewProps,
} from 'react-native'

import {Icon} from '../Icon'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/components/Boundary/Boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useQueryErrorResetBoundary} from '@tanstack/react-query'
import {useTheme} from '@yoroi/theme'
import React, {SuspenseProps} from 'react'
import {
Expand All @@ -15,7 +16,6 @@ import {
View,
ViewProps,
} from 'react-native'
import {useQueryErrorResetBoundary} from '@tanstack/react-query'

import image from '../../assets/img/error.png'
import {LocalizableError} from '../../kernel/i18n/LocalizableError'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/components/SafeArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {useTheme} from '@yoroi/theme'
import React from 'react'
import {StyleSheet} from 'react-native'
import {
type SafeAreaViewProps,
SafeAreaView,
type SafeAreaViewProps,
} from 'react-native-safe-area-context'

export const SafeArea = ({children, ...rest}: SafeAreaViewProps) => {
Expand Down
14 changes: 7 additions & 7 deletions apps/wallet/src/features/Auth/common/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import {
useMutation,
UseMutationOptions,
useQuery,
useQueryClient,
UseQueryOptions,
} from '@tanstack/react-query'
import {
parseSafe,
parseString,
Expand All @@ -9,13 +16,6 @@ import * as React from 'react'
import {defineMessages, useIntl} from 'react-intl'
import {Alert, AppState, Platform} from 'react-native'
import RNKeychain from 'react-native-keychain'
import {
useMutation,
UseMutationOptions,
useQuery,
useQueryClient,
UseQueryOptions,
} from '@tanstack/react-query'

import {decryptData, encryptData} from '../../../kernel/encryption/encryption'
import globalMessages from '../../../kernel/i18n/global-messages'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useMutationWithInvalidations} from '@yoroi/common'
import {UseMutationOptions} from '@tanstack/react-query'
import {useMutationWithInvalidations} from '@yoroi/common'

import {YoroiWallet} from '../../../yoroi-wallets/cardano/types'
import {useWalletManager} from '../../WalletManager/context/WalletManagerProvider'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useQuery} from '@tanstack/react-query'
import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common'
import {Chain} from '@yoroi/types'
import * as React from 'react'
import {useQuery} from '@tanstack/react-query'

import {GradientWarning} from '../../../components/ChainWarning/GradientWarning'
import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {DappConnection, useDappConnector} from '@yoroi/dapp-connector'
import {Chain} from '@yoroi/types'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {isBoolean, useAsyncStorage} from '@yoroi/common'
import * as React from 'react'
import {
useMutation,
UseMutationOptions,
useQuery,
UseQueryOptions,
} from '@tanstack/react-query'
import {isBoolean, useAsyncStorage} from '@yoroi/common'
import * as React from 'react'

import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common'
import {UseMutationOptions} from '@tanstack/react-query'
import {useAsyncStorage, useMutationWithInvalidations} from '@yoroi/common'

import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'
import {storageKeyShowBuyBannerSmall, storageRootExchange} from './constants'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isNumber, parseNumber, useAsyncStorage} from '@yoroi/common'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {isNumber, parseNumber, useAsyncStorage} from '@yoroi/common'

import {useBalances} from '../../../yoroi-wallets/hooks'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {
parseBoolean,
useAsyncStorage,
Expand All @@ -8,7 +9,6 @@ import * as React from 'react'
import {Alert, StyleSheet, Text, View} from 'react-native'
import DeviceInfo from 'react-native-device-info'
import {SafeAreaView} from 'react-native-safe-area-context'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {Button, ButtonType} from '../../../components/Button/Button'
import {Space} from '../../../components/Space/Space'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {
parseBoolean,
useAsyncStorage,
Expand All @@ -9,7 +10,6 @@ import {defineMessages, useIntl} from 'react-intl'
import {Platform, Pressable, StyleSheet, Switch, View} from 'react-native'
import {ScrollView} from 'react-native-gesture-handler'
import {SafeAreaView} from 'react-native-safe-area-context'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {Button} from '../../../components/Button/Button'
import {Space} from '../../../components/Space/Space'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/features/Initialization/common/terms.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
import {useAsyncStorage} from '@yoroi/common'
import {useCallback} from 'react'
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'

import {agreementDate} from '../../../kernel/config'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useQuery} from '@tanstack/react-query'
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {ActivityIndicator, StyleSheet, View} from 'react-native'
import Markdown from 'react-native-markdown-display'
import {useQuery} from '@tanstack/react-query'

import {Spacer} from '../../../components/Spacer/Spacer'
import {LanguageCode} from '../../../kernel/i18n/languages'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useQuery} from '@tanstack/react-query'
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {ActivityIndicator, StyleSheet, View} from 'react-native'
import Markdown from 'react-native-markdown-display'
import {useQuery} from '@tanstack/react-query'

import {Spacer} from '../../../components/Spacer/Spacer'
import {LanguageCode} from '../../../kernel/i18n/languages'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {type ViewProps, StyleSheet, Text, View} from 'react-native'
import {StyleSheet, Text, View, type ViewProps} from 'react-native'

import {Icon} from '../../../../components/Icon'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {useQuery, useQueryClient} from '@tanstack/react-query'
import {invalid, isNonNullable} from '@yoroi/common'
import {isPrimaryToken} from '@yoroi/portfolio'
import {Portfolio} from '@yoroi/types'
import {freeze, produce} from 'immer'
import React from 'react'
import {useQuery, useQueryClient} from '@tanstack/react-query'
import {merge, switchMap} from 'rxjs'

import {time} from '../../../kernel/constants'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {Portfolio} from '@yoroi/types'
import {ImageSourcePropType} from 'react-native'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {getDappFallbackLogo} from '../../../Discover/common/helpers'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ImageSourcePropType} from 'react-native'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {ImageSourcePropType} from 'react-native'

import {getDappFallbackLogo} from '../../../Discover/common/helpers'
import {IAsset, mockAmount} from './useGetLiquidityPool'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {isRight} from '@yoroi/common'
import {isPrimaryToken} from '@yoroi/portfolio'
import {Chain, Portfolio} from '@yoroi/types'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {supportedCurrencies, time} from '../../../../kernel/constants'
import {useLanguage} from '../../../../kernel/i18n'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {type Portfolio} from '@yoroi/types'
import {ImageSourcePropType} from 'react-native'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import AdaLogo from '../../../../assets/img/ada.png'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useMutation} from '@tanstack/react-query'
import {Portfolio} from '@yoroi/types'
import {Image} from 'expo-image'
import {useMutation} from '@tanstack/react-query'

import {useSelectedNetwork} from '../../../WalletManager/common/hooks/useSelectedNetwork'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {createUnknownTokenInfo, isPrimaryToken} from '@yoroi/portfolio'
import {Portfolio} from '@yoroi/types'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {StyleSheet, useWindowDimensions, View} from 'react-native'

// @ts-ignore
import ViewTransformer from 'react-native-easy-view-transformer'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
UseMutationOptions,
useQuery,
UseQueryOptions,
} from '@tanstack/react-query'
import {
isBoolean,
parseSafe,
useAsyncStorage,
useMutationWithInvalidations,
} from '@yoroi/common'
import {
UseMutationOptions,
useQuery,
UseQueryOptions,
} from '@tanstack/react-query'

import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'

Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/features/RegisterCatalyst/common/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {Catalyst, useCatalyst} from '@yoroi/staking'
import {App} from '@yoroi/types'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {time} from '../../../kernel/constants'
import {throwLoggedError} from '../../../kernel/logger/helpers/throw-logged-error'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useMutation, UseMutationOptions} from '@tanstack/react-query'
import {useCatalyst} from '@yoroi/staking'
import {useTheme} from '@yoroi/theme'
import React from 'react'
Expand All @@ -9,7 +10,6 @@ import {
ViewProps,
} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context'
import {useMutation, UseMutationOptions} from '@tanstack/react-query'

import {Button} from '../../../../components/Button/Button'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {CredKind} from '@emurgo/cross-csl-core'
import {useQuery} from '@tanstack/react-query'
import {isNonNullable} from '@yoroi/common'
import {infoExtractName} from '@yoroi/portfolio'
import {Portfolio} from '@yoroi/types'
import _ from 'lodash'
import {useQuery} from '@tanstack/react-query'

import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types'
import {deriveRewardAddressFromAddress} from '../../../../yoroi-wallets/cardano/utils'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/features/ReviewTx/common/operations.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useQuery} from '@tanstack/react-query'
import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {Linking, StyleSheet, Text, View} from 'react-native'
import {TouchableOpacity} from 'react-native-gesture-handler'
import {useQuery} from '@tanstack/react-query'

import {Space} from '../../../components/Space/Space'
import {wrappedCsl} from '../../../yoroi-wallets/cardano/wrappedCsl'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/features/Send/common/useSendAddress.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {normalizeToAddress} from '@emurgo/yoroi-lib/dist/internals/utils/addresses'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'
import {useTransfer} from '@yoroi/transfer'
import * as React from 'react'
import {useQuery, UseQueryOptions} from '@tanstack/react-query'

import {CardanoMobile} from '../../../yoroi-wallets/wallets'
import {useSelectedWallet} from '../../WalletManager/common/hooks/useSelectedWallet'
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/src/features/Send/common/useSendReceiver.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useQueryClient} from '@tanstack/react-query'
import {
isDomain,
isNameServer,
Expand All @@ -7,7 +8,6 @@ import {
import {useTransfer} from '@yoroi/transfer'
import {Resolver} from '@yoroi/types'
import * as React from 'react'
import {useQueryClient} from '@tanstack/react-query'

export const useSendReceiver = () => {
const queryClient = useQueryClient()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {useNavigation} from '@react-navigation/native'
import {useMutation} from '@tanstack/react-query'
import {isNft} from '@yoroi/portfolio'
import {useTheme} from '@yoroi/theme'
import {useTransfer} from '@yoroi/transfer'
Expand All @@ -9,7 +10,6 @@ import {defineMessages, useIntl} from 'react-intl'
import {StyleSheet, TouchableOpacity, View, ViewProps} from 'react-native'
import {FlatList} from 'react-native-gesture-handler'
import {SafeAreaView} from 'react-native-safe-area-context'
import {useMutation} from '@tanstack/react-query'

import {Boundary} from '../../../../components/Boundary/Boundary'
import {Button} from '../../../../components/Button/Button'
Expand Down
Loading

0 comments on commit 634991f

Please sign in to comment.