Skip to content

Commit

Permalink
refactor: lint code to comply with Astro recommend eslint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gaomingzhao666 committed Oct 28, 2024
1 parent a0b8bcc commit 656a621
Show file tree
Hide file tree
Showing 66 changed files with 1,524 additions and 1,191 deletions.
8 changes: 4 additions & 4 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// .prettierrc.mjs
/** @type {import("prettier").Config} */
export default {
plugins: ["prettier-plugin-astro"],
plugins: ['prettier-plugin-astro'],
semi: false,
singleQuote: true,
overrides: [
{
files: "*.astro",
files: '*.astro',
options: {
parser: "astro",
parser: 'astro',
singleQuote: true,
semi: false,
},
},
],
};
}
104 changes: 0 additions & 104 deletions README.es.md

This file was deleted.

48 changes: 24 additions & 24 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ import { remarkReadingTime } from './src/utils/readTime.ts'

// https://astro.build/config
export default defineConfig({
site: 'https://blog-template-gray.vercel.app/', // Write here your website url
markdown: {
remarkPlugins: [remarkReadingTime],
drafts: true,
shikiConfig: {
theme: 'material-theme-palenight',
wrap: true
}
},
integrations: [
mdx({
syntaxHighlight: 'shiki',
shikiConfig: {
experimentalThemes: {
light: 'vitesse-light',
dark: 'material-theme-palenight',
},
wrap: true
},
drafts: true
}),
sitemap(),
tailwind()
]
site: 'https://blog-template-gray.vercel.app/', // Write here your website url
markdown: {
remarkPlugins: [remarkReadingTime],
drafts: true,
shikiConfig: {
theme: 'material-theme-palenight',
wrap: true,
},
},
integrations: [
mdx({
syntaxHighlight: 'shiki',
shikiConfig: {
experimentalThemes: {
light: 'vitesse-light',
dark: 'material-theme-palenight',
},
wrap: true,
},
drafts: true,
}),
sitemap(),
tailwind(),
],
})
78 changes: 39 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"name": "nano-blog",
"type": "module",
"scripts": {
"start": "astro dev",
"build": "astro check && astro build",
"sync": "astro sync",
"preview": "astro preview",
"lint": "eslint ."
},
"dependencies": {
"@astrojs/check": "0.9.4",
"@astrojs/rss": "4.0.9",
"astro": "4.16.6",
"astro-font": "0.1.81"
},
"devDependencies": {
"@astrojs/mdx": "3.1.8",
"@astrojs/sitemap": "3.2.1",
"@astrojs/tailwind": "5.1.2",
"@pagefind/default-ui": "1.1.1",
"@tailwindcss/typography": "0.5.15",
"@typescript-eslint/parser": "8.10.0",
"clsx": "2.1.1",
"eslint": "9.13.0",
"eslint-plugin-astro": "1.3.0",
"eslint-plugin-jsx-a11y": "6.10.0",
"lint-staged": "15.2.10",
"mdast-util-to-string": "4.0.0",
"motion": "10.18.0",
"pagefind": "1.1.1",
"prettier": "3.3.3",
"prettier-config-standard": "7.0.0",
"prettier-plugin-astro": "0.14.1",
"reading-time": "1.5.0",
"slugify": "1.6.6",
"tailwind-merge": "2.5.4",
"tailwindcss": "3.4.14",
"typescript": "^5.6.3"
}
"name": "nano-blog",
"type": "module",
"scripts": {
"start": "astro dev",
"build": "astro check && astro build",
"sync": "astro sync",
"preview": "astro preview",
"lint": "eslint ."
},
"dependencies": {
"@astrojs/check": "0.9.4",
"@astrojs/rss": "4.0.9",
"astro": "4.16.6",
"astro-font": "0.1.81"
},
"devDependencies": {
"@astrojs/mdx": "3.1.8",
"@astrojs/sitemap": "3.2.1",
"@astrojs/tailwind": "5.1.2",
"@pagefind/default-ui": "1.1.1",
"@tailwindcss/typography": "0.5.15",
"@typescript-eslint/parser": "8.10.0",
"clsx": "2.1.1",
"eslint": "9.13.0",
"eslint-plugin-astro": "1.3.0",
"eslint-plugin-jsx-a11y": "6.10.0",
"lint-staged": "15.2.10",
"mdast-util-to-string": "4.0.0",
"motion": "10.18.0",
"pagefind": "1.1.1",
"prettier": "3.3.3",
"prettier-config-standard": "7.0.0",
"prettier-plugin-astro": "0.14.1",
"reading-time": "1.5.0",
"slugify": "1.6.6",
"tailwind-merge": "2.5.4",
"tailwindcss": "3.4.14",
"typescript": "^5.6.3"
}
}
4 changes: 2 additions & 2 deletions src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
const today = new Date()
---

