Skip to content

Commit

Permalink
chore: migrate from eslint and prettier to biome
Browse files Browse the repository at this point in the history
  • Loading branch information
ladit committed May 13, 2024
1 parent 79d43b3 commit fd19131
Show file tree
Hide file tree
Showing 36 changed files with 239 additions and 329 deletions.
15 changes: 0 additions & 15 deletions .editorconfig

This file was deleted.

19 changes: 0 additions & 19 deletions .prettierignore

This file was deleted.

29 changes: 0 additions & 29 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Check out the ✨ [Live Demo](https://astro-blog-zozo.pages.dev/) ✨.
- RSS generation
- Sitemap.xml generation
- dynamic open graph image generation
- Hide unwanted elements through [config](./src/config.ts)

## Getting Started

Expand Down
29 changes: 16 additions & 13 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import sitemap from '@astrojs/sitemap';
import icon from 'astro-icon';
import compress from '@playform/compress';
import pagefind from 'astro-pagefind';
import emoji from 'remark-emoji';
import remarkMath from 'remark-math';
import tailwind from '@astrojs/tailwind';
import toc from '@jsdevtools/rehype-toc';
import rehypeKatax from 'rehype-katex';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
import rehypeExternalLinks from 'rehype-external-links';
import compress from '@playform/compress';
import {
transformerMetaHighlight,
transformerMetaWordHighlight,
Expand All @@ -20,12 +12,22 @@ import {
transformerNotationHighlight,
transformerNotationWordHighlight,
} from '@shikijs/transformers';
import icon from 'astro-icon';
import pagefind from 'astro-pagefind';
import { defineConfig } from 'astro/config';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
import rehypeExternalLinks from 'rehype-external-links';
import rehypeKatax from 'rehype-katex';
import emoji from 'remark-emoji';
import remarkMath from 'remark-math';
import { Site } from './src/config';
import { getMarkdownEntries } from './src/utils/post';
import { remarkPostTime, remarkReadingTime } from './src/utils/remark';
import { transformerEnhanser } from './src/utils/shiki';
import { remarkReadingTime, remarkPostTime } from './src/utils/remark';

const excludeSitemapFiles = (await getMarkdownEntries()).filter((entry) => entry.file.data.hidden);
const excludeSitemapFiles = (await getMarkdownEntries()).filter(
(entry) => entry.file.data.hidden,
);

// https://astro.build/config
export default defineConfig({
Expand All @@ -42,7 +44,8 @@ export default defineConfig({
}),
pagefind(),
sitemap({
filter: (page) => !excludeSitemapFiles.some((entry) => entry.url.href === page),
filter: (page) =>
!excludeSitemapFiles.some((entry) => entry.url.href === page),
}),
compress({
CSS: {
Expand Down
20 changes: 20 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": [".wrangler", ".astro", "dist"]
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
Binary file modified bun.lockb
Binary file not shown.
64 changes: 0 additions & 64 deletions eslint.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion giscus.example.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"origins": ["https://astro-blog-zozo.pages.dev"]
"origins": ["https://astro-blog-zozo.pages.dev"]
}
158 changes: 71 additions & 87 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,73 @@
{
"name": "astro-blog-zozo",
"version": "0.0.2",
"author": {
"name": "Ladit",
"email": "i@ladit.me",
"url": "https://github.com/ladit"
},
"homepage": "https://github.com/ladit/astro-blog-zozo",
"repository": {
"type": "git",
"url": "git+https://github.com/ladit/astro-blog-zozo.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ladit/astro-blog-zozo/issues"
},
"type": "module",
"engines": {
"bun": ">=1.0.30"
},
"scripts": {
"dev": "astro dev",
"check": "astro check",
"build": "astro check && eslint . && astro build",
"preview": "astro preview",
"preview:wrangler": "wrangler pages dev ./dist",
"astro": "astro",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"dependencies": {
"@astrojs/markdown-remark": "^4.2.1",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@iconify-json/ri": "^1.1.20",
"@jsdevtools/rehype-toc": "^3.0.2",
"@nanostores/persistent": "^0.10.1",
"@playform/compress": "^0.0.3",
"@shikijs/transformers": "^1.1.7",
"@tailwindcss/typography": "^0.5.10",
"astro": "^4.0.0",
"astro-icon": "^1.1.0",
"astro-pagefind": "^1.4.0",
"katex": "^0.16.9",
"lxgw-wenkai-screen-web": "^1.321.0",
"mdast-util-to-string": "^4.0.0",
"node-gyp": "^10.0.1",
"react": "^18.2.0",
"reading-time": "^1.5.0",
"rehype-accessible-emojis": "^0.3.2",
"rehype-external-links": "^3.0.0",
"rehype-katex": "^7.0.0",
"remark-emoji": "^4.0.1",
"remark-math": "^6.0.0",
"satori": "^0.10.13",
"sharp": "^0.33.3",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.1"
},
"devDependencies": {
"@astrojs/check": "^0.5.5",
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^8.57.0",
"@types/bun": "^1.0.7",
"@types/react": "^18.2.66",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"astro-eslint-parser": "^0.16.3",
"eslint": "^8.57.0",
"eslint-config-flat-gitignore": "^0.1.3",
"eslint-config-prettier": "^9.1.0",
"eslint-define-config": "^2.1.0",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-tailwindcss": "^3.15.1",
"globals": "^14.0.0",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"typescript": "^5.3.3",
"typescript-eslint": "^7.1.1"
},
"overrides": {
"sharp": "^0.33.3"
}
"name": "astro-blog-zozo",
"version": "0.0.3",
"author": {
"name": "Ladit",
"email": "i@ladit.me",
"url": "https://github.com/ladit"
},
"homepage": "https://github.com/ladit/astro-blog-zozo",
"repository": {
"type": "git",
"url": "git+https://github.com/ladit/astro-blog-zozo.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ladit/astro-blog-zozo/issues"
},
"type": "module",
"engines": {
"bun": ">=1.0.30"
},
"scripts": {
"dev": "astro dev",
"check": "astro check",
"build": "astro check && bunx @biomejs/biome check --apply . && astro build",
"preview": "astro preview",
"preview:wrangler": "wrangler pages dev ./dist",
"astro": "astro",
"lint": "bunx @biomejs/biome check --apply ."
},
"dependencies": {
"@astrojs/markdown-remark": "^4.2.1",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@astrojs/tailwind": "^5.1.0",
"@iconify-json/ri": "^1.1.20",
"@jsdevtools/rehype-toc": "^3.0.2",
"@nanostores/persistent": "^0.10.1",
"@playform/compress": "^0.0.3",
"@shikijs/transformers": "^1.1.7",
"@tailwindcss/typography": "^0.5.10",
"astro": "^4.0.0",
"astro-icon": "^1.1.0",
"astro-pagefind": "^1.4.0",
"katex": "^0.16.9",
"lxgw-wenkai-screen-web": "^1.321.0",
"mdast-util-to-string": "^4.0.0",
"node-gyp": "^10.0.1",
"react": "^18.2.0",
"reading-time": "^1.5.0",
"rehype-accessible-emojis": "^0.3.2",
"rehype-external-links": "^3.0.0",
"rehype-katex": "^7.0.0",
"remark-emoji": "^4.0.1",
"remark-math": "^6.0.0",
"satori": "^0.10.13",
"sharp": "^0.33.3",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.1"
},
"devDependencies": {
"@astrojs/check": "^0.5.5",
"@biomejs/biome": "1.7.3",
"@types/bun": "^1.0.7",
"@types/react": "^18.2.66",
"globals": "^14.0.0",
"typescript": "^5.3.3"
},
"overrides": {
"sharp": "^0.33.3"
},
"trustedDependencies": ["@biomejs/biome"]
}
4 changes: 2 additions & 2 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
import fs from 'node:fs/promises';
import { Icon } from 'astro-icon/components';
import { Hide, SiteDescription, SiteTitle, Socials } from '~/config';
import Nav from './Nav.astro';
import ThemeToggler from './ThemeToggler.astro';
import { SiteTitle, SiteDescription, Socials, Hide } from '~/config';
interface Props {
currentNav?: string;
Expand Down Expand Up @@ -65,7 +65,7 @@ const socialConfig: Record<string, Record<string, string>> = {
zhihu: { icon: 'ri:zhihu-fill' },
};
let socials: Record<string, string>[] = [];
const socials: Record<string, string>[] = [];
for (const platform in Socials) {
if (Socials[platform].url && socialConfig[platform]) {
socials.push({ platform, ...Socials[platform], ...socialConfig[platform] });
Expand Down
Loading

0 comments on commit fd19131

Please sign in to comment.