changed prettier config

This commit is contained in:
Kim, Jimin 2022-01-11 17:25:15 +09:00
parent 5a3e0d2623
commit 1758571f4a
37 changed files with 236 additions and 311 deletions

View file

@ -1,5 +1,4 @@
{
"tabWidth": 4,
"useTabs": true,
"semi": false
}

View file

@ -79,8 +79,7 @@ export function parseFrontMatter(
).data
if (mode != ParseMode.PORTFOLIO) {
if (!frontMatter.title)
throw Error(`Title is not defined in file: ${path}`)
if (!frontMatter.title) throw Error(`Title is not defined in file: ${path}`)
if (mode != ParseMode.UNSEARCHABLE && !frontMatter.date)
throw Error(`Date is not defined in file: ${path}`)

View file

@ -1,4 +1,5 @@
<div class="items-wrapper">
<% badges.forEach((badge) => { %> <%- include("badge.ejs", { badge }) %> <%
}) %>
<% badges.forEach((badge) => { %>
<%- include("badge.ejs", { badge }) %>
<% }) %>
</div>

View file

@ -44,9 +44,7 @@ function parseSeries() {
// series length and order
for (const seriesURL in seriesMap) {
map.series[seriesURL].length = seriesMap[seriesURL].length
map.series[seriesURL].order = seriesMap[seriesURL].map(
(item) => item.url
)
map.series[seriesURL].order = seriesMap[seriesURL].map((item) => item.url)
}
}
@ -68,13 +66,9 @@ function generatePortfolioSVGs() {
}
for (const skillCategory in skills) {
skills[skillCategory as keyof typeof skills].forEach(
(badge: string) => {
data[skillCategory as keyof typeof skills].push(
parseBadge(badge)
)
}
)
skills[skillCategory as keyof typeof skills].forEach((badge: string) => {
data[skillCategory as keyof typeof skills].push(parseBadge(badge))
})
}
const renderedSVG = ejs.render(
@ -92,9 +86,7 @@ function parseBadge(badgeRaw: string): Badge {
const isMultiWord = badgeRaw.includes(" ")
const words = badgeRaw.split(" ")
const icon = isMultiWord
? simpleIcon.Get(words[0])
: simpleIcon.Get(badgeRaw)
const icon = isMultiWord ? simpleIcon.Get(words[0]) : simpleIcon.Get(badgeRaw)
const color = tinycolor(icon.hex).lighten(5).desaturate(5)

View file

@ -7,13 +7,8 @@ import { map } from ".."
import { DataToPass } from "."
export default function parsePost(data: DataToPass): void {
const {
urlPath,
markdownRaw,
markdownData,
humanizedDuration,
totalWords,
} = data
const { urlPath, markdownRaw, markdownData, humanizedDuration, totalWords } =
data
const postData: PostData = {
title: markdownData.title as string,

View file

@ -114,8 +114,7 @@ export default function parseSeries(data: DataToPass): void {
)
)
if (isNaN(index))
throw Error(`Invalid series index at: ${path}`)
if (isNaN(index)) throw Error(`Invalid series index at: ${path}`)
const itemToPush = {
index: index,

View file

@ -21,8 +21,7 @@ export function path2URL(pathToConvert: string): string {
*/
export function path2FileOrFolderName(inputPath: string): string {
// remove trailing slash
if (inputPath[-1] == "/")
inputPath = inputPath.slice(0, inputPath.length - 1)
if (inputPath[-1] == "/") inputPath = inputPath.slice(0, inputPath.length - 1)
// get the last section
return inputPath.slice(inputPath.lastIndexOf("/") + 1)

View file

@ -9,5 +9,7 @@ badges:
# - cairo
---
## Intro
Pomky is a [conky](https://github.com/brndnmtthws/conky)-like system monitor written in rust.
It is built to teach myself the rust programming language and to write a more flexible, efficient, and tailored version of conky.

View file

@ -91,10 +91,7 @@ const App = () => {
<Loading />
) : (
<Routes>
<Route
path="/"
element={<PostList howMany={5} title="Home" />}
/>
<Route path="/" element={<PostList howMany={5} title="Home" />} />
<Route path="/search" element={<Search />} />
<Route path="/portfolio" element={<Portfolio />} />
<Route path="/404" element={<NotFound />} />

View file

@ -27,9 +27,7 @@ const StyledSVG = styled.div<{ isDark: boolean }>`
svg {
height: 16px;
fill: ${(props) =>
props.isDark
? theming.dark.color1
: theming.light.color1} !important;
props.isDark ? theming.dark.color1 : theming.light.color1} !important;
}
`

View file

@ -87,9 +87,7 @@ const ReadProgress = () => {
const b = document.body
// https://stackoverflow.com/a/8028584/12979111
setScroll(
((h[st] || b[st]) / ((h[sh] || b[sh]) - h.clientHeight)) * 100
)
setScroll(((h[st] || b[st]) / ((h[sh] || b[sh]) - h.clientHeight)) * 100)
}
window.addEventListener("scroll", scrollHandler)
@ -107,9 +105,7 @@ const Navbar = () => {
<StyledNav>
<StyledContainer>
<Link to="/">
<StyledImg
src={process.env.PUBLIC_URL + "/icon/icon_circle.svg"}
/>
<StyledImg src={process.env.PUBLIC_URL + "/icon/icon_circle.svg"} />
</Link>
<StyledNavLinks>

View file

@ -58,9 +58,7 @@ const PostCard = (props: Props) => {
return (
<StyledPostCard
onClick={() =>
navigate(process.env.PUBLIC_URL + props.postData.url)
}
onClick={() => navigate(process.env.PUBLIC_URL + props.postData.url)}
>
<StyledTitle>{props.postData?.title || "No title"}</StyledTitle>
@ -70,12 +68,7 @@ const PostCard = (props: Props) => {
<TagList direction="left">
{props.postData.tags &&
props.postData.tags.map((tag) => {
return (
<Tag
key={props.postData.title + tag}
text={tag}
/>
)
return <Tag key={props.postData.title + tag} text={tag} />
})}
</TagList>
<hr />

View file

@ -89,10 +89,7 @@ const Sidebar = () => {
return (
<>
<StyledOverlay
isSidebarOpen={isSidebarOpen}
onClick={toggleSidebar}
/>
<StyledOverlay isSidebarOpen={isSidebarOpen} onClick={toggleSidebar} />
<StyledToggleSidebarButton
data-tip

View file

@ -25,16 +25,10 @@ const Navbar = () => {
data-tip
data-for="theme"
className="right"
onClick={() =>
setTheme(currentTheme === "dark" ? "light" : "dark")
}
onClick={() => setTheme(currentTheme === "dark" ? "light" : "dark")}
>
{currentTheme == "dark" && (
<FontAwesomeIcon icon={faMoon} />
)}
{currentTheme == "light" && (
<FontAwesomeIcon icon={faSun} />
)}
{currentTheme == "dark" && <FontAwesomeIcon icon={faMoon} />}
{currentTheme == "light" && <FontAwesomeIcon icon={faSun} />}
</StyledThemeButton>
{!isMobile && (
<ReactTooltip id="theme" type="dark" effect="solid">

View file

@ -48,9 +48,7 @@ const Toc = (props: { data?: string }) => {
>
<strong>
Table of Contents{" "}
<FontAwesomeIcon
icon={isTocOpened ? faCaretUp : faCaretDown}
/>
<FontAwesomeIcon icon={isTocOpened ? faCaretUp : faCaretDown} />
</strong>
</StyledTocToggleButton>
<StyledCollapseContainer>

View file

@ -95,8 +95,7 @@ const Page = () => {
}
case PageType.SERIES: {
if (!(url.slice(0, url.lastIndexOf("/")) in map.series))
show404 = true
if (!(url.slice(0, url.lastIndexOf("/")) in map.series)) show404 = true
break
}
@ -182,9 +181,7 @@ const Page = () => {
pageData.seriesHome = seriesURL
pageData.prev =
prev >= 0
? map.series[seriesURL].order[prev]
: undefined
prev >= 0 ? map.series[seriesURL].order[prev] : undefined
pageData.next =
next < map.series[seriesURL].order.length
? map.series[seriesURL].order[next]
@ -195,9 +192,7 @@ const Page = () => {
case PageType.PORTFOLIO_PROJECT: {
const data =
portfolio.projects[
url as keyof typeof portfolio.projects
]
portfolio.projects[url as keyof typeof portfolio.projects]
pageData.content = fetched_content.content
pageData.toc = fetched_content.toc
@ -246,10 +241,7 @@ const Page = () => {
<MainContent>
{/* next/previous series post buttons */}
{pageType == PageType.SERIES && (
<NextPrevButtons
prevURL={pageData.prev}
nextURL={pageData.next}
/>
<NextPrevButtons prevURL={pageData.prev} nextURL={pageData.next} />
)}
{pageType == PageType.PORTFOLIO_PROJECT && (
@ -262,9 +254,7 @@ const Page = () => {
</StyledTitle>
{pageType == PageType.PORTFOLIO_PROJECT &&
pageData.badges.map((badge) => (
<Badge key={badge} slug={badge} />
))}
pageData.badges.map((badge) => <Badge key={badge} slug={badge} />)}
<small>
{/* Post tags */}
@ -294,10 +284,7 @@ const Page = () => {
<Toc data={pageData.toc} />
{pageType == PageType.PORTFOLIO_PROJECT && (
<ProjectImage
src={pageData.image}
alt="project example image"
/>
<ProjectImage src={pageData.image} alt="project example image" />
)}
{/* page content */}

View file

@ -33,9 +33,7 @@ const ProjectCard = (props: ProjectCardProps) => {
const navigate = useNavigate()
useEffect(() => {
setBadges(
project.badges.map((badge) => <Badge key={badge} slug={badge} />)
)
setBadges(project.badges.map((badge) => <Badge key={badge} slug={badge} />))
}, [])
return (

View file

@ -52,10 +52,7 @@ const Portfolio = () => {
property="og:image"
content="http://developomp.com/icon/icon.svg"
/>
<meta
property="og:description"
content="developomp's Portfolio"
/>
<meta property="og:description" content="developomp's Portfolio" />
</Helmet>
<MainContent>

View file

@ -50,10 +50,7 @@ const PostList = (props: Props) => {
postCount++
const url: string = map.date[date][length - i - 1]
_postCards.push(
<PostCard
key={url}
postData={{ url: url, ...map.posts[url] }}
/>
<PostCard key={url} postData={{ url: url, ...map.posts[url] }} />
)
}
}

View file

@ -81,8 +81,7 @@ const TagSelect = (props: TagSelectProps) => {
":hover": {
backgroundColor: theming
.theme(currentTheme.currentTheme, {
light: theming.light
.backgroundColor0,
light: theming.light.backgroundColor0,
dark: theming.dark.backgroundColor0,
})
.toString(),
@ -96,13 +95,10 @@ const TagSelect = (props: TagSelectProps) => {
dark: theming.dark.backgroundColor1,
})
.toString(),
border: theming.theme(
currentTheme.currentTheme,
{
border: theming.theme(currentTheme.currentTheme, {
light: "1px solid #ccc",
dark: "1px solid #555",
}
),
}),
}),
multiValue: (styles) => ({
...styles,

View file

@ -114,15 +114,11 @@ const Search = () => {
for (const [key, value] of URLSearchParams.entries()) {
switch (key) {
case "date_from":
setDateRange((prev) => [
{ ...prev[0], startDate: new Date(value) },
])
setDateRange((prev) => [{ ...prev[0], startDate: new Date(value) }])
break
case "date_to":
setDateRange((prev) => [
{ ...prev[0], endDate: new Date(value) },
])
setDateRange((prev) => [{ ...prev[0], endDate: new Date(value) }])
break
case "tags":
@ -258,17 +254,12 @@ const Search = () => {
value={searchInput}
autoComplete="off"
placeholder="Search"
onChange={(event) =>
setSearchInput(event.target.value)
}
onChange={(event) => setSearchInput(event.target.value)}
onKeyPress={(event) => {
event.key === "Enter" &&
searchInput &&
doSearch()
event.key === "Enter" && searchInput && doSearch()
}}
/>
{postCards.length}{" "}
{postCards.length > 1 ? "results" : "result"}
{postCards.length} {postCards.length > 1 ? "results" : "result"}
<TagSelect
defaultValue={selectedTags}
onChange={(newValue) => {