From 12b6b1adcea69692a1a5bcbbb9f5b81a6383bea7 Mon Sep 17 00:00:00 2001
From: apostolof <apotwohd@gmail.com>
Date: Thu, 1 Apr 2021 18:48:41 +0300
Subject: [PATCH] refactor: resolve lint warnings

---
 .../components/PostList/PostListRow/index.jsx |  4 ++-
 .../components/PostList/PostVoting/index.jsx  | 25 +++++++++++++------
 .../TopicList/TopicListRow/index.jsx          |  9 +++++--
 .../src/components/UsernameSelector.jsx       | 10 +++++++-
 .../src/views/Profile/GeneralTab/index.jsx    |  6 ++++-
 .../views/Profile/ProfilePostList/index.jsx   |  6 +++--
 .../views/Profile/ProfileTopicList/index.jsx  |  6 +++--
 .../Topic/TopicView/TopicPostList/index.jsx   |  6 +++--
 8 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx
index 2c1e9c1..02c3d53 100644
--- a/packages/concordia-app/src/components/PostList/PostListRow/index.jsx
+++ b/packages/concordia-app/src/components/PostList/PostListRow/index.jsx
@@ -23,7 +23,9 @@ import './styles.css';
 
 const { orbit } = breeze;
 
-const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { clearCacheCall: clearGetPostChainData } } } } } = drizzle;
+const {
+  contracts: { [FORUM_CONTRACT]: { methods: { getPost: { clearCacheCall: clearGetPostChainData } } } },
+} = drizzle;
 
 const PostListRow = (props) => {
   const {
diff --git a/packages/concordia-app/src/components/PostList/PostVoting/index.jsx b/packages/concordia-app/src/components/PostList/PostVoting/index.jsx
index a4a780d..40e428c 100644
--- a/packages/concordia-app/src/components/PostList/PostVoting/index.jsx
+++ b/packages/concordia-app/src/components/PostList/PostVoting/index.jsx
@@ -32,7 +32,8 @@ const PostVoting = (props) => {
   // Current votes
   const [getVoteInfoCallHash, setGetVoteInfoCallHash] = useState(null);
 
-  const getVoteInfoResult = useSelector((state) => state.contracts[POST_VOTING_CONTRACT].getVoteInfo[getVoteInfoCallHash]);
+  const getVoteInfoResult = useSelector((state) => state.contracts[POST_VOTING_CONTRACT]
+    .getVoteInfo[getVoteInfoCallHash]);
 
   const [ownVote, setOwnVote] = useState(null);
   const [totalVoteCount, setTotalVoteCount] = useState(null);
@@ -77,13 +78,22 @@ const PostVoting = (props) => {
     if (voting) return;
 
     setVoting(true);
-    if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_DOWN) && choice === CHOICE_UP) setVoteCacheSendStackId(upvote.cacheSend(postId, { from: userAccount }));
-    else if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_UP) && choice === CHOICE_DOWN) setVoteCacheSendStackId(downvote.cacheSend(postId, { from: userAccount }));
-    else if ((ownVote === CHOICE_UP && choice === CHOICE_UP) || (ownVote === CHOICE_DOWN && choice === CHOICE_DOWN)) setVoteCacheSendStackId(unvote.cacheSend(postId, { from: userAccount }));
-    else setVoting(false);
+
+    if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_DOWN) && choice === CHOICE_UP) {
+      setVoteCacheSendStackId(upvote.cacheSend(postId, { from: userAccount }));
+    } else if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_UP) && choice === CHOICE_DOWN) {
+      setVoteCacheSendStackId(downvote.cacheSend(postId, { from: userAccount }));
+    } else if ((ownVote === CHOICE_UP && choice === CHOICE_UP) || (ownVote === CHOICE_DOWN && choice === CHOICE_DOWN)) {
+      setVoteCacheSendStackId(unvote.cacheSend(postId, { from: userAccount }));
+    } else {
+      setVoting(false);
+    }
   }, [ownVote, postId, userAccount, voting]);
 
-  const disableVoting = userAccount === null || !hasSignedUp || postAuthorAddress === null || userAccount === postAuthorAddress;
+  const disableVoting = userAccount === null
+      || !hasSignedUp
+      || postAuthorAddress === null
+      || userAccount === postAuthorAddress;
 
   // Clear when unmounting
   useEffect(() => () => clearGetVoteInfoChainData(postId), [postId]);
@@ -107,7 +117,8 @@ const PostVoting = (props) => {
                         &nbsp;&nbsp;
                 </span>
             )}
