diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a419fbe440..0345e8cd99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,9 @@ repos: rev: v4.0.0-alpha.4 hooks: - id: prettier + additional_dependencies: + - prettier@^2.7.1 + - prettier-plugin-organize-imports - repo: local hooks: - id: black-with-tabs diff --git a/content/ordering.ts b/content/ordering.ts index 948d8adca4..7a3852c7fd 100644 --- a/content/ordering.ts +++ b/content/ordering.ts @@ -306,8 +306,7 @@ SECTIONS.forEach(section => { }); }); -export { moduleIDToSectionMap }; -export { moduleIDToURLMap }; +export { moduleIDToSectionMap, moduleIDToURLMap }; const moduleIDToURLMap: { [key: string]: string } = {}; diff --git a/docs/Front End Documentation.md b/docs/Front End Documentation.md index 8677da157c..e653f79c69 100644 --- a/docs/Front End Documentation.md +++ b/docs/Front End Documentation.md @@ -54,16 +54,16 @@ compile xdm into `src/gatsby/xdm.js` with Webpack: import path from 'path'; export default { - mode: 'production', - entry: './index.js', - output: { - path: path.resolve('D:\\Code\\xdm', 'dist'), - filename: 'bundle.js', - library: { - name: 'xdm', - type: 'commonjs', - }, - }, + mode: 'production', + entry: './index.js', + output: { + path: path.resolve('D:\\Code\\xdm', 'dist'), + filename: 'bundle.js', + library: { + name: 'xdm', + type: 'commonjs', + }, + }, }; ``` diff --git a/gatsby-node.ts b/gatsby-node.ts index 1e78d7192e..235209fba9 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -2,15 +2,15 @@ import { execSync } from 'child_process'; import fs from 'fs'; import path from 'path'; import * as freshOrdering from './content/ordering'; +import div_to_probs from './src/components/markdown/ProblemsList/DivisionList/div_to_probs.json'; import { createXdmNode } from './src/gatsby/create-xdm-node'; import { + ProblemMetadata, + ShortProblemInfo, checkInvalidUsacoMetadata, getProblemInfo, getProblemURL, - ShortProblemInfo, - ProblemMetadata, } from './src/models/problem'; -import div_to_probs from './src/components/markdown/ProblemsList/DivisionList/div_to_probs.json'; // Questionable hack to get full commit history so that timestamps work try { execSync( diff --git a/src/assets/firepad.css b/src/assets/firepad.css index 7571901944..8242bdab59 100644 --- a/src/assets/firepad.css +++ b/src/assets/firepad.css @@ -176,15 +176,11 @@ a.firepad-btn:hover { } a.firepad-btn:active { - -webkit-box-shadow: - inset 0 2px 4px rgba(0, 0, 0, 0.15), + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: - inset 0 2px 4px rgba(0, 0, 0, 0.15), - 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: - inset 0 2px 4px rgba(0, 0, 0, 0.15), + -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05); } .firepad-btn-group > .firepad-btn { diff --git a/src/atoms/atomWithStorage.ts b/src/atoms/atomWithStorage.ts index b057e14dec..b794f58437 100644 --- a/src/atoms/atomWithStorage.ts +++ b/src/atoms/atomWithStorage.ts @@ -1,5 +1,5 @@ -import { atom, PrimitiveAtom } from 'jotai'; import type { SetStateAction } from 'jotai'; +import { atom, PrimitiveAtom } from 'jotai'; type Storage = { getItem: (key: string) => Value; diff --git a/src/components/Confetti/Confetti.js b/src/components/Confetti/Confetti.js index f9c3ac88b6..9104664588 100644 --- a/src/components/Confetti/Confetti.js +++ b/src/components/Confetti/Confetti.js @@ -1,7 +1,7 @@ -import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import React, { Component } from 'react'; -import { random, sample, range, getDiameter } from './Confetti.helpers'; +import { getDiameter, random, range, sample } from './Confetti.helpers'; import { createCircle, createTriangle, createZigZag } from './confetti-shapes'; import Canvas from './Canvas'; diff --git a/src/components/Confetti/Particles.tsx b/src/components/Confetti/Particles.tsx index 0e72078680..f085840078 100644 --- a/src/components/Confetti/Particles.tsx +++ b/src/components/Confetti/Particles.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { defaultShapes } from './confetti-shapes.js'; import { getDiameter, random, range, sample } from './Confetti.helpers'; +import { defaultShapes } from './confetti-shapes.js'; import type { Particle, Shape } from './types'; type State = { diff --git a/src/components/ContactUsSlideover/ContactUsSlideover.tsx b/src/components/ContactUsSlideover/ContactUsSlideover.tsx index a53b7e8c16..6119ed024f 100644 --- a/src/components/ContactUsSlideover/ContactUsSlideover.tsx +++ b/src/components/ContactUsSlideover/ContactUsSlideover.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { useContext, useEffect, useState } from 'react'; import { SECTION_LABELS } from '../../../content/ordering'; import MarkdownLayoutContext from '../../context/MarkdownLayoutContext'; -import { useUserLangSetting } from '../../context/UserDataContext/properties/simpleProperties'; import { useFirebaseUser } from '../../context/UserDataContext/UserDataContext'; +import { useUserLangSetting } from '../../context/UserDataContext/properties/simpleProperties'; import useContactFormAction from '../../hooks/useContactFormAction'; import useStickyState from '../../hooks/useStickyState'; import { ModuleInfo } from '../../models/module'; @@ -295,8 +295,8 @@ export default function ContactUsSlideover({ ? email === '' ? 'This field is required.' : !validateEmail(email) - ? 'Please enter a valid email address.' - : null + ? 'Please enter a valid email address.' + : null : null } /> diff --git a/src/components/Editor/EditorOutput.tsx b/src/components/Editor/EditorOutput.tsx index 7f6dacd744..60a53567ef 100644 --- a/src/components/Editor/EditorOutput.tsx +++ b/src/components/Editor/EditorOutput.tsx @@ -8,8 +8,8 @@ import { EditorContext } from '../../context/EditorContext'; import { MarkdownProblemListsProvider } from '../../context/MarkdownProblemListsContext'; import { ProblemSuggestionModalProvider } from '../../context/ProblemSuggestionModalContext'; import { - ProblemMetadata, PROBLEM_DIFFICULTY_OPTIONS, + ProblemMetadata, } from '../../models/problem'; import QuizGeneratorModal from '../QuizGeneratorModal'; diff --git a/src/components/Editor/MainEditorInterface.tsx b/src/components/Editor/MainEditorInterface.tsx index 547df3fc34..0a9c3d7aa8 100644 --- a/src/components/Editor/MainEditorInterface.tsx +++ b/src/components/Editor/MainEditorInterface.tsx @@ -123,16 +123,16 @@ export const MainEditorInterface = ({ className }): JSX.Element => { activeFile === null ? 'NONE' : tab === 'content' - ? activeFile.path - : activeFile.path.replace(/\.mdx$/, '.problems.json') + ? activeFile.path + : activeFile.path.replace(/\.mdx$/, '.problems.json') } language={tab === 'content' ? 'custom-mdx' : 'json'} value={ activeFile === null ? 'Open a file to begin' : tab === 'content' - ? markdown - : problems + ? markdown + : problems } onChange={(v, e) => tab === 'content' ? setMarkdown(v) : setProblems(v) diff --git a/src/components/Groups/EditGroupPage/EditGroupPage.tsx b/src/components/Groups/EditGroupPage/EditGroupPage.tsx index cf0f7d70e6..d20540a3f7 100644 --- a/src/components/Groups/EditGroupPage/EditGroupPage.tsx +++ b/src/components/Groups/EditGroupPage/EditGroupPage.tsx @@ -4,9 +4,9 @@ import toast from 'react-hot-toast'; import { useActiveGroup } from '../../../hooks/groups/useActiveGroup'; import { useGroupActions } from '../../../hooks/groups/useGroupActions'; import { GroupData } from '../../../models/groups/groups'; +import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar'; import Layout from '../../layout'; import SEO from '../../seo'; -import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar'; import Breadcrumbs from '../Breadcrumbs'; export default function EditGroupPage(props) { diff --git a/src/components/Groups/EditPostPage/EditPostPage.tsx b/src/components/Groups/EditPostPage/EditPostPage.tsx index 0ae51344b1..72d22e682f 100644 --- a/src/components/Groups/EditPostPage/EditPostPage.tsx +++ b/src/components/Groups/EditPostPage/EditPostPage.tsx @@ -9,9 +9,9 @@ import { useActiveGroup } from '../../../hooks/groups/useActiveGroup'; import { usePost } from '../../../hooks/groups/usePost'; import { usePostActions } from '../../../hooks/groups/usePostActions'; import { PostData } from '../../../models/groups/posts'; +import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar'; import Layout from '../../layout'; import SEO from '../../seo'; -import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar'; import Breadcrumbs from '../Breadcrumbs'; import MarkdownEditor from '../MarkdownEditor'; diff --git a/src/components/Groups/EditProblemPage/EditProblemPage.tsx b/src/components/Groups/EditProblemPage/EditProblemPage.tsx index 56d74f850b..471fd232a9 100644 --- a/src/components/Groups/EditProblemPage/EditProblemPage.tsx +++ b/src/components/Groups/EditProblemPage/EditProblemPage.tsx @@ -1,12 +1,12 @@ import { CheckIcon, XIcon } from '@heroicons/react/solid'; import { RouteComponentProps } from '@reach/router'; import { + Timestamp, collection, getDocs, getFirestore, limit, query, - Timestamp, } from 'firebase/firestore'; import 'flatpickr/dist/themes/material_blue.css'; import { Link, navigate } from 'gatsby'; @@ -22,14 +22,14 @@ import { useFirebaseApp } from '../../../hooks/useFirebase'; import { GroupProblemData } from '../../../models/groups/problem'; import { AlgoliaProblemInfo, - getProblemURL, ProblemInfo, + getProblemURL, } from '../../../models/problem'; import ButtonGroup from '../../ButtonGroup'; -import Layout from '../../layout'; import ProblemAutocompleteModal from '../../ProblemAutocompleteModal/ProblemAutocompleteModal'; -import SEO from '../../seo'; import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar'; +import Layout from '../../layout'; +import SEO from '../../seo'; import Breadcrumbs from '../Breadcrumbs'; import MarkdownEditor from '../MarkdownEditor'; import EditProblemHintSection from './EditProblemHintSection'; @@ -114,12 +114,12 @@ export default function EditProblemPage(props: Props) { getProblemURL(problemInfo), ]}/solution)` : problem.solution?.kind == 'link' - ? `See [${problem.solution.url}](${problem.solution.url})` - : problem.solution?.kind == 'label' - ? problem.solution.label - : problem.solution?.kind === 'sketch' - ? problem.solution.sketch - : '', + ? `See [${problem.solution.url}](${problem.solution.url})` + : problem.solution?.kind == 'label' + ? problem.solution.label + : problem.solution?.kind === 'sketch' + ? problem.solution.sketch + : '', source: problem.source, difficulty: problem.difficulty, diff --git a/src/components/Groups/Feedback.tsx b/src/components/Groups/Feedback.tsx index 39267f2b80..d6e9c0da4b 100644 --- a/src/components/Groups/Feedback.tsx +++ b/src/components/Groups/Feedback.tsx @@ -62,7 +62,7 @@ export default function Feedback({ videoId }): JSX.Element { ([emoji, key, name]: [ string, 'very_bad' | 'bad' | 'good' | 'great', - string, + string ]) => ( diff --git a/src/components/ProblemsPage/Difficulty.tsx b/src/components/ProblemsPage/Difficulty.tsx index f9e41608fd..0ea60b07c6 100644 --- a/src/components/ProblemsPage/Difficulty.tsx +++ b/src/components/ProblemsPage/Difficulty.tsx @@ -69,8 +69,8 @@ export default function Difficulty({ items, refine }) { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/ProblemsPage/Module.tsx b/src/components/ProblemsPage/Module.tsx index 8d6eff916a..46c5faa96d 100644 --- a/src/components/ProblemsPage/Module.tsx +++ b/src/components/ProblemsPage/Module.tsx @@ -69,8 +69,8 @@ export default function Module({ items, refine }) { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/ProblemsPage/ProblemHits.tsx b/src/components/ProblemsPage/ProblemHits.tsx index 8d003006b6..086ec69256 100644 --- a/src/components/ProblemsPage/ProblemHits.tsx +++ b/src/components/ProblemsPage/ProblemHits.tsx @@ -11,12 +11,12 @@ import { import { useUserProgressOnProblems } from '../../context/UserDataContext/properties/userProgress'; import { AlgoliaProblemInfo, - getProblemURL, ProblemInfo, + getProblemURL, recentUsaco, } from '../../models/problem'; -import { difficultyClasses } from '../markdown/ProblemsList/ProblemsListItem'; import ProblemStatusCheckbox from '../markdown/ProblemsList/ProblemStatusCheckbox'; +import { difficultyClasses } from '../markdown/ProblemsList/ProblemsListItem'; interface ProblemHitProps { hit: AlgoliaProblemInfo; diff --git a/src/components/ProblemsPage/Section.tsx b/src/components/ProblemsPage/Section.tsx index bc053bbcc6..a15ff8d253 100644 --- a/src/components/ProblemsPage/Section.tsx +++ b/src/components/ProblemsPage/Section.tsx @@ -82,8 +82,8 @@ export default function Section({ refine }) { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/ProblemsPage/Source.tsx b/src/components/ProblemsPage/Source.tsx index 9d778d1f28..8bfb012929 100644 --- a/src/components/ProblemsPage/Source.tsx +++ b/src/components/ProblemsPage/Source.tsx @@ -69,8 +69,8 @@ export default function Source({ items, refine }) { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/ProblemsPage/Starred.tsx b/src/components/ProblemsPage/Starred.tsx index ea0f01a94b..d4d6008cf6 100644 --- a/src/components/ProblemsPage/Starred.tsx +++ b/src/components/ProblemsPage/Starred.tsx @@ -71,8 +71,8 @@ export default function Starred({ items, refine }) { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/ProblemsPage/Status.tsx b/src/components/ProblemsPage/Status.tsx index 8e6b4e7d60..62186cccc7 100644 --- a/src/components/ProblemsPage/Status.tsx +++ b/src/components/ProblemsPage/Status.tsx @@ -83,8 +83,8 @@ export default function Status({ refine, problemIds }): JSX.Element { backgroundColor: '#4d94ff', } : isSelected - ? { backgroundColor: '#0063e6' } - : {}), + ? { backgroundColor: '#0063e6' } + : {}), }), } } diff --git a/src/components/SignInModal.tsx b/src/components/SignInModal.tsx index 424ba6d671..256e2196de 100644 --- a/src/components/SignInModal.tsx +++ b/src/components/SignInModal.tsx @@ -2,9 +2,9 @@ import { Dialog, Transition } from '@headlessui/react'; import { XIcon } from '@heroicons/react/solid'; import { AuthCredential, - getAuth, GithubAuthProvider, GoogleAuthProvider, + getAuth, linkWithCredential, signInWithCredential, signInWithPopup, diff --git a/src/components/TopNavigationBar/TopNavigationBar.tsx b/src/components/TopNavigationBar/TopNavigationBar.tsx index 1b57d44aae..6c13a67cd8 100644 --- a/src/components/TopNavigationBar/TopNavigationBar.tsx +++ b/src/components/TopNavigationBar/TopNavigationBar.tsx @@ -27,11 +27,11 @@ import { useSignOutAction, } from '../../context/UserDataContext/UserDataContext'; import ContactUsSlideover from '../ContactUsSlideover/ContactUsSlideover'; -import { LoadingSpinner } from '../elements/LoadingSpinner'; import Logo from '../Logo'; import LogoSquare from '../LogoSquare'; import MobileMenuButtonContainer from '../MobileMenuButtonContainer'; import SectionsDropdown from '../SectionsDropdown'; +import { LoadingSpinner } from '../elements/LoadingSpinner'; import { SearchModal } from './SearchModal'; import { UserAvatarMenu } from './UserAvatarMenu'; diff --git a/src/components/markdown/CodeBlock/CodeBlock.tsx b/src/components/markdown/CodeBlock/CodeBlock.tsx index e50a1a5157..ff22d08e50 100644 --- a/src/components/markdown/CodeBlock/CodeBlock.tsx +++ b/src/components/markdown/CodeBlock/CodeBlock.tsx @@ -109,12 +109,12 @@ const CodeSnipButton = ({ (buttonDir == 'Up' ? ' rotate-180' : buttonDir == 'Down' - ? '' - : buttonDir == 'Left' - ? ' rotate-90' - : buttonDir == 'Right' - ? ' -rotate-90' - : '') + ? '' + : buttonDir == 'Left' + ? ' rotate-90' + : buttonDir == 'Right' + ? ' -rotate-90' + : '') } onClick={() => onShowSnipChange(snipID, !showSnip)} > diff --git a/src/components/markdown/ProblemsList/DivisionList/DivisionList.tsx b/src/components/markdown/ProblemsList/DivisionList/DivisionList.tsx index df4d2ac012..5acaaaafaa 100644 --- a/src/components/markdown/ProblemsList/DivisionList/DivisionList.tsx +++ b/src/components/markdown/ProblemsList/DivisionList/DivisionList.tsx @@ -8,8 +8,8 @@ import { import { ProblemSolutionInfo } from '../../../../models/problem'; import Transition from '../../../Transition'; import { ProblemsList } from '../ProblemsList'; -import contestToPoints from './contest_to_points.json'; import { DivisionProblemInfo } from './DivisionProblemInfo'; +import contestToPoints from './contest_to_points.json'; import divToProbs from './div_to_probs.json'; import idToSol from './id_to_sol.json'; diff --git a/src/components/markdown/ProblemsList/ProblemStatusCheckbox.tsx b/src/components/markdown/ProblemsList/ProblemStatusCheckbox.tsx index 8b9301dd33..30169c14bb 100644 --- a/src/components/markdown/ProblemsList/ProblemStatusCheckbox.tsx +++ b/src/components/markdown/ProblemsList/ProblemStatusCheckbox.tsx @@ -13,9 +13,9 @@ import { useUserProgressOnProblems, } from '../../../context/UserDataContext/properties/userProgress'; import { + PROBLEM_PROGRESS_OPTIONS, ProblemInfo, ProblemProgress, - PROBLEM_PROGRESS_OPTIONS, } from '../../../models/problem'; const StyledTippy = styled(Tippy)` diff --git a/src/components/markdown/ProblemsList/ProblemsListItemDropdown.tsx b/src/components/markdown/ProblemsList/ProblemsListItemDropdown.tsx index d0c3b69b2a..9d93c90f5d 100644 --- a/src/components/markdown/ProblemsList/ProblemsListItemDropdown.tsx +++ b/src/components/markdown/ProblemsList/ProblemsListItemDropdown.tsx @@ -1,5 +1,4 @@ import Tippy from '@tippyjs/react'; -import { navigate } from 'gatsby'; import React from 'react'; import { Instance } from 'tippy.js'; import { useDarkMode } from '../../../context/DarkModeContext'; @@ -8,7 +7,6 @@ import { isUsaco, ProblemInfo } from '../../../models/problem'; import TextTooltip from '../../Tooltip/TextTooltip'; import ProblemListItemSolution from './ProblemListItemSolution'; import { ProblemsListItemProps } from './ProblemsListItem'; -import { Link } from 'gatsby'; function ViewSolutionsContent({ problem, diff --git a/src/components/markdown/ProblemsList/SuggestProblemRow.tsx b/src/components/markdown/ProblemsList/SuggestProblemRow.tsx index de895da13f..4524bcd338 100644 --- a/src/components/markdown/ProblemsList/SuggestProblemRow.tsx +++ b/src/components/markdown/ProblemsList/SuggestProblemRow.tsx @@ -1,5 +1,4 @@ import { globalHistory } from '@reach/router'; -import { Link } from 'gatsby'; import * as React from 'react'; import { useContext } from 'react'; import { EditorContext } from '../../../context/EditorContext'; diff --git a/src/components/markdown/Quiz.tsx b/src/components/markdown/Quiz.tsx index d5af14aeba..2e3b8311b3 100644 --- a/src/components/markdown/Quiz.tsx +++ b/src/components/markdown/Quiz.tsx @@ -1,6 +1,6 @@ import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/solid'; import classNames from 'classnames'; -import { atom, Provider, useAtom } from 'jotai'; +import { Provider, atom, useAtom } from 'jotai'; import { useAtomValue, useUpdateAtom } from 'jotai/utils'; import React from 'react'; diff --git a/src/context/DarkModeProvider.tsx b/src/context/DarkModeProvider.tsx index 3da43d85d7..306eccf9b8 100644 --- a/src/context/DarkModeProvider.tsx +++ b/src/context/DarkModeProvider.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { DarkModeContext } from './DarkModeContext'; -import { useThemeSetting } from './UserDataContext/properties/simpleProperties'; import { useIsUserDataLoaded } from './UserDataContext/UserDataContext'; +import { useThemeSetting } from './UserDataContext/properties/simpleProperties'; export function DarkModeProvider({ children }) { const theme = useThemeSetting(); diff --git a/src/functions/src/cpiclasses/approveFinancialAid.ts b/src/functions/src/cpiclasses/approveFinancialAid.ts index aa4237814c..8c2945fe30 100644 --- a/src/functions/src/cpiclasses/approveFinancialAid.ts +++ b/src/functions/src/cpiclasses/approveFinancialAid.ts @@ -1,7 +1,7 @@ import * as admin from 'firebase-admin'; import * as functions from 'firebase-functions'; -import updateMailingList from './utils/updateMailingList'; import { classRegistrationAdministrators } from './utils/permissions'; +import updateMailingList from './utils/updateMailingList'; if (admin.apps.length === 0) { admin.initializeApp(); diff --git a/src/functions/src/cpiclasses/approveLiveFinancialAid.ts b/src/functions/src/cpiclasses/approveLiveFinancialAid.ts index cf8aa5b6db..490ef213f4 100644 --- a/src/functions/src/cpiclasses/approveLiveFinancialAid.ts +++ b/src/functions/src/cpiclasses/approveLiveFinancialAid.ts @@ -1,7 +1,7 @@ import * as admin from 'firebase-admin'; import * as functions from 'firebase-functions'; -import updateLiveMailingList from './utils/updateLiveMailingList'; import { classRegistrationAdministrators } from './utils/permissions'; +import updateLiveMailingList from './utils/updateLiveMailingList'; if (admin.apps.length === 0) { admin.initializeApp(); diff --git a/src/functions/src/cpiclasses/index.ts b/src/functions/src/cpiclasses/index.ts index 031ffb8217..069816c20e 100644 --- a/src/functions/src/cpiclasses/index.ts +++ b/src/functions/src/cpiclasses/index.ts @@ -1,11 +1,11 @@ import approveFinancialAid from './approveFinancialAid'; -import processRegistration from './processRegistration'; -import processLiveRegistration from './processLiveRegistration'; import approveLiveFinancialAid from './approveLiveFinancialAid'; +import processLiveRegistration from './processLiveRegistration'; +import processRegistration from './processRegistration'; export { approveFinancialAid, - processRegistration, approveLiveFinancialAid, processLiveRegistration, + processRegistration, }; diff --git a/src/functions/src/cpiclasses/processRegistration.ts b/src/functions/src/cpiclasses/processRegistration.ts index e0a307be6a..5114e45a37 100644 --- a/src/functions/src/cpiclasses/processRegistration.ts +++ b/src/functions/src/cpiclasses/processRegistration.ts @@ -1,9 +1,9 @@ import * as checkoutNodeJssdk from '@paypal/checkout-server-sdk'; import * as admin from 'firebase-admin'; import * as functions from 'firebase-functions'; +import 'firebase-functions/lib/logger/compat'; import * as payPalClient from './utils/payPalClient'; import updateMailingList from './utils/updateMailingList'; -import 'firebase-functions/lib/logger/compat'; if (admin.apps.length === 0) { admin.initializeApp(); diff --git a/src/functions/src/cpiclasses/utils/updateMailingList.ts b/src/functions/src/cpiclasses/utils/updateMailingList.ts index 4fa4e0f78b..67a354d261 100644 --- a/src/functions/src/cpiclasses/utils/updateMailingList.ts +++ b/src/functions/src/cpiclasses/utils/updateMailingList.ts @@ -1,8 +1,8 @@ import axios from 'axios'; import * as crypto from 'crypto'; import * as functions from 'firebase-functions'; -const MAILCHIMP_API_KEY = functions.config().mailchimp.apikey; import 'firebase-functions/lib/logger/compat'; +const MAILCHIMP_API_KEY = functions.config().mailchimp.apikey; export default async function updateMailingList({ email, @@ -70,8 +70,8 @@ export default async function updateMailingList({ preferredLanguage === 'java' ? 'Java' : preferredLanguage === 'cpp' - ? 'C++' - : 'Python', + ? 'C++' + : 'Python', BRVCJOINLK: joinLink, }, }; diff --git a/src/functions/src/groups/utils/getMembershipKey.ts b/src/functions/src/groups/utils/getMembershipKey.ts index 888ebabc88..85017c667a 100644 --- a/src/functions/src/groups/utils/getMembershipKey.ts +++ b/src/functions/src/groups/utils/getMembershipKey.ts @@ -4,6 +4,6 @@ export default function getMembershipKey( return permissionLevel == 'OWNER' ? 'ownerIds' : permissionLevel == 'ADMIN' - ? 'adminIds' - : 'memberIds'; + ? 'adminIds' + : 'memberIds'; } diff --git a/src/functions/src/groups/utils/getPermissionLevel.ts b/src/functions/src/groups/utils/getPermissionLevel.ts index 24f6e5b38d..477e190f1b 100644 --- a/src/functions/src/groups/utils/getPermissionLevel.ts +++ b/src/functions/src/groups/utils/getPermissionLevel.ts @@ -9,8 +9,8 @@ export default function getPermissionLevel( return groupData.ownerIds.includes(userId) ? 'OWNER' : groupData.adminIds.includes(userId) - ? 'ADMIN' - : groupData.memberIds.includes(userId) - ? 'MEMBER' - : 'NOT_MEMBER'; + ? 'ADMIN' + : groupData.memberIds.includes(userId) + ? 'MEMBER' + : 'NOT_MEMBER'; } diff --git a/src/functions/src/index.ts b/src/functions/src/index.ts index 354655d3de..fecadd7c5e 100644 --- a/src/functions/src/index.ts +++ b/src/functions/src/index.ts @@ -4,16 +4,16 @@ import getUsers from './getUsers'; import * as groups from './groups'; import incrementUsers from './incrementUsers'; import setUserClaims from './setUserClaims'; -import submitProblemSuggestion from './submitProblemSuggestion'; import submitContactForm from './submitContactForm'; +import submitProblemSuggestion from './submitProblemSuggestion'; export { - setUserClaims, - submitProblemSuggestion, - scheduledFirestoreExport, - getUsers, - incrementUsers, cpiclasses, + getUsers, groups, + incrementUsers, + scheduledFirestoreExport, + setUserClaims, submitContactForm, + submitProblemSuggestion, }; diff --git a/src/functions/src/submitProblemSuggestion.ts b/src/functions/src/submitProblemSuggestion.ts index c10da0aac2..1f41f6b043 100644 --- a/src/functions/src/submitProblemSuggestion.ts +++ b/src/functions/src/submitProblemSuggestion.ts @@ -3,10 +3,10 @@ import * as admin from 'firebase-admin'; import * as functions from 'firebase-functions'; import prettier from 'prettier'; import { + PROBLEM_DIFFICULTY_OPTIONS, + ProblemMetadata, autoGenerateSolutionMetadata, generateProblemUniqueId, - ProblemMetadata, - PROBLEM_DIFFICULTY_OPTIONS, } from '../../models/problem'; const problemSuggestionReviewers = { diff --git a/src/gatsby/custom-gatsby-img.js b/src/gatsby/custom-gatsby-img.js index 7d6c0d6ad5..177706f507 100644 --- a/src/gatsby/custom-gatsby-img.js +++ b/src/gatsby/custom-gatsby-img.js @@ -91,8 +91,8 @@ module.exports = ( const captionOptions = Array.isArray(options.showCaptions) ? options.showCaptions : options.showCaptions === true - ? [`title`, `alt`] - : false; + ? [`title`, `alt`] + : false; if (captionOptions) { for (const option of captionOptions) { @@ -370,8 +370,8 @@ module.exports = ( ${rawHTML} diff --git a/src/hooks/groups/useLeaderboardData.tsx b/src/hooks/groups/useLeaderboardData.tsx index 751badfa8e..6faec7b6e4 100644 --- a/src/hooks/groups/useLeaderboardData.tsx +++ b/src/hooks/groups/useLeaderboardData.tsx @@ -1,13 +1,13 @@ import { - getFirestore, - orderBy, Timestamp, - query, collection, - limit, - getDocs, - getDoc, doc, + getDoc, + getDocs, + getFirestore, + limit, + orderBy, + query, } from 'firebase/firestore'; import React from 'react'; import { useFirebaseApp } from '../useFirebase'; diff --git a/src/hooks/groups/usePostActions.ts b/src/hooks/groups/usePostActions.ts index a62c72c6ca..d120515eaa 100644 --- a/src/hooks/groups/usePostActions.ts +++ b/src/hooks/groups/usePostActions.ts @@ -10,8 +10,8 @@ import { updateDoc, writeBatch, } from 'firebase/firestore'; -import { useSetProgressOnProblem } from '../../context/UserDataContext/properties/userProgress'; import { useFirebaseUser } from '../../context/UserDataContext/UserDataContext'; +import { useSetProgressOnProblem } from '../../context/UserDataContext/properties/userProgress'; import { PostData } from '../../models/groups/posts'; import { GroupProblemData } from '../../models/groups/problem'; import { useFirebaseApp } from '../useFirebase'; diff --git a/src/hooks/useUpdateStreakEffect.tsx b/src/hooks/useUpdateStreakEffect.tsx index 4cf8305aed..c6446fe13a 100644 --- a/src/hooks/useUpdateStreakEffect.tsx +++ b/src/hooks/useUpdateStreakEffect.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { useSetLastVisitDate } from '../context/UserDataContext/properties/lastVisit'; import { useIsUserDataLoaded } from '../context/UserDataContext/UserDataContext'; +import { useSetLastVisitDate } from '../context/UserDataContext/properties/lastVisit'; export const useUpdateStreakEffect = ({ setLastViewedModule, diff --git a/src/mdx-plugins/mdast-to-string.js b/src/mdx-plugins/mdast-to-string.js index b2b843bd04..4b0ba232ce 100644 --- a/src/mdx-plugins/mdast-to-string.js +++ b/src/mdx-plugins/mdast-to-string.js @@ -15,7 +15,7 @@ const escapeHTML = str => '>': '>', "'": ''', '"': '"', - })[tag] + }[tag]) ); // Get the text content of a node. diff --git a/src/models/Editor/Block.ts b/src/models/Editor/Block.ts index 31a76b408c..7b198d2c81 100644 --- a/src/models/Editor/Block.ts +++ b/src/models/Editor/Block.ts @@ -2,9 +2,9 @@ import { Timestamp } from 'firebase/firestore'; import DeepStateItem from './DeepStateItem'; import FirebaseBlockData from './FirebaseBlockData'; import InitialTransaction from './InitialTransaction'; -import { applyPatch, makePatch } from './patchUtils'; import ShallowStateItem from './ShallowStateItem'; import Transaction from './Transaction'; +import { applyPatch, makePatch } from './patchUtils'; export type Patches = { [k in keyof T]: string; @@ -24,7 +24,7 @@ export type Patches = { export default class Block< T extends { [key: string]: string; - }, + } > { private _state: T; public readonly id: string; @@ -40,7 +40,7 @@ export default class Block< */ private readonly _transactions: [ InitialTransaction, - ...Transaction>[], + ...Transaction>[] ]; private _sealed: boolean; public readonly version = 1; diff --git a/src/models/Editor/DeepStateItem.ts b/src/models/Editor/DeepStateItem.ts index cdffc759e1..3f92336802 100644 --- a/src/models/Editor/DeepStateItem.ts +++ b/src/models/Editor/DeepStateItem.ts @@ -8,7 +8,7 @@ import StateItem from './StateItem'; export default class DeepStateItem< T extends { [key: string]: string; - }, + } > extends StateItem { private readonly _val: T; constructor(id: number, timestamp: Timestamp, value: T) { diff --git a/src/models/Editor/ShallowStateItem.ts b/src/models/Editor/ShallowStateItem.ts index 25a284c6aa..e9a2b02eb5 100644 --- a/src/models/Editor/ShallowStateItem.ts +++ b/src/models/Editor/ShallowStateItem.ts @@ -10,7 +10,7 @@ import StateItem from './StateItem'; export default class ShallowStateItem< T extends { [key: string]: string; - }, + } > extends StateItem { protected block: Block; diff --git a/src/models/Editor/StateItem.ts b/src/models/Editor/StateItem.ts index f5f29a54d3..9948b8b291 100644 --- a/src/models/Editor/StateItem.ts +++ b/src/models/Editor/StateItem.ts @@ -3,7 +3,7 @@ import { Timestamp } from 'firebase/firestore'; export default abstract class StateItem< T extends { [key: string]: string; - }, + } > { public readonly id: number; public readonly timestamp: Timestamp; diff --git a/src/models/Editor/Transaction.ts b/src/models/Editor/Transaction.ts index f3cf21c425..d3a6adc9cb 100644 --- a/src/models/Editor/Transaction.ts +++ b/src/models/Editor/Transaction.ts @@ -1,5 +1,5 @@ -import { Timestamp } from 'firebase/firestore'; import { Blob } from 'blob-polyfill'; +import { Timestamp } from 'firebase/firestore'; /** * A transaction is a patch that describes the changes from one state to another state, as well as the time at which this change was made. @@ -7,7 +7,7 @@ import { Blob } from 'blob-polyfill'; export default class Transaction< T extends { [key: string]: string; - }, + } > { /** * The numeric identifier of the transaction, which should be unique within a block. diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 2801a10f5e..f9367d2f9b 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,8 +1,8 @@ import { Link } from 'gatsby'; import * as React from 'react'; +import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; import Layout from '../components/layout'; import SEO from '../components/seo'; -import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; export default function NotFoundPage() { return ( diff --git a/src/pages/groups/[...].tsx b/src/pages/groups/[...].tsx index 5e0b6fdb56..60d32b9009 100644 --- a/src/pages/groups/[...].tsx +++ b/src/pages/groups/[...].tsx @@ -25,9 +25,9 @@ import PostLeaderboardPage from '../../components/Groups/PostLeaderboardPage/Pos import PostPage from '../../components/Groups/PostPage/PostPage'; import ProblemPage from '../../components/Groups/ProblemPage/ProblemPage'; import { ProblemSubmissionPopupProvider } from '../../components/Groups/ProblemSubmissionPopup'; +import TopNavigationBar from '../../components/TopNavigationBar/TopNavigationBar'; import Layout from '../../components/layout'; import SEO from '../../components/seo'; -import TopNavigationBar from '../../components/TopNavigationBar/TopNavigationBar'; import { SignInContext } from '../../context/SignInContext'; import { useFirebaseUser, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 67702dd342..bec5459af4 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -13,21 +13,21 @@ import classNames from 'classnames'; import { Link } from 'gatsby'; import { StaticImage } from 'gatsby-plugin-image'; import * as React from 'react'; -import { GlowingRing } from '../components/elements/landing/GlowingRing'; -import { GlowingText } from '../components/elements/landing/GlowingText'; -import { GradientText } from '../components/elements/landing/GradientText'; -import { HighlightedText } from '../components/elements/landing/HighlightedText'; -import ContributorsSection from '../components/Index/ContributorsSection'; import { CPIProjectCard } from '../components/Index/CPIProjectCard'; +import ContributorsSection from '../components/Index/ContributorsSection'; import { Feature } from '../components/Index/Feature'; +import TrustedBy from '../components/Index/TrustedBy'; import { ProblemsetsFeature } from '../components/Index/features/ProblemsetsFeature'; import { ProgressTrackingFeature } from '../components/Index/features/ProgressTrackingFeature'; import { ResourcesFeature } from '../components/Index/features/ResourcesFeature'; import { EasyFunCoding, Vercel } from '../components/Index/sponsor-logos'; -import TrustedBy from '../components/Index/TrustedBy'; +import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; +import { GlowingRing } from '../components/elements/landing/GlowingRing'; +import { GlowingText } from '../components/elements/landing/GlowingText'; +import { GradientText } from '../components/elements/landing/GradientText'; +import { HighlightedText } from '../components/elements/landing/HighlightedText'; import Layout from '../components/layout'; import SEO from '../components/seo'; -import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; const containerClasses = 'max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8'; const headerClasses = diff --git a/src/pages/license.tsx b/src/pages/license.tsx index b543ff0c3b..363f5a69ac 100644 --- a/src/pages/license.tsx +++ b/src/pages/license.tsx @@ -1,9 +1,9 @@ // eslint-disable react/no-unescaped-entities import { Link, PageProps } from 'gatsby'; import * as React from 'react'; +import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; import Layout from '../components/layout'; import SEO from '../components/seo'; -import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; export default function LicensePage(props: PageProps) { return ( diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index e37d5bfa0f..b69bd0bf36 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -1,8 +1,5 @@ import { navigate } from 'gatsby'; import * as React from 'react'; -import UnderlinedTabs from '../components/elements/UnderlinedTabs'; -import Layout from '../components/layout'; -import SEO from '../components/seo'; import AdminSettings from '../components/Settings/AdminSettings'; import Authentication from '../components/Settings/Authentication'; import DarkMode from '../components/Settings/DarkMode'; @@ -11,6 +8,9 @@ import Language from '../components/Settings/Language'; import Profile from '../components/Settings/Profile'; import UserData from '../components/Settings/UserData'; import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; +import UnderlinedTabs from '../components/elements/UnderlinedTabs'; +import Layout from '../components/layout'; +import SEO from '../components/seo'; import { useUserPermissions } from '../context/UserDataContext/UserPermissionsContext'; /* diff --git a/src/stories/markdown/Optional.stories.tsx b/src/stories/markdown/Optional.stories.tsx index ed43a2a162..a5edfa1d9f 100644 --- a/src/stories/markdown/Optional.stories.tsx +++ b/src/stories/markdown/Optional.stories.tsx @@ -1,8 +1,8 @@ import { Story } from '@storybook/react'; import React, { ComponentProps } from 'react'; import HTMLComponents from '../../components/markdown/HTMLComponents'; -import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import Optional from '../../components/markdown/Optional'; +import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import MiscMarkdownContent from './MiscMarkdownContent'; export default { diff --git a/src/stories/markdown/Resources.stories.tsx b/src/stories/markdown/Resources.stories.tsx index 0d682ebb42..2c1cc1197a 100644 --- a/src/stories/markdown/Resources.stories.tsx +++ b/src/stories/markdown/Resources.stories.tsx @@ -1,10 +1,10 @@ import { Story } from '@storybook/react'; import React, { ComponentProps } from 'react'; -import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import { Resource, ResourcesList, } from '../../components/markdown/ResourcesList'; +import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; export default { title: 'Markdown/ResourcesList', diff --git a/src/stories/markdown/Spoiler.stories.tsx b/src/stories/markdown/Spoiler.stories.tsx index f85fb935d7..cde46f0619 100644 --- a/src/stories/markdown/Spoiler.stories.tsx +++ b/src/stories/markdown/Spoiler.stories.tsx @@ -1,8 +1,8 @@ import { Story } from '@storybook/react'; import React, { ComponentProps } from 'react'; import HTMLComponents from '../../components/markdown/HTMLComponents'; -import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import Spoiler from '../../components/markdown/Spoiler'; +import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import MiscMarkdownContent from './MiscMarkdownContent'; export default { diff --git a/src/stories/markdown/Warning.stories.tsx b/src/stories/markdown/Warning.stories.tsx index f70eac62a8..ba122f45f1 100644 --- a/src/stories/markdown/Warning.stories.tsx +++ b/src/stories/markdown/Warning.stories.tsx @@ -1,8 +1,8 @@ import { Story } from '@storybook/react'; import React, { ComponentProps } from 'react'; import HTMLComponents from '../../components/markdown/HTMLComponents'; -import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import Warning from '../../components/markdown/Warning'; +import markdownDecorator from '../../components/markdown/markdownDecoratorForStorybook'; import MiscMarkdownContent from './MiscMarkdownContent'; export default { diff --git a/src/styles/prism-theme.css b/src/styles/prism-theme.css index 4cc2e451f1..d0969a3076 100644 --- a/src/styles/prism-theme.css +++ b/src/styles/prism-theme.css @@ -8,9 +8,7 @@ pre[class*='language-'] { word-wrap: normal; color: #c3cee3; background: #263238; - font-family: - Roboto Mono, - monospace; + font-family: Roboto Mono, monospace; font-size: 1em; line-height: 1.5em; diff --git a/src/templates/moduleTemplate.tsx b/src/templates/moduleTemplate.tsx index 8eb0dabbb3..7163148ebc 100644 --- a/src/templates/moduleTemplate.tsx +++ b/src/templates/moduleTemplate.tsx @@ -3,9 +3,9 @@ import * as React from 'react'; import { useEffect } from 'react'; import { Helmet } from 'react-helmet'; import { SECTION_LABELS } from '../../content/ordering'; +import MarkdownLayout from '../components/MarkdownLayout/MarkdownLayout'; import Layout from '../components/layout'; import Markdown from '../components/markdown/Markdown'; -import MarkdownLayout from '../components/MarkdownLayout/MarkdownLayout'; import SEO from '../components/seo'; import { ConfettiProvider } from '../context/ConfettiContext'; import { MarkdownProblemListsProvider } from '../context/MarkdownProblemListsContext'; diff --git a/src/templates/solutionTemplate.tsx b/src/templates/solutionTemplate.tsx index 2fdb4c7c38..b5157f874f 100644 --- a/src/templates/solutionTemplate.tsx +++ b/src/templates/solutionTemplate.tsx @@ -1,8 +1,8 @@ import { graphql } from 'gatsby'; import * as React from 'react'; +import MarkdownLayout from '../components/MarkdownLayout/MarkdownLayout'; import Layout from '../components/layout'; import Markdown from '../components/markdown/Markdown'; -import MarkdownLayout from '../components/MarkdownLayout/MarkdownLayout'; import SEO from '../components/seo'; import { ConfettiProvider } from '../context/ConfettiContext'; import { ProblemSolutionContext } from '../context/ProblemSolutionContext'; diff --git a/src/templates/syllabusTemplate.tsx b/src/templates/syllabusTemplate.tsx index b925ff5987..8c700b860c 100644 --- a/src/templates/syllabusTemplate.tsx +++ b/src/templates/syllabusTemplate.tsx @@ -3,19 +3,19 @@ import * as React from 'react'; import styled from 'styled-components'; import tw from 'twin.macro'; import { - moduleIDToSectionMap, - SectionID, SECTION_LABELS, SECTION_SEO_DESCRIPTION, SECTION_SEO_TITLES, + SectionID, + moduleIDToSectionMap, } from '../../content/ordering'; import DashboardProgress, { DashboardProgressSmall, } from '../components/Dashboard/DashboardProgress'; import ModuleLink from '../components/Dashboard/ModuleLink'; +import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; import Layout from '../components/layout'; import SEO from '../components/seo'; -import TopNavigationBar from '../components/TopNavigationBar/TopNavigationBar'; import { ModuleLinkInfo } from '../models/module'; // import UserDataContext from '../context/UserDataContext/UserDataContext'; import { diff --git a/src/templates/userSolutionTemplate.tsx b/src/templates/userSolutionTemplate.tsx index ed540d97a0..58b2bd4fcb 100644 --- a/src/templates/userSolutionTemplate.tsx +++ b/src/templates/userSolutionTemplate.tsx @@ -1,4 +1,4 @@ -import { navigate, PageProps } from 'gatsby'; +import { navigate } from 'gatsby'; import * as React from 'react'; import ProblemSolutions from '../components/ProblemSolutions'; import SubmitProblemSolutionModal from '../components/SubmitProblemSolutionModal';