From ca95d5ea68729c72e471958d33a33fa7b75d3e34 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Thu, 2 Nov 2023 18:34:39 +0500 Subject: [PATCH] lint errors less than 80 --- .../tabbedPosts/view/scrollTopPopup.tsx | 2 +- .../tabbedPosts/view/stackedTabBar.tsx | 1 - src/components/tooltip/tooltipView.tsx | 2 +- .../upvotePopover/container/upvotePopover.tsx | 8 +-- src/components/webViewModal/webViewModal.tsx | 4 +- src/containers/inAppPurchaseContainer.tsx | 13 +---- src/containers/transferContainer.js | 5 +- src/navigation/botomTabNavigator.tsx | 2 +- src/providers/ecency/converters.ts | 9 +--- src/providers/ecency/ecency.ts | 4 +- src/providers/ecency/ecency.types.ts | 2 +- src/providers/hive-engine/hiveEngine.ts | 4 +- src/providers/hive/dhive.js | 4 +- .../leaderboardQueries/leaderboardQueries.ts | 8 +-- .../queries/postQueries/postQueries.ts | 25 ++++----- .../queries/walletQueries/walletQueries.ts | 8 +-- src/redux/reducers/accountReducer.ts | 6 ++- src/redux/reducers/applicationReducer.ts | 6 ++- src/redux/reducers/cacheReducer.ts | 54 +++++++++---------- src/redux/reducers/communitiesReducer.js | 6 ++- src/redux/reducers/customTabsReducer.ts | 6 ++- src/redux/reducers/editorReducer.ts | 6 ++- src/redux/reducers/postsReducer.ts | 6 ++- src/redux/reducers/uiReducer.ts | 6 ++- src/redux/reducers/userReducer.js | 6 ++- src/redux/reducers/walkthroughReducer.ts | 6 ++- src/redux/reducers/walletReducer.ts | 6 ++- src/redux/store/store.ts | 2 +- .../assetDetails/children/coinChart.tsx | 2 +- .../children/delegationsModal.tsx | 1 + .../screen/assetDetailsScreen.tsx | 1 - .../assetsSelect/screen/assetsSelect.tsx | 6 +-- .../importPrivateKeyModal.tsx | 1 + .../editHistoryScreen/historyBuilder.tsx | 2 +- .../editor/container/editorContainer.tsx | 7 +-- src/screens/editor/screen/editorScreen.tsx | 14 ++--- 36 files changed, 120 insertions(+), 131 deletions(-) diff --git a/src/components/tabbedPosts/view/scrollTopPopup.tsx b/src/components/tabbedPosts/view/scrollTopPopup.tsx index 93aa46945..a5f36900a 100644 --- a/src/components/tabbedPosts/view/scrollTopPopup.tsx +++ b/src/components/tabbedPosts/view/scrollTopPopup.tsx @@ -40,7 +40,7 @@ const ScrollTopPopup = ({ {popupAvatars.map((url, index) => ( diff --git a/src/components/tabbedPosts/view/stackedTabBar.tsx b/src/components/tabbedPosts/view/stackedTabBar.tsx index 7181988c6..0e103e4c2 100644 --- a/src/components/tabbedPosts/view/stackedTabBar.tsx +++ b/src/components/tabbedPosts/view/stackedTabBar.tsx @@ -11,7 +11,6 @@ export interface TabItem { } interface StackedTabBarProps { - activeTab: boolean; goToPage: (pageIndex) => void; tabs: string[]; pageType?: 'main' | 'community' | 'profile' | 'ownProfile'; diff --git a/src/components/tooltip/tooltipView.tsx b/src/components/tooltip/tooltipView.tsx index a0c06f57a..14f71f7b9 100644 --- a/src/components/tooltip/tooltipView.tsx +++ b/src/components/tooltip/tooltipView.tsx @@ -38,7 +38,7 @@ const Tooltip = ({ children, text, walkthroughIndex }: TooltipProps, ref) => { }, })); - const _findAnchor = (e) => { + const _findAnchor = () => { if (touchableRef.current) { NativeModules.UIManager.measure(touchableRef.current, (x0, y0, width, height, x, y) => { setPopoverAnchor({ x, y, width, height }); diff --git a/src/components/upvotePopover/container/upvotePopover.tsx b/src/components/upvotePopover/container/upvotePopover.tsx index ddad5d37a..d6ecdd2dd 100644 --- a/src/components/upvotePopover/container/upvotePopover.tsx +++ b/src/components/upvotePopover/container/upvotePopover.tsx @@ -10,7 +10,7 @@ import get from 'lodash/get'; // Services and Actions import { Rect } from 'react-native-modal-popover/lib/PopoverGeometry'; -import { View, TouchableOpacity, Text, Alert } from 'react-native'; +import { View, TouchableOpacity, Text } from 'react-native'; import { Popover } from 'react-native-modal-popover'; import Slider from '@esteemapp/react-native-slider'; import { useIntl } from 'react-intl'; @@ -51,7 +51,6 @@ import { CacheStatus } from '../../../redux/reducers/cacheReducer'; import showLoginAlert from '../../../utils/showLoginAlert'; import { delay } from '../../../utils/editor'; -interface Props {} interface PopoverOptions { anchorRect: Rect; content: any; @@ -66,7 +65,8 @@ interface PopoverOptions { * */ -const UpvotePopover = forwardRef(({}: Props, ref) => { +// eslint-disable-next-line no-empty-pattern +const UpvotePopover = forwardRef(({}, ref) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -234,7 +234,7 @@ const UpvotePopover = forwardRef(({}: Props, ref) => { // // when voting with same percent or other errors let errMsg = ''; if (err.message && err.message.indexOf(':') > 0) { - errMsg = err.message.split(': ')[1]; + [, errMsg] = err.message.split(': '); } else { errMsg = err.jse_shortmsg || err.error_description || err.message; } diff --git a/src/components/webViewModal/webViewModal.tsx b/src/components/webViewModal/webViewModal.tsx index 2b6dd7fa5..f36028e8d 100644 --- a/src/components/webViewModal/webViewModal.tsx +++ b/src/components/webViewModal/webViewModal.tsx @@ -5,14 +5,12 @@ import { useAppDispatch, useAppSelector } from '../../hooks'; import { hideWebViewModal } from '../../redux/actions/uiAction'; import { hsOptions } from '../../constants/hsOptions'; import { Modal } from '..'; -import styles from './webViewModalStyles'; -interface QRModalProps {} interface WebViewModalData { uri: string; } -export const WebViewModal = ({}: QRModalProps) => { +export const WebViewModal = () => { const dispatch = useAppDispatch(); const intl = useIntl(); const isVisibleWebViewModal = useAppSelector((state) => state.ui.isVisibleWebViewModal); diff --git a/src/containers/inAppPurchaseContainer.tsx b/src/containers/inAppPurchaseContainer.tsx index 8ec7255c9..5c59f210d 100644 --- a/src/containers/inAppPurchaseContainer.tsx +++ b/src/containers/inAppPurchaseContainer.tsx @@ -85,7 +85,6 @@ class InAppPurchaseContainer extends Component { _consumePurchase = async (purchase) => { const { currentAccount: { name }, - intl, fetchData, username, email, @@ -181,15 +180,7 @@ class InAppPurchaseContainer extends Component { this.purchaseUpdateSubscription = IAP.purchaseUpdatedListener(this._consumePurchase); this.purchaseErrorSubscription = IAP.purchaseErrorListener((error) => { - const { - currentAccount: { name }, - intl, - fetchData, - username, - email, - handleOnPurchaseFailure, - handleOnPurchaseSuccess, - } = this.props; + const { intl, handleOnPurchaseFailure } = this.props; bugsnagInstance.notify(error); if (get(error, 'responseCode') === '3' && Platform.OS === 'android') { @@ -336,7 +327,7 @@ class InAppPurchaseContainer extends Component { }, { text: intl.formatMessage({ id: 'alert.confirm' }), - onPress: async () => await this._buyItem(productId), + onPress: async () => this._buyItem(productId), }, ], headerContent: , diff --git a/src/containers/transferContainer.js b/src/containers/transferContainer.js index 898cd61a4..335a45479 100644 --- a/src/containers/transferContainer.js +++ b/src/containers/transferContainer.js @@ -119,7 +119,8 @@ class TransferContainer extends Component { balance = tokenBalance.stake; break; default: - balance = tokenBalance.balance; + const { balance: _balance } = tokenBalance; + balance = _balance; break; } } @@ -318,7 +319,7 @@ class TransferContainer extends Component { } if (!currentAccount.local) { const realmData = await getUserDataWithUsername(currentAccount.name); - currentAccount.local = realmData[0]; + [currentAccount.local] = realmData; } return func(currentAccount, pinCode, data) diff --git a/src/navigation/botomTabNavigator.tsx b/src/navigation/botomTabNavigator.tsx index bf49dfefa..46b28a624 100644 --- a/src/navigation/botomTabNavigator.tsx +++ b/src/navigation/botomTabNavigator.tsx @@ -3,7 +3,7 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import ROUTES from '../constants/routeNames'; import { BottomTabBar } from '../components'; -import { Feed, Notification, Profile, Wallet } from '../screens'; +import { Feed, Notification, Wallet } from '../screens'; import Waves from '../screens/waves'; const Tab = createBottomTabNavigator(); diff --git a/src/providers/ecency/converters.ts b/src/providers/ecency/converters.ts index d21f66a05..4536aaf57 100644 --- a/src/providers/ecency/converters.ts +++ b/src/providers/ecency/converters.ts @@ -1,13 +1,6 @@ import { ASSET_IDS } from '../../constants/defaultAssets'; import { Referral } from '../../models'; -import { - CommentHistoryItem, - LatestMarketPrices, - LatestQuotes, - QuoteItem, - ReferralStat, - Draft, -} from './ecency.types'; +import { CommentHistoryItem, LatestQuotes, QuoteItem, ReferralStat, Draft } from './ecency.types'; export const convertReferral = (rawData: any) => { return { diff --git a/src/providers/ecency/ecency.ts b/src/providers/ecency/ecency.ts index 7a53568ee..78ef30c7e 100644 --- a/src/providers/ecency/ecency.ts +++ b/src/providers/ecency/ecency.ts @@ -119,7 +119,7 @@ export const deleteDraft = async (draftId: string) => { /** * @param draft */ -export const addDraft = async (draft: Object) => { +export const addDraft = async (draft: any) => { const { title, body, tags, meta } = draft; try { const newDraft = { title, body, tags, meta }; @@ -151,7 +151,7 @@ export const updateDraft = async ( title: string, body: string, tags: string, - meta: Object, + meta: any, ) => { try { const data = { id: draftId, title, body, tags, meta }; diff --git a/src/providers/ecency/ecency.types.ts b/src/providers/ecency/ecency.types.ts index a534f6aef..fe4097ef1 100644 --- a/src/providers/ecency/ecency.types.ts +++ b/src/providers/ecency/ecency.types.ts @@ -52,7 +52,7 @@ export interface Draft { body: string; tags_arr: string[]; tags: string; - meta: Object; + meta: any; modified: string; created: string; timestamp: number; diff --git a/src/providers/hive-engine/hiveEngine.ts b/src/providers/hive-engine/hiveEngine.ts index efb198f2d..e9e6bf3cf 100644 --- a/src/providers/hive-engine/hiveEngine.ts +++ b/src/providers/hive-engine/hiveEngine.ts @@ -57,7 +57,7 @@ export const fetchTokenBalances = (account: string): Promise => return ecencyApi .post(PATH_ENGINE_CONTRACTS, data) .then((r) => r.data.result) - .catch((e) => { + .catch(() => { return []; }); }; @@ -79,7 +79,7 @@ export const fetchTokens = (tokens: string[]): Promise => { return ecencyApi .post(PATH_ENGINE_CONTRACTS, data) .then((r) => r.data.result) - .catch((e) => { + .catch(() => { return []; }); }; diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index 05fac84ac..450f4de1b 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -140,7 +140,9 @@ export const broadcastPostingJSON = async (id, json, currentAccount, pinHash) => accessToken: token, }); - return api.customJson([], [username], id, JSON.stringify(json)).then((r) => r.result); + return api + .customJson([], [currentAccount.username], id, JSON.stringify(json)) + .then((r) => r.result); } if (key) { diff --git a/src/providers/queries/leaderboardQueries/leaderboardQueries.ts b/src/providers/queries/leaderboardQueries/leaderboardQueries.ts index 5168c1f35..87aa872be 100644 --- a/src/providers/queries/leaderboardQueries/leaderboardQueries.ts +++ b/src/providers/queries/leaderboardQueries/leaderboardQueries.ts @@ -5,12 +5,8 @@ import QUERIES from '../queryKeys'; /** hook used to return user drafts */ export const useGetLeaderboardQuery = (duration: 'day' | 'week' | 'month') => { const _getLeaderboard = async () => { - try { - const data = await getLeaderboard(duration); - return data || []; - } catch (err) { - throw err; - } + const data = await getLeaderboard(duration); + return data || []; }; return useQuery([QUERIES.LEADERBOARD.GET, duration], _getLeaderboard); diff --git a/src/providers/queries/postQueries/postQueries.ts b/src/providers/queries/postQueries/postQueries.ts index 29a404343..862087375 100644 --- a/src/providers/queries/postQueries/postQueries.ts +++ b/src/providers/queries/postQueries/postQueries.ts @@ -168,24 +168,17 @@ export const useDiscussionQuery = (_author?: string, _permlink?: string) => { return replies; }; - for (const key in commentsMap) { - if (commentsMap.hasOwnProperty(key)) { - const comment = commentsMap[key]; + Object.keys(commentsMap).forEach((key) => { + const comment = commentsMap[key]; - // prcoess first level comment - if (comment && comment.parent_author === author && comment.parent_permlink === permlink) { - comment.commentKey = key; - comment.level = 1; - comment.repliesThread = parseReplies( - commentsMap, - comment.replies, - key, - comment.level + 1, - ); - comments.push(comment); - } + // prcoess first level comment + if (comment && comment.parent_author === author && comment.parent_permlink === permlink) { + comment.commentKey = key; + comment.level = 1; + comment.repliesThread = parseReplies(commentsMap, comment.replies, key, comment.level + 1); + comments.push(comment); } - } + }); setSectionedData(comments); }; diff --git a/src/providers/queries/walletQueries/walletQueries.ts b/src/providers/queries/walletQueries/walletQueries.ts index 07ba1c57a..49f7da19c 100644 --- a/src/providers/queries/walletQueries/walletQueries.ts +++ b/src/providers/queries/walletQueries/walletQueries.ts @@ -55,7 +55,7 @@ export const useUnclaimedRewardsQuery = () => { const _processCachedData = (rewardsCollection: RewardsCollection) => { if (claimsCollection) { const _curTime = new Date().getTime(); - for (const key in claimsCollection) { + Object.keys(claimsCollection).forEach((key) => { const _claimCache = claimsCollection[key]; const _rewardValue = rewardsCollection[key]; if ( @@ -67,7 +67,7 @@ export const useUnclaimedRewardsQuery = () => { ) { delete rewardsCollection[key]; } - } + }); } return rewardsCollection; @@ -239,11 +239,11 @@ export const useClaimRewardsMutation = () => { return isClaimingColl[assetId] || false; } - for (const key in isClaimingColl) { + Object.keys(isClaimingColl).forEach((key) => { if (isClaimingColl[key] === true) { return true; } - } + }); return false; }; diff --git a/src/redux/reducers/accountReducer.ts b/src/redux/reducers/accountReducer.ts index a6632db20..4d35a7221 100644 --- a/src/redux/reducers/accountReducer.ts +++ b/src/redux/reducers/accountReducer.ts @@ -42,7 +42,7 @@ const initialState: AccountState = { globalProps: null, }; -export default function (state = initialState, action) { +const accountReducer = (state = initialState, action) => { switch (action.type) { case FETCHING_ACCOUNT: return { @@ -134,4 +134,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default accountReducer; diff --git a/src/redux/reducers/applicationReducer.ts b/src/redux/reducers/applicationReducer.ts index ab334b805..7515024ec 100644 --- a/src/redux/reducers/applicationReducer.ts +++ b/src/redux/reducers/applicationReducer.ts @@ -115,7 +115,7 @@ const initialState: State = { isBiometricEnabled: false, }; -export default function (state = initialState, action): State { +const applicationReducer = (state = initialState, action): State => { switch (action.type) { case LOGIN: return { @@ -302,4 +302,6 @@ export default function (state = initialState, action): State { default: return state; } -} +}; + +export default applicationReducer; diff --git a/src/redux/reducers/cacheReducer.ts b/src/redux/reducers/cacheReducer.ts index fcc42ed0e..e1f409fe4 100644 --- a/src/redux/reducers/cacheReducer.ts +++ b/src/redux/reducers/cacheReducer.ts @@ -111,7 +111,7 @@ const initialState: State = { lastUpdate: null, }; -export default function (state = initialState, action) { +const cacheReducer = (state = initialState, action) => { const { type, payload } = action; switch (type) { case UPDATE_VOTE_CACHE: @@ -252,47 +252,39 @@ export default function (state = initialState, action) { const currentTime = new Date().getTime(); if (state.votesCollection) { - for (const key in state.votesCollection) { - if (state.votesCollection.hasOwnProperty(key)) { - const vote = state.votesCollection[key]; - if (vote && (vote?.expiresAt || 0) < currentTime) { - delete state.votesCollection[key]; - } + Object.keys(state.votesCollection).forEach((key) => { + const vote = state.votesCollection[key]; + if (vote && (vote?.expiresAt || 0) < currentTime) { + delete state.votesCollection[key]; } - } + }); } if (state.commentsCollection) { - for (const key in state.commentsCollection) { - if (state.commentsCollection.hasOwnProperty(key)) { - const comment = state.commentsCollection[key]; - if (comment && (comment?.expiresAt || 0) < currentTime) { - delete state.commentsCollection[key]; - } + Object.keys(state.commentsCollection).forEach((key) => { + const comment = state.commentsCollection[key]; + if (comment && (comment?.expiresAt || 0) < currentTime) { + delete state.commentsCollection[key]; } - } + }); } if (state.draftsCollection) { - for (const key in state.draftsCollection) { - if (state.draftsCollection.hasOwnProperty(key)) { - const draft = state.draftsCollection[key]; - if (draft && ((draft?.expiresAt || 0) < currentTime || !draft.body)) { - delete state.draftsCollection[key]; - } + Object.keys(state.draftsCollection).forEach((key) => { + const draft = state.draftsCollection[key]; + if (draft && ((draft?.expiresAt || 0) < currentTime || !draft.body)) { + delete state.draftsCollection[key]; } - } + }); } if (state.claimsCollection) { - for (const key in state.claimsCollection) { - if (state.claimsCollection.hasOwnProperty(key)) { - const claim = state.claimsCollection[key]; - if (claim && (claim?.expiresAt || 0) < currentTime) { - delete state.claimsCollection[key]; - } + Object.keys(state.claimsCollection).forEach((key) => { + const claim = state.claimsCollection[key]; + if (claim && (claim?.expiresAt || 0) < currentTime) { + delete state.claimsCollection[key]; } - } + }); } if (state.subscribedCommunities && state.subscribedCommunities.size) { @@ -309,4 +301,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default cacheReducer; diff --git a/src/redux/reducers/communitiesReducer.js b/src/redux/reducers/communitiesReducer.js index da73f696b..82444bbb7 100644 --- a/src/redux/reducers/communitiesReducer.js +++ b/src/redux/reducers/communitiesReducer.js @@ -56,7 +56,7 @@ const initialState = { }, }; -export default function (state = initialState, action) { +const communitiesReducer = (state = initialState, action) => { switch (action.type) { case FETCH_COMMUNITIES: return { @@ -460,4 +460,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default communitiesReducer; diff --git a/src/redux/reducers/customTabsReducer.ts b/src/redux/reducers/customTabsReducer.ts index a9aec8ef3..d80f80202 100644 --- a/src/redux/reducers/customTabsReducer.ts +++ b/src/redux/reducers/customTabsReducer.ts @@ -25,7 +25,7 @@ const initialState: State = { ownProfileTabs: DEFAULT_OWN_PROFILE_FILTERS, }; -export default function (state: State = initialState, action): State { +const customTabsReducer = (state: State = initialState, action): State => { switch (action.type) { case SET_MAIN_TABS: return { @@ -54,4 +54,6 @@ export default function (state: State = initialState, action): State { default: return state; } -} +}; + +export default customTabsReducer; diff --git a/src/redux/reducers/editorReducer.ts b/src/redux/reducers/editorReducer.ts index 0a7e0edad..07be23fb4 100644 --- a/src/redux/reducers/editorReducer.ts +++ b/src/redux/reducers/editorReducer.ts @@ -17,7 +17,7 @@ const initialState: State = { beneficiariesMap: {}, }; -export default function (state = initialState, action) { +const editorReducer = (state = initialState, action) => { const { type, payload } = action; switch (type) { case SET_BENEFICIARIES: @@ -33,4 +33,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default editorReducer; diff --git a/src/redux/reducers/postsReducer.ts b/src/redux/reducers/postsReducer.ts index 4640e8a6f..caff15390 100644 --- a/src/redux/reducers/postsReducer.ts +++ b/src/redux/reducers/postsReducer.ts @@ -20,7 +20,7 @@ const initialState = { feedScreenFilters: DEFAULT_FEED_FILTERS, }; -export default function (state = initialState, action) { +const postsReducer = (state = initialState, action) => { switch (action.type) { case SET_FEED_POSTS: return { @@ -75,4 +75,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default postsReducer; diff --git a/src/redux/reducers/uiReducer.ts b/src/redux/reducers/uiReducer.ts index a20bc0341..757fc6264 100644 --- a/src/redux/reducers/uiReducer.ts +++ b/src/redux/reducers/uiReducer.ts @@ -63,7 +63,7 @@ const initialState: UiState = { isLogingOut: false, }; -export default function (state = initialState, action): UiState { +const uiReducer = (state = initialState, action): UiState => { switch (action.type) { case UPDATE_ACTIVE_BOTTOM_TAB: return { @@ -179,4 +179,6 @@ export default function (state = initialState, action): UiState { default: return state; } -} +}; + +export default uiReducer; diff --git a/src/redux/reducers/userReducer.js b/src/redux/reducers/userReducer.js index 8e0bd3893..728aac9c7 100644 --- a/src/redux/reducers/userReducer.js +++ b/src/redux/reducers/userReducer.js @@ -25,7 +25,7 @@ const initialState = { }, }; -export default function (state = initialState, action) { +const userReducer = (state = initialState, action) => { switch (action.type) { case FOLLOW_USER: return { @@ -129,4 +129,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default userReducer; diff --git a/src/redux/reducers/walkthroughReducer.ts b/src/redux/reducers/walkthroughReducer.ts index 39389b5f4..b5671146b 100644 --- a/src/redux/reducers/walkthroughReducer.ts +++ b/src/redux/reducers/walkthroughReducer.ts @@ -11,7 +11,7 @@ interface State { const initialState: State = { walkthroughMap: new Map(), }; -export default function (state = initialState, action) { +const walkthroughReducer = (state = initialState, action) => { // console.log('action : ', action); const { type, payload } = action; @@ -28,4 +28,6 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default walkthroughReducer; diff --git a/src/redux/reducers/walletReducer.ts b/src/redux/reducers/walletReducer.ts index 72789fe17..4f5b87986 100644 --- a/src/redux/reducers/walletReducer.ts +++ b/src/redux/reducers/walletReducer.ts @@ -95,7 +95,7 @@ const initialState: State = { updateTimestamp: 0, }; -export default function (state = initialState, action) { +const walletReducer = (state = initialState, action) => { const { type, payload } = action; switch (type) { case RESET_WALLET_DATA: { @@ -148,7 +148,9 @@ export default function (state = initialState, action) { default: return state; } -} +}; + +export default walletReducer; const ONE_HOUR_MS = 60 * 60 * 1000; const TEN_MIN_MS = 60 * 10 * 1000; diff --git a/src/redux/store/store.ts b/src/redux/store/store.ts index 387f6b64a..126445777 100644 --- a/src/redux/store/store.ts +++ b/src/redux/store/store.ts @@ -2,7 +2,7 @@ import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import { createMigrate, createTransform, persistReducer, persistStore } from 'redux-persist'; -import AsyncStorage from '@react-native-community/async-storage'; +import AsyncStorage from '@react-native-async-storage/async-storage'; import Reactotron from '../../../reactotron-config'; import reducers from '../reducers'; diff --git a/src/screens/assetDetails/children/coinChart.tsx b/src/screens/assetDetails/children/coinChart.tsx index 1f9ce9b99..ce62def89 100644 --- a/src/screens/assetDetails/children/coinChart.tsx +++ b/src/screens/assetDetails/children/coinChart.tsx @@ -3,7 +3,7 @@ import { View } from 'react-native'; import { RangeSelector } from '.'; import { SimpleChart } from '../../../components'; import { useAppSelector } from '../../../hooks'; -import { ChartInterval, fetchMarketChart } from '../../../providers/coingecko/coingecko'; +import { fetchMarketChart } from '../../../providers/coingecko/coingecko'; import { fetchEngineMarketData } from '../../../providers/hive-engine/hiveEngine'; import getWindowDimensions from '../../../utils/getWindowDimensions'; import styles, { CHART_NEGATIVE_MARGIN } from './children.styles'; diff --git a/src/screens/assetDetails/children/delegationsModal.tsx b/src/screens/assetDetails/children/delegationsModal.tsx index af8a23a0a..412a58720 100644 --- a/src/screens/assetDetails/children/delegationsModal.tsx +++ b/src/screens/assetDetails/children/delegationsModal.tsx @@ -25,6 +25,7 @@ interface DelegationItem { timestamp: string; } +// eslint-disable-next-line no-empty-pattern export const DelegationsModal = forwardRef(({}, ref) => { const intl = useIntl(); const navigation = useNavigation>(); diff --git a/src/screens/assetDetails/screen/assetDetailsScreen.tsx b/src/screens/assetDetails/screen/assetDetailsScreen.tsx index 3dfb8271d..058c631eb 100644 --- a/src/screens/assetDetails/screen/assetDetailsScreen.tsx +++ b/src/screens/assetDetails/screen/assetDetailsScreen.tsx @@ -15,7 +15,6 @@ import { DelegationsModal, MODES } from '../children/delegationsModal'; import TransferTypes from '../../../constants/transferTypes'; import { walletQueries } from '../../../providers/queries'; import parseToken from '../../../utils/parseToken'; -import { log } from '../../../../reactotron-config'; export interface AssetDetailsScreenParams { coinId: string; diff --git a/src/screens/assetsSelect/screen/assetsSelect.tsx b/src/screens/assetsSelect/screen/assetsSelect.tsx index 07f0b091f..6488511bd 100644 --- a/src/screens/assetsSelect/screen/assetsSelect.tsx +++ b/src/screens/assetsSelect/screen/assetsSelect.tsx @@ -55,8 +55,8 @@ const AssetsSelect = ({ navigation }) => { useEffect(() => { const data: CoinData[] = []; - for (const key in coinsData) { - if (coinsData.hasOwnProperty(key) && (coinsData[key].isEngine || coinsData[key].isSpk)) { + Object.keys(coinsData).forEach((key) => { + if (coinsData[key].isEngine || coinsData[key].isSpk) { const asset: CoinData = coinsData[key]; const _name = asset.name.toLowerCase(); const _symbol = asset.symbol.toLowerCase(); @@ -69,7 +69,7 @@ const AssetsSelect = ({ navigation }) => { data.push(asset); } } - } + }); setListData(data); _updateSortedList({ data }); diff --git a/src/screens/backupKeysScreen/importPrivateKeyModal.tsx b/src/screens/backupKeysScreen/importPrivateKeyModal.tsx index 9ffea3b25..04bfd4cd1 100644 --- a/src/screens/backupKeysScreen/importPrivateKeyModal.tsx +++ b/src/screens/backupKeysScreen/importPrivateKeyModal.tsx @@ -14,6 +14,7 @@ import { getUpdatedUserKeys } from '../../providers/hive/auth'; import { getDigitPinCode } from '../../providers/hive/dhive'; import { updateCurrentAccount } from '../../redux/actions/accountAction'; +// eslint-disable-next-line no-empty-pattern export const ImportPrivateKeyModalModal = forwardRef(({}, ref) => { const intl = useIntl(); const dispatch = useDispatch(); diff --git a/src/screens/editHistoryScreen/historyBuilder.tsx b/src/screens/editHistoryScreen/historyBuilder.tsx index 0cad12a53..c0fb013e3 100644 --- a/src/screens/editHistoryScreen/historyBuilder.tsx +++ b/src/screens/editHistoryScreen/historyBuilder.tsx @@ -16,7 +16,7 @@ export default (raw: CommentHistoryItem[]) => { for (let l = 0; l < raw.length; l += 1) { if (raw[l].body.startsWith('@@')) { const p = dmp.patch_fromText(raw[l].body); - h = dmp.patch_apply(p, h)[0]; + [h] = dmp.patch_apply(p, h); raw[l].body = h; } else { h = raw[l].body; diff --git a/src/screens/editor/container/editorContainer.tsx b/src/screens/editor/container/editorContainer.tsx index ab0c98925..912499e95 100644 --- a/src/screens/editor/container/editorContainer.tsx +++ b/src/screens/editor/container/editorContainer.tsx @@ -107,10 +107,11 @@ class EditorContainer extends Component { if (route.params) { const navigationParams = route.params; - hasSharedIntent = navigationParams.hasSharedIntent; + const { hasSharedIntent: _hasShared, draftId: _draftId } = navigationParams; + hasSharedIntent = _hasShared; - if (navigationParams.draftId) { - draftId = navigationParams.draftId; + if (_draftId) { + draftId = _draftId; const cachedDrafts: any = queryClient.getQueryData([QUERIES.DRAFTS.GET]); if (cachedDrafts && cachedDrafts.length) { diff --git a/src/screens/editor/screen/editorScreen.tsx b/src/screens/editor/screen/editorScreen.tsx index 7c15d0c15..297470766 100644 --- a/src/screens/editor/screen/editorScreen.tsx +++ b/src/screens/editor/screen/editorScreen.tsx @@ -72,13 +72,6 @@ class EditorScreen extends Component { } } - componentWillUnmount() { - const { isEdit } = this.props; - if (!isEdit) { - this._saveDraftToDB(); - } - } - componentDidUpdate(prevProps, prevState) { const { isUploadingProp, communityProp } = this.state; if (prevState.isUploadingProp !== isUploadingProp) { @@ -91,6 +84,13 @@ class EditorScreen extends Component { } } + componentWillUnmount() { + const { isEdit } = this.props; + if (!isEdit) { + this._saveDraftToDB(); + } + } + static getDerivedStateFromProps(nextProps, prevState) { // shoudl update state const stateUpdate: any = {};