From 366521ba49c24675efb97d2997ca6c76f2bcf592 Mon Sep 17 00:00:00 2001 From: sidlak-c137 Date: Sun, 1 Oct 2023 16:59:20 -0700 Subject: [PATCH] fix linting --- Context/AuthContext.tsx | 4 +++- components/AdminForm.tsx | 5 +++++ components/GithubButton.tsx | 1 + components/Header.tsx | 1 + components/Sidebar.tsx | 1 + components/SignInButton.tsx | 1 + devpages/admin.tsx | 16 +++++++++------- devpages/dashboard.tsx | 1 + devpages/private_project.tsx | 1 + devpages/profile.tsx | 1 + devpages/resources.tsx | 1 + pages/_app.tsx | 3 ++- pages/about.tsx | 2 ++ pages/events.tsx | 5 ++++- pages/index.tsx | 10 +++++----- pages/join.tsx | 5 ++++- pages/projects.tsx | 2 ++ 17 files changed, 44 insertions(+), 16 deletions(-) diff --git a/Context/AuthContext.tsx b/Context/AuthContext.tsx index 58e3859..d1b9613 100644 --- a/Context/AuthContext.tsx +++ b/Context/AuthContext.tsx @@ -1,6 +1,7 @@ import { createContext, useContext, useEffect, useState } from "react" import { GithubAuthProvider, GoogleAuthProvider, signInWithPopup } from "firebase/auth" +// @ts-ignore import { auth } from "@/back_end/utils" // @ts-ignore @@ -38,7 +39,8 @@ export const AuthContextProvider = ({children}: {children:React.ReactNode}) => { useEffect(() => { - const unsubscribe = auth.onAuthStateChanged(async user => { + // rome-ignore lint/suspicious/noExplicitAny: +const unsubscribe = auth.onAuthStateChanged(async (user: any) => { setCurrentUser(user) if (user) { setAdmin(await checkAdmin(user)) diff --git a/components/AdminForm.tsx b/components/AdminForm.tsx index a709f8a..300d037 100644 --- a/components/AdminForm.tsx +++ b/components/AdminForm.tsx @@ -16,11 +16,16 @@ import { personTemplate, projectTemplate, Value +// @ts-ignore } from "@/devpages/admin"; +// @ts-ignore import * as ImageService from "@/back_end/api/image.js" +// @ts-ignore import * as EventService from "@/back_end/api/events.js" +// @ts-ignore import * as LeadService from "@/back_end/api/leads.js" +// @ts-ignore import * as ProjectService from "@/back_end/api/projects.js" type _Item = _Person | _Project | _Event; diff --git a/components/GithubButton.tsx b/components/GithubButton.tsx index 8c41693..456a5d6 100644 --- a/components/GithubButton.tsx +++ b/components/GithubButton.tsx @@ -2,6 +2,7 @@ // Set to be removed import React from "react"; import { UserCredential } from "firebase/auth"; +// @ts-ignore import { useAuth } from "@/context/AuthContext" import { Button, Center, Text } from '@chakra-ui/react' import { VscGithub } from "react-icons/vsc" diff --git a/components/Header.tsx b/components/Header.tsx index d2e5ef6..25e255e 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -13,6 +13,7 @@ import { useMediaQuery } from "@chakra-ui/react"; import { faBars } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { HeaderButton, SpecialHeaderButton } from "./Parts"; +// @ts-ignore import { useAuth } from "@/context/AuthContext"; export default function Header(props: { showSidebar: () => void }) { diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx index 3685f56..38ae76f 100644 --- a/components/Sidebar.tsx +++ b/components/Sidebar.tsx @@ -2,6 +2,7 @@ import { Flex, IconButton } from "@chakra-ui/react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faXmark } from "@fortawesome/free-solid-svg-icons"; import { SidebarButton } from "./Parts"; +// @ts-ignore import { useAuth } from "@/context/AuthContext"; interface ISideBar { diff --git a/components/SignInButton.tsx b/components/SignInButton.tsx index b937af8..66bc91d 100644 --- a/components/SignInButton.tsx +++ b/components/SignInButton.tsx @@ -2,6 +2,7 @@ // Set to be removed import React from "react"; import { UserCredential } from "firebase/auth"; +// @ts-ignore import { useAuth } from "@/context/AuthContext" import { Button, Center, Text } from '@chakra-ui/react' import { VscGithub } from "react-icons/vsc" diff --git a/devpages/admin.tsx b/devpages/admin.tsx index 870d1ff..9986c2d 100644 --- a/devpages/admin.tsx +++ b/devpages/admin.tsx @@ -1,12 +1,14 @@ -import { useEffect, useState } from "react"; +import { SetStateAction, useEffect, useState } from "react"; +// @ts-ignore import AdminForm from "@/components/AdminForm"; -import { getAllEvents } from "back_end/api/events"; -// import { events, people, projects } from '../utils/data'; +// @ts-ignore +import { getAllEvents } from "@/back_end/api/events"; +// @ts-ignore import { getLeads } from "@/back_end/api/leads"; +// @ts-ignore import { getProjects } from "@/back_end/api/projects"; -import { set } from 'firebase/database'; // all dates handled as epoch time!!! @@ -100,15 +102,15 @@ export default function Admin() { const [reset, setReset] = useState(false); useEffect(() => { - getAllEvents().then((res) => { + getAllEvents().then((res: SetStateAction<_Event[]>) => { setCurrentEvents(res); }); - getLeads().then((res) => { + getLeads().then((res: SetStateAction<_Person[]>) => { setCurrentPeople(res); }); - getProjects().then((res) => { + getProjects().then((res: SetStateAction<_Project[]>) => { setCurrentProjects(res); }); diff --git a/devpages/dashboard.tsx b/devpages/dashboard.tsx index 4562314..b3cf38e 100644 --- a/devpages/dashboard.tsx +++ b/devpages/dashboard.tsx @@ -1,3 +1,4 @@ +// @ts-ignore import { useAuth } from "@/context/AuthContext"; import { useEffect } from "react"; import Router from "next/router"; diff --git a/devpages/private_project.tsx b/devpages/private_project.tsx index 3fcc1d9..31443dd 100644 --- a/devpages/private_project.tsx +++ b/devpages/private_project.tsx @@ -1,3 +1,4 @@ +// @ts-ignore import { useAuth } from "@/context/AuthContext"; import { useEffect } from "react"; import Router from "next/router"; diff --git a/devpages/profile.tsx b/devpages/profile.tsx index 571c85e..7a56105 100644 --- a/devpages/profile.tsx +++ b/devpages/profile.tsx @@ -1,3 +1,4 @@ +// @ts-ignore import { useAuth } from "@/context/AuthContext"; import { useEffect } from "react"; import Router from "next/router"; diff --git a/devpages/resources.tsx b/devpages/resources.tsx index 84960b3..7e713db 100644 --- a/devpages/resources.tsx +++ b/devpages/resources.tsx @@ -1,3 +1,4 @@ +// @ts-ignore import { useAuth } from "@/context/AuthContext"; import { useEffect } from "react"; import Router from "next/router"; diff --git a/pages/_app.tsx b/pages/_app.tsx index 4097897..d59f217 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -2,8 +2,9 @@ import "@/styles/globals.css"; import type { AppProps } from "next/app"; import { ChakraProvider } from "@chakra-ui/react"; import { extendTheme, theme as baseTheme } from "@chakra-ui/react"; - +// @ts-ignore import Layout from "@/components/Layout"; +// @ts-ignore import { AuthContextProvider } from "@/context/AuthContext"; const colors = { diff --git a/pages/about.tsx b/pages/about.tsx index 3868a4b..71a2d8a 100644 --- a/pages/about.tsx +++ b/pages/about.tsx @@ -9,7 +9,9 @@ import { Spinner, useMediaQuery, } from "@chakra-ui/react"; +// @ts-ignore import { getPeople } from "@/utils/api"; +// @ts-ignore import { IPeopleInfo } from "@/utils/parsers"; export default function About() { diff --git a/pages/events.tsx b/pages/events.tsx index 69c99bb..7b089c1 100644 --- a/pages/events.tsx +++ b/pages/events.tsx @@ -10,10 +10,13 @@ import { // @ts-ignore import { getAllEvents } from "@/utils/api"; import { lazy, useEffect, useState } from "react"; +// @ts-ignore import { IEventInfo } from "@/utils/parsers"; +// @ts-ignore import EventPanel from "@/components/EventPanel"; +// @ts-ignore import EventCardFull from "@/components/EventCardFull"; - +// @ts-ignore const Room = lazy(() => import("@/components/Room")); const inter = Inter({ subsets: ["latin"] }); diff --git a/pages/index.tsx b/pages/index.tsx index 0ca2cc9..6cb2144 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -17,11 +17,13 @@ import { faArrowDown } from "@fortawesome/free-solid-svg-icons"; import { getFeaturedEvents } from "@/utils/api"; import Image from 'next/image'; import { lazy, useEffect, useState } from "react"; +// @ts-ignore import EventCard from "@/components/EventCard"; +// @ts-ignore import { IEventInfo } from "@/utils/parsers"; - +// @ts-ignore const Room = lazy(() => import("@/components/Room")); const inter = Inter({ subsets: ["latin"] }); @@ -71,8 +73,7 @@ function Title() { border='3px solid transparent' onClick={() => { document - .getElementById("featured-events")! - .scrollIntoView({ behavior: "smooth" }); + .getElementById("featured-events")?.scrollIntoView({ behavior: "smooth" }); }} _hover={{ border: "3px solid white", @@ -119,8 +120,7 @@ function TitleMobile() { border='3px solid transparent' onClick={() => { document - .getElementById(isLargerThan450 ? "featured-events" : "meeting-info" )! - .scrollIntoView({ behavior: "smooth" }); + .getElementById(isLargerThan450 ? "featured-events" : "meeting-info" )?.scrollIntoView({ behavior: "smooth" }); }} _hover={{ border: "3px solid white", diff --git a/pages/join.tsx b/pages/join.tsx index 34e861f..2037d93 100644 --- a/pages/join.tsx +++ b/pages/join.tsx @@ -17,8 +17,11 @@ import { sendEmail } from "@/utils/api"; import { auth } from "@/back_end/utils/index.js" import { UserCredential, signOut} from "firebase/auth"; +// @ts-ignore import { useAuth } from "@/context/AuthContext"; +// @ts-ignore import { exchangeAuth } from "@/utils/api.js"; +// @ts-ignore import { SpecialIconButton, SpecialSubmitButton } from "@/components/Parts"; const inter = Inter({ subsets: ["latin"] }); @@ -164,7 +167,7 @@ export default function Join() { const handleSignInSuccess = async (result: UserCredential) => { console.log(isAdmin); console.log(getUser()); - let user = auth.currentUser + const user = auth.currentUser console.log(await user?.getIdToken()); console.log(await exchangeAuth(user?.getIdToken())) } diff --git a/pages/projects.tsx b/pages/projects.tsx index eba862d..8085edc 100644 --- a/pages/projects.tsx +++ b/pages/projects.tsx @@ -15,7 +15,9 @@ import { faSearch } from "@fortawesome/free-solid-svg-icons"; import { getAllProjects } from "@/utils/api"; import { ChangeEvent, lazy, useEffect, useState } from "react"; import { IProjectInfo } from "utils/parsers"; +// @ts-ignore import ProjectCard from "@/components/ProjectCard"; +// @ts-ignore const Room = lazy(() => import("@/components/Room")); const inter = Inter({ subsets: ["latin"] });