From 91759c93324b24878014baa1bf8525dfeb78416c Mon Sep 17 00:00:00 2001 From: Yan Sidyakin Date: Thu, 7 Dec 2023 12:39:11 -0800 Subject: [PATCH] Linting --- pages/FeatureFlags/HackathonFeatureFlags.js | 60 +++++++++--------- pages/FeatureFlags/Hiring.js | 68 ++++++++++----------- pages/[id]/FeatureFlags.js | 8 +-- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/pages/FeatureFlags/HackathonFeatureFlags.js b/pages/FeatureFlags/HackathonFeatureFlags.js index 175dca37..699d8d8e 100644 --- a/pages/FeatureFlags/HackathonFeatureFlags.js +++ b/pages/FeatureFlags/HackathonFeatureFlags.js @@ -1,15 +1,15 @@ -import styled from 'styled-components'; -import { useEffect, useState } from 'react'; -import Page from '../../components/page'; +import styled from 'styled-components' +import { useEffect, useState } from 'react' +import Page from '../../components/page' import Card, { CardHeader, CardButtonContainer, CardTitle, CardContent, -} from '../../components/card'; -import Button from '../../components/button'; -import FeatureFlag from '../../components/FeatureFlag'; -import { COLOR, EDIT, HACKATHON_NAVBAR } from '../../constants'; +} from '../../components/card' +import Button from '../../components/button' +import FeatureFlag from '../../components/FeatureFlag' +import { COLOR, EDIT, HACKATHON_NAVBAR } from '../../constants' import { getTimestamp, subscribeToFlags, @@ -17,43 +17,43 @@ import { updateFlags, getHackathonPaths, getHackathons, -} from '../../utility/firebase'; -import { useAuth } from '../../utility/auth'; +} from '../../utility/firebase' +import { useAuth } from '../../utility/auth' const InlineButton = styled.span` display: inline; float: right; margin: 0 16px; padding-bottom: 32px; -`; +` const InlineButtonContainer = styled.div` display: inline-block; float: right; margin-top: -40px; -`; +` export default function HackathonFeatureFlags({ id, hackathons }) { - const [editing, setEditing] = useState(false); - const [flags, setFlags] = useState({}); - const [editedFlags, setEditedFlags] = useState({}); - const { email: user } = useAuth().user; + const [editing, setEditing] = useState(false) + const [flags, setFlags] = useState({}) + const [editedFlags, setEditedFlags] = useState({}) + const { email: user } = useAuth().user useEffect(() => { - return subscribeToFlags(id, setFlags); - }, [window.location.href]); + return subscribeToFlags(id, setFlags) + }, [window.location.href]) useEffect(() => { if (!editing) { - setEditedFlags({}); + setEditedFlags({}) } - }, [editing]); + }, [editing]) const saveFlags = async () => { - const updateObj = editedFlags; - updateObj.lastEdited = getTimestamp(); - updateObj.lastEditedBy = user; - await updateFlags(id, updateObj); - setEditing(false); - }; + const updateObj = editedFlags + updateObj.lastEdited = getTimestamp() + updateObj.lastEditedBy = user + await updateFlags(id, updateObj) + setEditing(false) + } const EditFlagsComponent = () => ( <> @@ -95,9 +95,9 @@ export default function HackathonFeatureFlags({ id, hackathons }) { <> {Object.entries(flags).map(([key, value]) => { if (key === 'lastEdited' || key === 'lastEditedBy') { - return null; + return null } - return ; + return })} ); @@ -135,10 +135,10 @@ export default function HackathonFeatureFlags({ id, hackathons }) { type={EDIT} onClick={() => { if (editing) { - setEditing(false); + setEditing(false) } else { - setEditedFlags(flags); - setEditing(true); + setEditedFlags(flags) + setEditing(true) } }} /> diff --git a/pages/FeatureFlags/Hiring.js b/pages/FeatureFlags/Hiring.js index 33b87ac3..1c92f990 100644 --- a/pages/FeatureFlags/Hiring.js +++ b/pages/FeatureFlags/Hiring.js @@ -86,51 +86,51 @@ export default function Hiring({ id, hackathons }) { } const saveFlags = async () => { - const updateObj = editedFlags; - updateObj.lastEdited = getTimestamp(); - updateObj.lastEditedBy = user; - await updateFlags(id, updateObj); - }; + const updateObj = editedFlags + updateObj.lastEdited = getTimestamp() + updateObj.lastEditedBy = user + await updateFlags(id, updateObj) + } const saveHiringSettings = async () => { - const updateObj = editedHiringSettings; - updateObj.lastEdited = getTimestamp(); - updateObj.lastEditedBy = user; - await updateHiringSettings(updateObj); - }; + const updateObj = editedHiringSettings + updateObj.lastEdited = getTimestamp() + updateObj.lastEditedBy = user + await updateHiringSettings(updateObj) + } const saveCtaLink = async () => { await updateCtaLink(editedCtaLink) - }; + } const handleHiringSettingsChange = (key, newValue) => { setEditedHiringSettings({ - ...editedHiringSettings, - [key]: newValue + ...editedHiringSettings, + [key]: newValue, }) - }; + } /* * Converts a string from "thisTypeOfCase" to "This type of case" */ - const stringFromKey = (key) => { - const isUpperCase = (i) => { + const stringFromKey = key => { + const isUpperCase = i => { return key[i] === key[i].toUpperCase() } - let keyString = ''; + let keyString = '' for (let i = 0; i < key.length; i++) { - if (i == 0) { - keyString += key[i].toUpperCase(); - continue; + if (i === 0) { + keyString += key[i].toUpperCase() + continue } if (isUpperCase(i) && !isUpperCase(i + 1)) { - keyString += ' '; - keyString += key[i].toLowerCase(); + keyString += ' ' + keyString += key[i].toLowerCase() } else { - keyString += key[i]; + keyString += key[i] } } - return keyString; + return keyString } if (!flags) { @@ -166,12 +166,12 @@ export default function Hiring({ id, hackathons }) { type={EDIT} onClick={() => { if (editing) { - setEditing(false); + setEditing(false) } else { - setEditedCtaLink(ctaLink); - setEditedFlags(flags); - setEditedHiringSettings(hiringSettings); - setEditing(true); + setEditedCtaLink(ctaLink) + setEditedFlags(flags) + setEditedHiringSettings(hiringSettings) + setEditing(true) } }} /> @@ -188,7 +188,7 @@ export default function Hiring({ id, hackathons }) { /> {Object.entries(editedFlags).map(([key, value]) => { if (key === 'lastEdited' || key === 'lastEditedBy') { - return null; + return null } return ( ); })} {Object.entries(editedHiringSettings).map(([key, value]) => { if (key === 'lastEdited' || key === 'lastEditedBy') { - return null; + return null } return (
@@ -241,13 +241,13 @@ export default function Hiring({ id, hackathons }) { {Object.entries(flags).map(([key, value]) => { if (key === 'lastEdited' || key === 'lastEditedBy') { - return null; + return null } return ; })} {Object.entries(hiringSettings).map(([key, value]) => { if (key === 'lastEdited' || key === 'lastEditedBy') { - return null; + return null } return diff --git a/pages/[id]/FeatureFlags.js b/pages/[id]/FeatureFlags.js index d633d33c..23cce0b4 100644 --- a/pages/[id]/FeatureFlags.js +++ b/pages/[id]/FeatureFlags.js @@ -1,12 +1,12 @@ -import Hiring from '../FeatureFlags/Hiring'; -import HackathonFeatureFlags from '../FeatureFlags/HackathonFeatureFlags'; +import Hiring from '../FeatureFlags/Hiring' +import HackathonFeatureFlags from '../FeatureFlags/HackathonFeatureFlags' import { getHackathonPaths, getHackathons, -} from '../../utility/firebase'; +} from '../../utility/firebase' export default ({ id, hackathons }) => { - return id === 'www' ? : ; + return id === 'www' ? : } export const getStaticPaths = async () => {