From d664ddc9b84b25922239e3bbc253b35ea54f2533 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> Date: Sun, 3 Jan 2021 05:47:07 +0300 Subject: Fixes Preexisting Linting Issues Fixes all errors, and most warnings generated by eslint. Most were fixed by eslint automatically such as indentation and quotes. Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> --- src/components/FormListing.tsx | 26 +++++++-------- src/components/HeaderBar/index.tsx | 26 +++++++-------- src/components/Loading.tsx | 4 +-- src/components/OAuth2Button.tsx | 66 +++++++++++++++++++------------------- src/components/Tag.tsx | 2 +- 5 files changed, 62 insertions(+), 62 deletions(-) (limited to 'src/components') diff --git a/src/components/FormListing.tsx b/src/components/FormListing.tsx index f53efe2..0905903 100644 --- a/src/components/FormListing.tsx +++ b/src/components/FormListing.tsx @@ -2,7 +2,7 @@ import { css, jsx } from "@emotion/react"; import { Link } from "react-router-dom"; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowRight } from "@fortawesome/free-solid-svg-icons"; import Tag from "./Tag"; @@ -15,8 +15,8 @@ interface FormListingProps { form: Form } -function FormListing({ form }: FormListingProps) { - const listingStyle = css` +function FormListing({ form }: FormListingProps): JSX.Element { + const listingStyle = css` background-color: ${form.features.includes(FormFeatures.Open) ? colors.success : colors.darkButNotBlack}; width: 60%; padding: 20px; @@ -37,18 +37,18 @@ function FormListing({ form }: FormListingProps) { } `; - let closedTag; + let closedTag; - if (!form.features.includes(FormFeatures.Open)) { - closedTag = - }; + if (!form.features.includes(FormFeatures.Open)) { + closedTag = ; + } - return -
-

{closedTag}{form.name}

-

{form.description}

-
- + return +
+

{closedTag}{form.name}

+

{form.description}

+
+ ; } export default FormListing; diff --git a/src/components/HeaderBar/index.tsx b/src/components/HeaderBar/index.tsx index b789ddb..dfe3957 100644 --- a/src/components/HeaderBar/index.tsx +++ b/src/components/HeaderBar/index.tsx @@ -16,17 +16,17 @@ width: 100%; transition: height 1s; `; -function HeaderBar({ title }: HeaderBarProps) { - if (!title) { - title = "Python Discord Forms"; - }; +function HeaderBar({ title }: HeaderBarProps): JSX.Element { + if (!title) { + title = "Python Discord Forms"; + } - return
-
- - -
-

+
+ + +
+

- {title} -

-
+ {title} + + ; } export default HeaderBar; diff --git a/src/components/Loading.tsx b/src/components/Loading.tsx index 8454366..8dd5474 100644 --- a/src/components/Loading.tsx +++ b/src/components/Loading.tsx @@ -5,13 +5,13 @@ import { PropagateLoader } from "react-spinners"; import HeaderBar from "../components/HeaderBar"; -function Loading() { +function Loading(): JSX.Element { return
-
+ ; } export default Loading; diff --git a/src/components/OAuth2Button.tsx b/src/components/OAuth2Button.tsx index c364369..4fa3f61 100644 --- a/src/components/OAuth2Button.tsx +++ b/src/components/OAuth2Button.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { css, jsx } from "@emotion/react"; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faDiscord } from "@fortawesome/free-brands-svg-icons"; import colors from "../colors"; @@ -40,49 +40,49 @@ span { `; function doLogin(disableFunction: (newState: boolean) => void) { - disableFunction(true); + disableFunction(true); - const redirectURI = encodeURIComponent(document.location.protocol + "//" + document.location.host + "/callback"); + const redirectURI = encodeURIComponent(document.location.protocol + "//" + document.location.host + "/callback"); - const windowRef = window.open( - `https://discord.com/api/oauth2/authorize?client_id=${OAUTH2_CLIENT_ID}&response_type=code&scope=identify&redirect_uri=${redirectURI}&prompt=none`, - "Discord_OAuth2", - "height=700,width=500,location=no,menubar=no,resizable=no,status=no,titlebar=no,left=300,top=300" - ) + const windowRef = window.open( + `https://discord.com/api/oauth2/authorize?client_id=${OAUTH2_CLIENT_ID}&response_type=code&scope=identify&redirect_uri=${redirectURI}&prompt=none`, + "Discord_OAuth2", + "height=700,width=500,location=no,menubar=no,resizable=no,status=no,titlebar=no,left=300,top=300" + ); - const interval = setInterval(() => { - if (windowRef?.closed) { - clearInterval(interval); - disableFunction(false); - } - }, 500) + const interval = setInterval(() => { + if (windowRef?.closed) { + clearInterval(interval); + disableFunction(false); + } + }, 500); - window.onmessage = (code: MessageEvent) => { - if (code.data.source) { - // React DevTools has a habit of sending messages, ignore them. - return; - } + window.onmessage = (code: MessageEvent) => { + if (code.data.source) { + // React DevTools has a habit of sending messages, ignore them. + return; + } - if (code.isTrusted) { - windowRef?.close(); + if (code.isTrusted) { + windowRef?.close(); - console.log("Code received:", code.data); + console.log("Code received:", code.data); - disableFunction(false); - clearInterval(interval); + disableFunction(false); + clearInterval(interval); - window.onmessage = null; - } - }; + window.onmessage = null; + } + }; } -function OAuth2Button() { - const [disabled, setDisabled] = useState(false); +function OAuth2Button(): JSX.Element { + const [disabled, setDisabled] = useState(false); - return ; + return ; } export default OAuth2Button; diff --git a/src/components/Tag.tsx b/src/components/Tag.tsx index 0c55348..3e5b1f5 100644 --- a/src/components/Tag.tsx +++ b/src/components/Tag.tsx @@ -7,7 +7,7 @@ interface TagProps { fontSize?: string } -function Tag(props: TagProps) { +function Tag(props: TagProps): JSX.Element { return