From 34805f927944862d8c492c8c8158b548806c1791 Mon Sep 17 00:00:00 2001 From: HPCesia Date: Thu, 23 Jan 2025 13:34:59 +0800 Subject: [PATCH] style: prettier format --- .prettierrc.cjs | 10 +++++++- .stylelintignore | 4 ++++ astro.config.mjs | 3 +-- eslint.config.js | 4 ++-- package.json | 8 ++++++- postcss.config.mjs | 2 +- src/components/AsideContent.astro | 7 ------ src/components/CategoryBar.astro | 2 +- src/components/Navbar.astro | 14 +++++------ src/components/PageFooter.astro | 4 ++-- src/components/PostPage.astro | 4 ++-- src/components/SideToolBar.astro | 4 ++-- src/components/Sidebar.astro | 8 +++---- src/components/TimeArchives.astro | 6 ++--- src/components/widgets/Button.astro | 2 +- src/components/widgets/DarkModeButton.astro | 8 +++---- src/components/widgets/MetaIcon.astro | 2 +- src/components/widgets/Pagination.astro | 14 +++++------ src/components/widgets/PostCard.astro | 24 +++++++++++++------ src/components/widgets/PostCardCover.astro | 12 +++++----- src/components/widgets/ProfileCard.astro | 10 ++++---- src/components/widgets/ReadMoreButton.astro | 12 +++++----- src/components/widgets/SiteInfoCard.astro | 0 src/components/widgets/TOC.astro | 2 +- src/config.ts | 3 +-- src/content.config.ts | 2 +- src/i18n/translation.ts | 9 ++++--- src/layouts/GridLayout.astro | 4 ++-- src/layouts/MainLayout.astro | 6 ++--- src/pages/[...page].astro | 4 ++-- src/pages/about.astro | 3 +-- .../categories/[category]/[page].astro | 8 +++---- src/pages/archives/tags/[tag]/[page].astro | 6 ++--- src/pages/posts/[article].astro | 8 +++---- src/styles/article.scss | 2 +- src/utils/content-utils.ts | 4 ++-- src/utils/url-utils.ts | 8 +++++++ 37 files changed, 127 insertions(+), 106 deletions(-) create mode 100644 .stylelintignore delete mode 100644 src/components/AsideContent.astro create mode 100644 src/components/widgets/SiteInfoCard.astro diff --git a/.prettierrc.cjs b/.prettierrc.cjs index e1a3a80..d07e797 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -7,7 +7,15 @@ module.exports = { trailingComma: 'es5', useTabs: false, - plugins: ['prettier-plugin-astro'], + importOrderSeparation: false, + importOrderSortSpecifiers: true, + + plugins: [ + 'prettier-plugin-astro', + 'prettier-plugin-tailwindcss', + '@trivago/prettier-plugin-sort-imports', + 'prettier-plugin-astro-organize-imports', + ], overrides: [{ files: '*.astro', options: { parser: 'astro' } }], }; diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..76b517c --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,4 @@ +dist +node_modules +.github +.changeset \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs index fd4b991..afa2db5 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,8 +1,7 @@ // @ts-check -import { defineConfig } from 'astro/config'; - import tailwind from '@astrojs/tailwind'; import icon from 'astro-icon'; +import { defineConfig } from 'astro/config'; // https://astro.build/config export default defineConfig({ diff --git a/eslint.config.js b/eslint.config.js index 44e601d..9aa97dc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,9 @@ +import js from '@eslint/js'; +import typescriptParser from '@typescript-eslint/parser'; import astroEslintParser from 'astro-eslint-parser'; import eslintPluginAstro from 'eslint-plugin-astro'; import globals from 'globals'; -import js from '@eslint/js'; import tseslint from 'typescript-eslint'; -import typescriptParser from '@typescript-eslint/parser'; export default [ js.configs.recommended, diff --git a/package.json b/package.json index d6a9a8d..5431f19 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dev": "astro dev", "build": "astro check && astro build", "preview": "astro preview", - "astro": "astro" + "astro": "astro", + "lint": "prettier -w . && eslint . --fix && stylelint \"**/*.{css,scss}\" --fix && tsc --noEmit && astro check" }, "dependencies": { "@astrojs/tailwind": "^5.1.4", @@ -24,6 +25,9 @@ "devDependencies": { "@astrojs/check": "^0.9.4", "@astrojs/ts-plugin": "^1.10.4", + "@eslint/js": "^9.18.0", + "@trivago/prettier-plugin-sort-imports": "^5.2.1", + "@typescript-eslint/parser": "^8.21.0", "astro-eslint-parser": "^1.1.0", "eslint": "^9.18.0", "eslint-plugin-astro": "^1.3.1", @@ -31,6 +35,8 @@ "postcss-html": "^1.8.0", "prettier": "^3.4.2", "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-astro-organize-imports": "^0.4.11", + "prettier-plugin-tailwindcss": "^0.6.10", "stylelint": "^16.13.2", "stylelint-config-html": "^1.1.0", "stylelint-config-standard-scss": "^14.0.0", diff --git a/postcss.config.mjs b/postcss.config.mjs index 025cf05..e6b3a3c 100644 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -1,6 +1,6 @@ import postcssImport from 'postcss-import'; -import postcssNesting from 'tailwindcss/nesting/index.js'; import tailwindcss from 'tailwindcss'; +import postcssNesting from 'tailwindcss/nesting/index.js'; /** @type {import('postcss-load-config').Config} */ export default { diff --git a/src/components/AsideContent.astro b/src/components/AsideContent.astro deleted file mode 100644 index 88203ba..0000000 --- a/src/components/AsideContent.astro +++ /dev/null @@ -1,7 +0,0 @@ ---- - ---- - -
- {} -
diff --git a/src/components/CategoryBar.astro b/src/components/CategoryBar.astro index 3676fa2..db26b93 100644 --- a/src/components/CategoryBar.astro +++ b/src/components/CategoryBar.astro @@ -12,7 +12,7 @@ const { categories, currentCategory } = Astro.props;
{i18n(I18nKey.recentPosts)} diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index ecf02d3..1d82b24 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,10 +1,8 @@ --- import { navbarConfig } from '@/config'; - -import { Icon } from 'astro-icon/components'; - -import Button from './widgets/Button.astro'; import { i18n } from '@i18n/translation'; +import { Icon } from 'astro-icon/components'; +import Button from './widgets/Button.astro'; interface Props { title?: string; @@ -17,14 +15,14 @@ if (!title) title = 'Astral Halo';