Skip to content

Commit 1b1cf19

Browse files
committed
🚨 Fix Linter warnings.
1 parent 5d31170 commit 1b1cf19

24 files changed

+42
-37
lines changed

components/Header.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,18 @@ const Header = ({ navBarTitle, fullWidth }) => {
9999
</div>
100100
</a>
101101
</Link>
102-
{navBarTitle ? (
102+
{navBarTitle
103+
? (
103104
<p className="ml-2 font-medium text-day dark:text-night header-name">
104105
{navBarTitle}
105106
</p>
106-
) : (
107+
)
108+
: (
107109
<p className="ml-2 font-medium text-day dark:text-night header-name">
108110
{BLOG.title},{' '}
109111
<span className="font-normal">{BLOG.description}</span>
110112
</p>
111-
)}
113+
)}
112114
</div>
113115
<NavBar />
114116
</div>

components/Scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ const Scripts = () => (
4545
</>
4646
)
4747

48-
export default Scripts
48+
export default Scripts

components/Tags.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const Tags = ({ tags, currentTag }) => {
66
<div className="tag-container">
77
<ul className="flex max-w-full mt-4 overflow-x-auto">
88
{Object.keys(tags).map(key => {
9-
const selected = key === currentTag;
9+
const selected = key === currentTag
1010
return (
1111
<Link key={key} href={selected ? '/search' : `/tag/${encodeURIComponent(key)}`}>
1212
<a>
@@ -21,7 +21,8 @@ const Tags = ({ tags, currentTag }) => {
2121
</li>
2222
</a>
2323
</Link>
24-
)})}
24+
)
25+
})}
2526
</ul>
2627
</div>
2728
)