-            disabled={(upvoteCount === null && downvoteCount === null) || (upvoteCount === '0' && downvoteCount === '0')}
+            disabled={(upvoteCount === null && downvoteCount === null)
+            || (upvoteCount === '0' && downvoteCount === '0')}
             position="bottom center"
           >
               {upvoteCount !== '0' ? (
diff --git a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
index 02d7388..6a683c5 100644
--- a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
+++ b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
@@ -23,7 +23,9 @@ import targetBlank from '../../../utils/markdownUtils';
 
 const { orbit } = breeze;
 
-const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { clearCacheCall: clearGetTopicChainData } } } } } = drizzle;
+const {
+  contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { clearCacheCall: clearGetTopicChainData } } } },
+} = drizzle;
 
 const TopicListRow = (props) => {
   const { id: topicId, topicCallHash, loading } = props;
@@ -177,7 +179,10 @@ const TopicListRow = (props) => {
             </Segment>
         </Dimmer.Dimmable>
     );
-  }, [history, loading, numberOfReplies, t, timeAgo, topicAuthor, topicAuthorAddress, topicAuthorMeta, topicId, topicSubject]);
+  }, [
+    history, loading, numberOfReplies, t, timeAgo, topicAuthor, topicAuthorAddress, topicAuthorMeta, topicId,
+    topicSubject,
+  ]);
 };
 
 TopicListRow.defaultProps = {
diff --git a/packages/concordia-app/src/components/UsernameSelector.jsx b/packages/concordia-app/src/components/UsernameSelector.jsx
index 8c12680..df2591b 100644
--- a/packages/concordia-app/src/components/UsernameSelector.jsx
+++ b/packages/concordia-app/src/components/UsernameSelector.jsx
@@ -9,7 +9,15 @@ import PropTypes from 'prop-types';
 import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
 import { drizzle } from '../redux/store';
 
-const { contracts: { [FORUM_CONTRACT]: { methods: { isUserNameTaken: { cacheCall: isUserNameTakenChainData, clearCacheCall: clearIsUserNameTakenChainData } } } } } = drizzle;
+const {
+  contracts: {
+    [FORUM_CONTRACT]: {
+      methods: {
+        isUserNameTaken: { cacheCall: isUserNameTakenChainData, clearCacheCall: clearIsUserNameTakenChainData },
+      },
+    },
+  },
+} = drizzle;
 
 const UsernameSelector = (props) => {
   const {
diff --git a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx
index eb956e3..12d3c84 100644
--- a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx
+++ b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx
@@ -200,7 +200,11 @@ const GeneralTab = (props) => {
           </Table>
           {isSelf && editInformationModal}
       </>
-  ), [editInformationModal, isSelf, numberOfPosts, numberOfTopics, profileAddress, profileMetadataFetched, t, userAvatarUrl, userInfoOrbitAddress, userLocationCell, userPollsOrbitAddress, userPostsOrbitAddress, userRegistrationTimestamp, userTopicsOrbitAddress, username]);
+  ), [
+    editInformationModal, isSelf, numberOfPosts, numberOfTopics, profileAddress, profileMetadataFetched, t,
+    userAvatarUrl, userInfoOrbitAddress, userLocationCell, userPollsOrbitAddress, userPostsOrbitAddress,
+    userRegistrationTimestamp, userTopicsOrbitAddress, username,
+  ]);
 };
 
 GeneralTab.defaultProps = {
diff --git a/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx b/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx
index 3436aea..0e08d83 100644
--- a/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx
+++ b/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx
@@ -30,8 +30,10 @@ const ProfilePostList = (props) => {
   const [getUserPostCountCallHash, setGetUserPostCountCallHash] = useState(null);
   const [getUserPostsCallHash, setGetUserPostsCallHash] = useState(null);
 
-  const getUserPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserPostCount[getUserPostCountCallHash]);
-  const getUserPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserPosts[getUserPostsCallHash]);
+  const getUserPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getUserPostCount[getUserPostCountCallHash]);
+  const getUserPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getUserPosts[getUserPostsCallHash]);
 
   const { t } = useTranslation();
 
diff --git a/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx b/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx
index c51aa51..db1c419 100644
--- a/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx
+++ b/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx
@@ -30,8 +30,10 @@ const ProfileTopicList = (props) => {
   const [getUserTopicCountCallHash, setGetUserTopicCountCallHash] = useState(null);
   const [getUserTopicsCallHash, setGetUserTopicsCallHash] = useState(null);
 
-  const getUserTopicCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserTopicCount[getUserTopicCountCallHash]);
-  const getUserTopicsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserTopics[getUserTopicsCallHash]);
+  const getUserTopicCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getUserTopicCount[getUserTopicCountCallHash]);
+  const getUserTopicsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getUserTopics[getUserTopicsCallHash]);
 
   const { t } = useTranslation();
 
diff --git a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx
index efbc90b..2b80fe0 100644
--- a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx
+++ b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx
@@ -30,8 +30,10 @@ const TopicPostList = (props) => {
   const [getTopicPostCountCallHash, setGetTopicPostCountCallHash] = useState(null);
   const [getTopicPostsCallHash, setGetTopicPostsCallHash] = useState(null);
 
-  const getTopicPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getTopicPostCount[getTopicPostCountCallHash]);
-  const getTopicPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getTopicPosts[getTopicPostsCallHash]);
+  const getTopicPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getTopicPostCount[getTopicPostCountCallHash]);
+  const getTopicPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
+    .getTopicPosts[getTopicPostsCallHash]);
 
   useEffect(() => {
     if (getTopicPostCountCallHash === null) {