From 891207df3d8031ad19335045a7870e82ec5112f9 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 25 Feb 2021 14:23:23 +0800 Subject: [PATCH] Lint Separating out the lint fixes just to make the next commmit clearer. --- ui/component/fileRenderInline/index.js | 2 +- ui/redux/actions/file.js | 6 +++--- ui/redux/selectors/content.js | 25 +++++++++++++------------ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ui/component/fileRenderInline/index.js b/ui/component/fileRenderInline/index.js index ca2828ede..326144329 100644 --- a/ui/component/fileRenderInline/index.js +++ b/ui/component/fileRenderInline/index.js @@ -13,7 +13,7 @@ const select = (state, props) => ({ renderMode: makeSelectFileRenderModeForUri(props.uri)(state), }); -const perform = dispatch => ({ +const perform = (dispatch) => ({ triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)), claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()), }); diff --git a/ui/redux/actions/file.js b/ui/redux/actions/file.js index 4bd3bb1b6..25b421061 100644 --- a/ui/redux/actions/file.js +++ b/ui/redux/actions/file.js @@ -22,7 +22,7 @@ export function doOpenFileInFolder(path) { } export function doOpenFileInShell(path) { - return dispatch => { + return (dispatch) => { const success = shell.openPath(path); if (!success) { dispatch(doOpenFileInFolder(path)); @@ -31,7 +31,7 @@ export function doOpenFileInShell(path) { } export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim, cb) { - return dispatch => { + return (dispatch) => { if (abandonClaim) { const [txid, nout] = outpoint.split(':'); dispatch(doAbandonClaim(txid, Number(nout), cb)); @@ -67,7 +67,7 @@ export function doDeleteFileAndMaybeGoBack(uri, deleteFromComputer, abandonClaim } actions.push( - doDeleteFile(outpoint || claimOutpoint, deleteFromComputer, abandonClaim, abandonState => { + doDeleteFile(outpoint || claimOutpoint, deleteFromComputer, abandonClaim, (abandonState) => { if (abandonState === ABANDON_STATES.DONE) { if (abandonClaim) { dispatch(goBack()); diff --git a/ui/redux/selectors/content.js b/ui/redux/selectors/content.js index 1dea951c1..2e1b355db 100644 --- a/ui/redux/selectors/content.js +++ b/ui/redux/selectors/content.js @@ -25,10 +25,11 @@ const HISTORY_ITEMS_PER_PAGE = 50; export const selectState = (state: any) => state.content || {}; -export const selectPlayingUri = createSelector(selectState, state => state.playingUri); -export const selectPrimaryUri = createSelector(selectState, state => state.primaryUri); +export const selectPlayingUri = createSelector(selectState, (state) => state.playingUri); +export const selectPrimaryUri = createSelector(selectState, (state) => state.primaryUri); -export const makeSelectIsPlaying = (uri: string) => createSelector(selectPrimaryUri, primaryUri => primaryUri === uri); +export const makeSelectIsPlaying = (uri: string) => + createSelector(selectPrimaryUri, (primaryUri) => primaryUri === uri); export const makeSelectIsPlayerFloating = (location: UrlLocation) => createSelector(selectPrimaryUri, selectPlayingUri, selectClaimsByUri, (primaryUri, playingUri, claimsByUri) => { @@ -55,9 +56,9 @@ export const makeSelectContentPositionForUri = (uri: string) => return state.positions[id] ? state.positions[id][outpoint] : null; }); -export const selectHistory = createSelector(selectState, state => state.history || []); +export const selectHistory = createSelector(selectState, (state) => state.history || []); -export const selectHistoryPageCount = createSelector(selectHistory, history => +export const selectHistoryPageCount = createSelector(selectHistory, (history) => Math.ceil(history.length / HISTORY_ITEMS_PER_PAGE) ); @@ -69,10 +70,10 @@ export const makeSelectHistoryForPage = (page: number) => }); export const makeSelectHistoryForUri = (uri: string) => - createSelector(selectHistory, history => history.find(i => i.uri === uri)); + createSelector(selectHistory, (history) => history.find((i) => i.uri === uri)); export const makeSelectHasVisitedUri = (uri: string) => - createSelector(makeSelectHistoryForUri(uri), history => Boolean(history)); + createSelector(makeSelectHistoryForUri(uri), (history) => Boolean(history)); export const makeSelectNextUnplayedRecommended = (uri: string) => createSelector( @@ -118,11 +119,11 @@ export const makeSelectNextUnplayedRecommended = (uri: string) => } const channel = claim && claim.signing_channel; - if (channel && blockedChannels.some(blockedUri => blockedUri === channel.permanent_url)) { + if (channel && blockedChannels.some((blockedUri) => blockedUri === channel.permanent_url)) { continue; } - if (!history.some(item => item.uri === recommendedForUri[i])) { + if (!history.some((item) => item.uri === recommendedForUri[i])) { return recommendedForUri[i]; } } @@ -130,12 +131,12 @@ export const makeSelectNextUnplayedRecommended = (uri: string) => } ); -export const selectRecentHistory = createSelector(selectHistory, history => { +export const selectRecentHistory = createSelector(selectHistory, (history) => { return history.slice(0, RECENT_HISTORY_AMOUNT); }); export const makeSelectCategoryListUris = (uris: ?Array, channel: string) => - createSelector(makeSelectClaimsInChannelForCurrentPageState(channel), channelClaims => { + createSelector(makeSelectClaimsInChannelForCurrentPageState(channel), (channelClaims) => { if (uris) return uris; if (channelClaims) { @@ -153,7 +154,7 @@ export const makeSelectShouldObscurePreview = (uri: string) => // should probably be in lbry-redux, yarn link was fighting me export const makeSelectFileExtensionForUri = (uri: string) => - createSelector(makeSelectFileNameForUri(uri), fileName => { + createSelector(makeSelectFileNameForUri(uri), (fileName) => { return fileName && path.extname(fileName).substring(1); });