fix all eslint warnings

This commit is contained in:
Tom
2023-04-25 21:30:10 +02:00
parent 323ec1e6c0
commit 610ea65c67
14 changed files with 144 additions and 83 deletions
+22 -22
View File
@@ -1,6 +1,6 @@
import React from 'react';
import ReactMarkdown from 'react-markdown';
import { Link } from 'react-router-dom';
// import { Link } from 'react-router-dom';
import rehypeSanitize from 'rehype-sanitize';
import breaks from 'remark-breaks';
@@ -28,28 +28,28 @@ const blockquoteToGreentext = () => (tree) => {
});
};
const createQuotelink = (handlequoteclick, comment, children) => {
const text = children.map((child) => (typeof child === 'string' ? child : child.props.children)).join('');
const regex = /(\s|^)(c\/[A-Za-z0-9]{12}|c\/[A-Za-z0-9]{45})(?=\s|$)/g;
const parts = text.split(regex);
// const createQuotelink = (handlequoteclick, comment, children) => {
// const text = children.map((child) => (typeof child === 'string' ? child : child.props.children)).join('');
// const regex = /(\s|^)(c\/[A-Za-z0-9]{12}|c\/[A-Za-z0-9]{45})(?=\s|$)/g;
// const parts = text.split(regex);
return parts.flatMap((part, i) => {
if (regex.test(part)) {
return [
<Link
key={`link-${i}`}
className="quotelink"
to=""
onClick={handlequoteclick}
>
{part.trim()}
</Link>,
];
} else {
return [part];
}
});
};
// return parts.flatMap((part, i) => {
// if (regex.test(part)) {
// return [
// <Link
// key={`link-${i}`}
// className="quotelink"
// to=""
// onClick={handlequoteclick}
// >
// {part.trim()}
// </Link>,
// ];
// } else {
// return [part];
// }
// });
// };
const Post = ({ content, handlequoteclick, comment }) => {
+2 -2
View File
@@ -83,7 +83,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
if (index !== undefined) {
setPendingCommentIndex(index);
}
}, [index, location]);
}, [index, location, setPendingCommentIndex]);
const resetFields = () => {
@@ -116,7 +116,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
closeModal();
})();
}
}, [publishCommentOptions]);
}, [publishCommentOptions, closeModal, publishComment]);
const getChallengeAnswersFromUser = async (challenges) => {
+45 -14
View File
@@ -220,7 +220,10 @@ export const NavBar = styled.div`
background-color: #ddd;
border-bottom: 2px solid #ccc;
}`;
}
default:
return '';
}
}}`;
export const Header = styled.div`
@@ -410,7 +413,10 @@ export const Header = styled.div`
margin-top: 5px;
font-size: 9pt;
}`;
}
default:
return '';
}
}}
`;
@@ -445,8 +451,11 @@ export const Break = styled.hr`
return `width: 90%;
border: none;
border-top: 1px solid #ddd;
height: 0;`;
}
height: 0;`;
default:
return '';
}
}}
`;
@@ -600,7 +609,9 @@ export const PostFormLink = styled.div`
color: #333 !important;
white-space: nowrap;
}`;
default:
return '';
}
}}
`;
@@ -1123,7 +1134,10 @@ export const PostFormTable = styled.table`
width: 100%
}
}`;
}
default:
return '';
}
}}
#t-help {
@@ -1224,8 +1238,10 @@ export const PostForm = styled.div`
a:hover {
color: #ff3300;
}`;
}
default:
return '';
}
}}
`;
@@ -1369,8 +1385,10 @@ export const TopBar = styled.div`
a:hover {
color: #ff3300;
}`;
}
default:
return '';
}
}}
@media (min-width: 480px) {
@@ -1533,6 +1551,9 @@ export const TopBar = styled.div`
color: #333 !important;
white-space: nowrap;
}`;
default:
return '';
}
}}
`;
@@ -1598,8 +1619,10 @@ export const BoardForm = styled.div`
background-color: #ccc !important;
border: 1px solid #ccc !important;
}`;
}
default:
return '';
}
}}
}
@@ -2873,8 +2896,10 @@ export const BoardForm = styled.div`
border-top: 1px solid #ddd;
height: 0;
}`;
}
default:
return '';
}
}}
@media (max-width: 480px) {
@@ -2934,6 +2959,9 @@ export const BoardForm = styled.div`
return `.highlighted {
background-color: #ccc !important;
}`;
default:
return '';
}
}}
@@ -3635,6 +3663,9 @@ export const BoardForm = styled.div`
}
}
}`;
default:
return '';
}
}}
}
@@ -236,6 +236,9 @@ export const StyledModal = styled(Modal)`
span {
color: #333;
}`;
}
default:
return '';
}
}}
`;
+4 -1
View File
@@ -254,6 +254,9 @@ export const StyledModal = styled(Modal)`
span {
color: #000;
}`;
}
default:
return '';
}
}}
`;
@@ -364,7 +364,9 @@ export const StyledModal = styled(Modal)`
color: #f30 !important;
}
}`;
}
default:
return '';
}
}}
`;
+30 -10
View File
@@ -164,6 +164,9 @@ export const ReplyFormLink = styled.div`
color: #333 !important;
white-space: nowrap;
}`;
default:
return '';
}
}}
`;
@@ -386,7 +389,8 @@ export const TopBar = styled.div`
color: #ff3300 !important;
}
}`;
default:
return '';
}
}}
@@ -514,7 +518,9 @@ export const TopBar = styled.div`
color: #333 !important;
white-space: nowrap;
}`;
default:
return '';
}
}}
`;
@@ -678,7 +684,9 @@ export const BottomBar = styled.div`
padding-bottom: 5px;
padding-top: 5px;
}`;
default:
return '';
}
}}
`;
@@ -735,16 +743,17 @@ export const BoardForm = styled.div`
return `.highlighted {
background-color: #1d1d21 !important;
border: 1px solid #111 !important;
}
`;
}`;
case 'Photon':
return `.highlighted {
background-color: #ccc !important;
border: 1px solid #ccc !important;
}`;
}
default:
return '';
}
}}
}
@@ -2018,7 +2027,9 @@ export const BoardForm = styled.div`
border-top: 1px solid #ddd;
height: 0;
}`;
default:
return '';
}
}}
@@ -2079,7 +2090,10 @@ export const BoardForm = styled.div`
return `.highlighted {
background-color: #ccc !important;
}`;
}
default:
return '';
}
}}
${({ selectedStyle }) => {
@@ -2780,6 +2794,9 @@ export const BoardForm = styled.div`
}
}
}`;
default:
return '';
}
}}
}
@@ -2896,6 +2913,9 @@ export const Footer = styled.div`
color: #f30;
}
}`;
}
default:
return '';
}
}}
`;
+4 -5
View File
@@ -207,7 +207,7 @@ const Board = () => {
setPendingCommentIndex(index);
navigate(`/profile/c/${index}`);
}
}, [index]);
}, [index, navigate, setPendingCommentIndex]);
const resetFields = () => {
@@ -240,7 +240,7 @@ const Board = () => {
resetFields();
})();
}
}, [publishCommentOptions]);
}, [publishCommentOptions, publishComment]);
const getChallengeAnswersFromUser = async (challenges) => {
@@ -369,12 +369,12 @@ const Board = () => {
<PostFormLink id="post-form-link" showPostFormLink={showPostFormLink} selectedStyle={selectedStyle} >
<div id="post-form-link-desktop">
[
<a onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
<a href={() => {}} onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
]
</div>
<div id="post-form-link-mobile">
<span className="btn-wrap">
<a onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
<a href={() => {}} onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
</span>
</div>
</PostFormLink>
@@ -452,7 +452,6 @@ const Board = () => {
hasMore={hasMore}
>
{selectedFeed.map((thread) => {
const { replies: { pages: { topAll: {} = {} } = {} } = {} } = thread;
const { displayedReplies, omittedCount } = filteredRepliesByThread[thread.cid] || {};
const commentMediaInfo = getCommentMediaInfo(thread);
const fallbackImgUrl = "/assets/filedeleted-res.gif";
+4 -4
View File
@@ -133,7 +133,7 @@ const Catalog = () => {
setPendingCommentIndex(index);
navigate(`/profile/c/${index}`);
}
}, [index]);
}, [index, navigate, setPendingCommentIndex]);
const resetFields = () => {
@@ -166,7 +166,7 @@ const Catalog = () => {
resetFields();
})();
}
}, [publishCommentOptions]);
}, [publishCommentOptions, publishComment]);
const getChallengeAnswersFromUser = async (challenges) => {
@@ -284,12 +284,12 @@ const Catalog = () => {
<PostFormLink id="post-form-link" showPostFormLink={showPostFormLink} selectedStyle={selectedStyle} >
<div id="post-form-link-desktop">
[
<a onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
<a href={() => {}} onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
]
</div>
<div id="post-form-link-mobile">
<span className="btn-wrap">
<a onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
<a href={() => {}} onClick={useClickForm()} onMouseOver={(event) => event.target.style.cursor='pointer'}>Start a New Thread</a>
</span>
</div>
</PostFormLink>
+2 -1
View File
@@ -184,7 +184,8 @@ const Pending = () => {
<div key={`f-${"pending"}`} className="file" style={{marginBottom: "5px"}}>
<div key={`ft-${"pending"}`} className="file-text">
Link:&nbsp;
<a key={`fa-${"pending"}`} href={commentMediaInfo.url} target="_blank">{
<a key={`fa-${"pending"}`} href={commentMediaInfo.url}
target="_blank" rel="noreferrer">{
commentMediaInfo?.url.length > 30 ?
commentMediaInfo?.url.slice(0, 30) + "(...)" :
commentMediaInfo?.url
+16 -14
View File
@@ -75,7 +75,7 @@ const Thread = () => {
parentCids: [
selectedThread || 'n/a', ...flattenedReplies.map(reply => reply.cid)
]
}), [flattenedReplies]);
}), [flattenedReplies, selectedThread]);
const { accountComments } = useAccountComments({filter});
@@ -100,7 +100,7 @@ const Thread = () => {
if (selectedSubplebbit) {
setSelectedTitle(selectedSubplebbit.title);
}
}, [subplebbitAddress, setSelectedAddress, setSelectedTitle, defaultSubplebbits]);
}, [subplebbitAddress, setSelectedAddress, setSelectedTitle, defaultSubplebbits, setSelectedThread, threadCid]);
// mobile navbar scroll effect
useEffect(() => {
@@ -167,7 +167,7 @@ const Thread = () => {
if (index !== undefined) {
setPendingCommentIndex(index);
}
}, [index]);
}, [index, setPendingCommentIndex]);
const resetFields = () => {
@@ -199,7 +199,7 @@ const Thread = () => {
resetFields();
})();
}
}, [publishCommentOptions]);
}, [publishCommentOptions, publishComment]);
const getChallengeAnswersFromUser = async (challenges) => {
@@ -338,17 +338,17 @@ const Thread = () => {
</div>
<div id="bottom-button-mobile">
<span className="btn-wrap">
<a onClick={() => window.scrollTo(0, document.body.scrollHeight)} onMouseOver={(event) => event.target.style.cursor='pointer'}>Bottom</a>
<a href={()=> {}} onClick={() => window.scrollTo(0, document.body.scrollHeight)} onMouseOver={(event) => event.target.style.cursor='pointer'}>Bottom</a>
</span>
</div>
<div id="post-form-link-desktop">
[
<a onClick={() => {handleClickForm(); setSelectedShortCid(comment.shortCid)}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
<a href={()=> {}} onClick={() => {handleClickForm(); setSelectedShortCid(comment.shortCid)}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
]
</div>
<div id="post-form-link-mobile">
<span className="btn-wrap">
<a onClick={() => {handleClickForm(); setSelectedShortCid(comment.shortCid)}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
<a href={()=> {}} onClick={() => {handleClickForm(); setSelectedShortCid(comment.shortCid)}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
</span>
</div>
</ReplyFormLink>
@@ -407,7 +407,7 @@ const Thread = () => {
</span>
<span className="return-button catalog-button" id="bottom-button-desktop">
[
<a onClick={() => window.scrollTo(0, document.body.scrollHeight)}
<a href={()=> {}} onClick={() => window.scrollTo(0, document.body.scrollHeight)}
onMouseOver={(event) => event.target.style.cursor='pointer'}
onTouchStart={() => window.scrollTo(0, document.body.scrollHeight)}>Bottom</a>
]
@@ -443,7 +443,8 @@ const Thread = () => {
<div key={`f-${comment.cid}`} className="file" style={{marginBottom: "5px"}}>
<div key={`ft-${comment.cid}`} className="file-text">
Link:&nbsp;
<a key={`fa-${comment.cid}`} href={commentMediaInfo.url} target="_blank">{
<a key={`fa-${comment.cid}`} href={commentMediaInfo.url}
target="_blank" rel="noreferrer">{
commentMediaInfo?.url.length > 30 ?
commentMediaInfo?.url.slice(0, 30) + "(...)" :
commentMediaInfo?.url
@@ -628,7 +629,8 @@ const Thread = () => {
style={{marginBottom: "5px"}}>
<div key={`ft-${index}`} className="reply-file-text">
Link:&nbsp;
<a key={`fa-${index}`} href={replyMediaInfo.url} target="_blank">{
<a key={`fa-${index}`} href={replyMediaInfo.url}
target="_blank" rel="noreferrer">{
replyMediaInfo?.url.length > 30 ?
replyMediaInfo?.url.slice(0, 30) + "(...)" :
replyMediaInfo?.url
@@ -917,14 +919,14 @@ const Thread = () => {
</span>
<span className="bottom-bar-top">
[
<a onClick={() => window.scrollTo(0, 0)}
<a href={()=> {}} onClick={() => window.scrollTo(0, 0)}
onMouseOver={(event) => event.target.style.cursor='pointer'}
onTouchStart={() => window.scrollTo(0, 0)}>Top</a>
]
</span>
<span className="quickreply-button">
[
<a onClick={() => {setIsReplyOpen(true); setSelectedParentCid(comment.cid); setSelectedShortCid(comment.shortCid);}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
<a href={()=> {}} onClick={() => {setIsReplyOpen(true); setSelectedParentCid(comment.cid); setSelectedShortCid(comment.shortCid);}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
]
</span>
{comment.replyCount > 0 ? (
@@ -973,7 +975,7 @@ const Thread = () => {
<ReplyFormLink id="post-form-link" selectedStyle={selectedStyle} >
<div id="post-form-link-mobile" className="post-button-mobile">
<span className="btn-wrap">
<a onClick={() => {setIsReplyOpen(true); setSelectedParentCid(comment.cid); setSelectedShortCid(comment.shortCid);}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
<a href={()=> {}} onClick={() => {setIsReplyOpen(true); setSelectedParentCid(comment.cid); setSelectedShortCid(comment.shortCid);}} onMouseOver={(event) => event.target.style.cursor='pointer'}>Post a Reply</a>
</span>
</div>
<div id="btns-container">
@@ -989,7 +991,7 @@ const Thread = () => {
</div>
<span className="bottom-bar-top">
<span className="btn-wrap">
<a onClick={() => window.scrollTo(0, 0)}
<a href={()=> {}} onClick={() => window.scrollTo(0, 0)}
onMouseOver={(event) => event.target.style.cursor='pointer'}
onTouchStart={() => window.scrollTo(0, 0)}
style={{marginRight: "10px", marginLeft: "10px"}}