<footer class='flex justify-center items-center w-full px-16 h-28 border-t-2'>
&copy; {today.getFullYear()} Your Name. All rights reserved.
<footer class="flex justify-center items-center w-full px-16 h-28 border-t-2">
&copy; {today.getFullYear()} Your Name. All rights reserved.
</footer>
18 changes: 9 additions & 9 deletions src/components/FormattedDate.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
export interface Props {
date: Date
date: Date
}
const { date } = Astro.props
---

<time class='text-sm font-bold text-opacity-60' datetime={date.toISOString()}>
{
date.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
}
<time class="text-sm font-bold text-opacity-60" datetime={date.toISOString()}>
{
date.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
</time>
58 changes: 33 additions & 25 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,39 @@ const lang = getLangFromUrl(Astro.url)
const t = useTranslations(lang)
---

<header class='flex justify-between items-center h-12 font-semibold'>
<a class='text-xl mr-auto transition-all hover:font-bold' href='/'>nano-blog</a>

<div class='dark:bg-[#0a0910] pl-4 pt-6 pb-4 md:p-0 z-50'>
<nav class='flex justify-between gap-3'>
<div class='flex gap-3 border-black mr-3 dark:border-white'>
<HeaderLink href='/' class='flex items-center gap-1'> {t('nav.home')} </HeaderLink>
<HeaderLink href='/tags' class='flex items-center gap-1'> {t('nav.tags')} </HeaderLink>
<HeaderLink href='/about' class='flex items-center gap-1'> {t('nav.about')} </HeaderLink>
</div>

<LanguagePicker />
<HeaderLink
class={''}
target={'_blank'}
href={'https://github.com/gaomingzhao666/nano-blog'}
aria-label={'Github'}><GithubIcon /></HeaderLink
>

<Search />
<ToggleTheme />
</nav>
</div>

<!-- <div class='flex items-center gap-3 md:pl-3' transition:persist='navbar'>
<header class="flex justify-between items-center h-12 font-semibold">
<a class="text-xl mr-auto transition-all hover:font-bold" href="/"
>nano-blog</a
>

<div class="dark:bg-[#0a0910] pl-4 pt-6 pb-4 md:p-0 z-50">
<nav class="flex justify-between gap-3">
<div class="flex gap-3 border-black mr-3 dark:border-white">
<HeaderLink href="/" class="flex items-center gap-1">
{t('nav.home')}
</HeaderLink>
<HeaderLink href="/tags" class="flex items-center gap-1">
{t('nav.tags')}
</HeaderLink>
<HeaderLink href="/about" class="flex items-center gap-1">
{t('nav.about')}
</HeaderLink>
</div>

<LanguagePicker />
<HeaderLink
class={''}
target={'_blank'}
href={'https://github.com/gaomingzhao666/nano-blog'}
aria-label={'Github'}><GithubIcon /></HeaderLink
>

<Search />
<ToggleTheme />
</nav>
</div>

<!-- <div class='flex items-center gap-3 md:pl-3' transition:persist='navbar'>
<Search />
<ToggleTheme />
Expand Down
10 changes: 5 additions & 5 deletions src/components/HeaderLink.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const isActive = href === pathname || href === pathname.replace(/\/$/, '')
---

<a
href={href}
class={cn(isActive ? 'text-opacity-100' : 'text-opacity-60', className)}
rel='noopener noreferrer '
{...props}
href={href}
class={cn(isActive ? 'text-opacity-100' : 'text-opacity-60', className)}
rel="noopener noreferrer "
{...props}
>
<slot />
<slot />
</a>
Loading

0 comments on commit 656a621

Please sign in to comment.