components/Utterances.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const Utterances = ({ issueTerm, layout }) => {
66
BLOG.appearance === 'auto'
77
? 'preferred-color-scheme'
88
: BLOG.appearance === 'light'
9-
? 'github-light'
10-
: 'github-dark'
9+
? 'github-light'
10+
: 'github-dark'
1111
const script = document.createElement('script')
1212
const anchor = document.getElementById('comments')
1313
script.setAttribute('src', 'https://utteranc.es/client.js')

lib/formatDate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function formatDate(date, local) {
1+
export default function formatDate (date, local) {
22
const d = new Date(date)
33
const options = { year: 'numeric', month: 'short', day: 'numeric' }
44
const res = d.toLocaleDateString(local, options)

lib/locale.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fetchLocaleLang } from '@/lib/lang'
44
const locale = fetchLocaleLang()
55
const LocaleContext = createContext()
66

7-
export function LocaleProvider({ children }) {
7+
export function LocaleProvider ({ children }) {
88
return (
99
<LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>
1010
)

lib/notion/filterPublishedPosts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
22

33
const currentDate = new Date().toLocaleDateString(BLOG.lang ?? 'en-US')
44

5-
export default function filterPublishedPosts({ posts, includePages }) {
5+
export default function filterPublishedPosts ({ posts, includePages }) {
66
if (!posts || !posts.length) return []
77
const publishedPosts = posts
88
.filter(post =>

lib/notion/getAllPageIds.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { idToUuid } from 'notion-utils'
2-
export default function getAllPageIds(collectionQuery, viewId) {
2+
export default function getAllPageIds (collectionQuery, viewId) {
33
const views = Object.values(collectionQuery)[0]
44
let pageIds = []
55
if (viewId) {

lib/notion/getAllPosts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import filterPublishedPosts from './filterPublishedPosts'
88
/**
99
* @param {{ includePages: boolean }} - false: posts only / true: include pages
1010
*/
11-
export async function getAllPosts({ includePages = false }) {
11+
export async function getAllPosts ({ includePages = false }) {
1212
let id = BLOG.notionPageId
1313
const authToken = BLOG.notionAccessToken || null
1414
const api = new NotionAPI({ authToken })

lib/notion/getAllTagsFromPosts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function getAllTagsFromPosts(posts) {
1+
export function getAllTagsFromPosts (posts) {
22
const taggedPosts = posts.filter(post => post?.tags)
33
const tags = [...taggedPosts.map(p => p.tags).flat()]
44
const tagObj = {}

lib/notion/getMetadata.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function getMetadata(rawMetadata) {
1+
export default function getMetadata (rawMetadata) {
22
const metadata = {
33
locked: rawMetadata?.format?.block_locked,
44
page_full_width: rawMetadata?.format?.page_full_width,

lib/notion/getPageProperties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getTextContent, getDateValue } from 'notion-utils'
22
import { NotionAPI } from 'notion-client'
33

4-
async function getPageProperties(id, block, schema, authToken) {
4+
async function getPageProperties (id, block, schema, authToken) {
55
const api = new NotionAPI({ authToken })
66
const rawProperties = Object.entries(block?.[id]?.value?.properties || [])
77
const excludeProperties = ['date', 'select', 'multi_select', 'person']

lib/notion/getPostBlocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import BLOG from '@/blog.config'
22
import { NotionAPI } from 'notion-client'
33

4-
export async function getPostBlocks(id) {
4+
export async function getPostBlocks (id) {
55
const authToken = BLOG.notionAccessToken || null
66
const api = new NotionAPI({ authToken })
77
const pageBlock = await api.getPage(id)

lib/rss.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Feed } from 'feed'
22
import BLOG from '@/blog.config'
33

4-
export function generateRss(posts) {
4+
export function generateRss (posts) {
55
const year = new Date().getFullYear()
66
const feed = new Feed({
77
title: BLOG.title,

next-sitemap.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const BLOG = require('./blog.config')
33
module.exports = {
44
siteUrl: BLOG.link,
55
generateRobotsTxt: true,
6-
sitemapSize: 7000,
6+
sitemapSize: 7000
77
// ...other options
88
// https://github.com/iamvishnusankar/next-sitemap#configuration-options
99
}

next.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
'pages'
1212
]
1313
},
14-
async headers() {
14+
async headers () {
1515
return [
1616
{
1717
source: '/:path*{/}?',

pages/[slug].js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ const BlogPost = ({ post, blockMap, emailHash }) => {
1515
)
1616
}
1717

18-
export async function getStaticPaths() {
18+
export async function getStaticPaths () {
1919
const posts = await getAllPosts({ includePages: true })
2020
return {
2121
paths: posts.map(row => `${BLOG.path}/${row.slug}`),
2222
fallback: true
2323
}
2424
}
2525

26-
export async function getStaticProps({ params: { slug } }) {
26+
export async function getStaticProps ({ params: { slug } }) {
2727
const posts = await getAllPosts({ includePages: true })
2828
const post = posts.find(t => t.slug === slug)
2929
const blockMap = await getPostBlocks(post.id)

pages/_app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Scripts from '@/components/Scripts'
1111
const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false })
1212
const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false })
1313

14-
function MyApp({ Component, pageProps }) {
14+
function MyApp ({ Component, pageProps }) {
1515
return (
1616
<>
1717
<Scripts />

pages/_document.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ import Document, { Html, Head, Main, NextScript } from 'next/document'
22
import BLOG from '@/blog.config'
33
import CJK from '@/lib/cjk'
44
class MyDocument extends Document {
5-
static async getInitialProps(ctx) {
5+
static async getInitialProps (ctx) {
66
const initialProps = await Document.getInitialProps(ctx)
77
return { ...initialProps }
88
}
99

10-
render() {
10+
render () {
1111
return (
1212
<Html
1313
lang={BLOG.lang}
1414
className={BLOG.appearance === 'dark' ? 'dark' : undefined}
1515
>
1616
<Head>
17-
{BLOG.font && BLOG.font === 'serif' ? (
17+
{BLOG.font && BLOG.font === 'serif'
18+
? (
1819
<>
1920
<link
2021
rel="preload"
@@ -31,7 +32,8 @@ class MyDocument extends Document {
3132
crossOrigin="anonymous"
3233
/>
3334
</>
34-
) : (
35+
)
36+
: (
3537
<>
3638
<link
3739
rel="preload"
@@ -48,7 +50,7 @@ class MyDocument extends Document {
4850
crossOrigin="anonymous"
4951
/>
5052
</>
51-
)}
53+
)}
5254

5355
{['zh', 'ja', 'ko'].includes(
5456
BLOG.lang.slice(0, 2).toLocaleLowerCase()

pages/feed.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getAllPosts } from '@/lib/notion'
22
import { generateRss } from '@/lib/rss'
3-
export async function getServerSideProps({ res }) {
3+
export async function getServerSideProps ({ res }) {
44
res.setHeader('Content-Type', 'text/xml')
55
const posts = await getAllPosts({ includePages: false })
66
const latestPosts = posts.slice(0, 10)

pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Pagination from '@/components/Pagination'
44
import { getAllPosts } from '@/lib/notion'
55
import BLOG from '@/blog.config'
66

7-
export async function getStaticProps() {
7+
export async function getStaticProps () {
88
const posts = await getAllPosts({ includePages: false })
99
const postsToShow = posts.slice(0, BLOG.postsPerPage)
1010
const totalPosts = posts.length

pages/page/[page].js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Page = ({ postsToShow, page, showNext }) => {
1414
)
1515
}
1616

17-
export async function getStaticProps(context) {
17+
export async function getStaticProps (context) {
1818
const { page } = context.params // Get Current Page No.
1919
const posts = await getAllPosts({ includePages: false })
2020
const postsToShow = posts.slice(
@@ -33,7 +33,7 @@ export async function getStaticProps(context) {
3333
}
3434
}
3535

36-
export async function getStaticPaths() {
36+
export async function getStaticPaths () {
3737
const posts = await getAllPosts({ includePages: false })
3838
const totalPosts = posts.length
3939
const totalPages = Math.ceil(totalPosts / BLOG.postsPerPage)

pages/search.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { getAllPosts, getAllTagsFromPosts } from '@/lib/notion'
22
import SearchLayout from '@/layouts/search'
33

4-
export default function search({ tags, posts }) {
4+
export default function search ({ tags, posts }) {
55
return <SearchLayout tags={tags} posts={posts} />
66
}
7-
export async function getStaticProps() {
7+
export async function getStaticProps () {
88
const posts = await getAllPosts({ includePages: false })
99
const tags = getAllTagsFromPosts(posts)
1010
return {

pages/tag/[tag].js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { getAllPosts, getAllTagsFromPosts } from '@/lib/notion'
22
import SearchLayout from '@/layouts/search'
33

4-
export default function Tag({ tags, posts, currentTag }) {
4+
export default function Tag ({ tags, posts, currentTag }) {
55
return <SearchLayout tags={tags} posts={posts} currentTag={currentTag} />
66
}
77

8-
export async function getStaticProps({ params }) {
8+
export async function getStaticProps ({ params }) {
99
const currentTag = params.tag
1010
const posts = await getAllPosts({ includePages: false })
1111
const tags = getAllTagsFromPosts(posts)
@@ -22,7 +22,7 @@ export async function getStaticProps({ params }) {
2222
}
2323
}
2424

25-
export async function getStaticPaths() {
25+
export async function getStaticPaths () {
2626
const posts = await getAllPosts({ includePages: false })
2727
const tags = getAllTagsFromPosts(posts)
2828
return {

0 commit comments

Comments
 (0)