From 4c4c97b780e37ca89789c5bf0f4d993826d6736e Mon Sep 17 00:00:00 2001 From: fiatcode Date: Thu, 22 Jan 2026 17:23:05 +0700 Subject: [PATCH] chore: add Prettier configuration and plugins for code formatting --- .prettierrc | 11 +++++++++++ package-lock.json | 21 ++++++++++++++++++++- package.json | 3 ++- src/components/Welcome.astro | 30 +++++++++++++++++++++++++----- src/pages/index.astro | 5 +---- src/pages/posts/[id].astro | 9 +++++++-- 6 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0dff9e8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "plugins": ["prettier-plugin-astro", "prettier-plugin-organize-imports"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 91e5313..75abf78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,8 @@ "devDependencies": { "@tailwindcss/typography": "^0.5.19", "prettier": "^3.8.1", - "prettier-plugin-astro": "^0.14.1" + "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-organize-imports": "^4.3.0" } }, "node_modules/@astrojs/compiler": { @@ -4446,6 +4447,7 @@ "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -4471,6 +4473,23 @@ "node": "^14.15.0 || >=16.0.0" } }, + "node_modules/prettier-plugin-organize-imports": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.3.0.tgz", + "integrity": "sha512-FxFz0qFhyBsGdIsb697f/EkvHzi5SZOhWAjxcx2dLt+Q532bAlhswcXGYB1yzjZ69kW8UoadFBw7TyNwlq96Iw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "prettier": ">=2.0", + "typescript": ">=2.9", + "vue-tsc": "^2.1.0 || 3" + }, + "peerDependenciesMeta": { + "vue-tsc": { + "optional": true + } + } + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", diff --git a/package.json b/package.json index dfd6a97..9fe4bdd 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "devDependencies": { "@tailwindcss/typography": "^0.5.19", "prettier": "^3.8.1", - "prettier-plugin-astro": "^0.14.1" + "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-organize-imports": "^4.3.0" } } diff --git a/src/components/Welcome.astro b/src/components/Welcome.astro index c3fb7ba..11a7166 100644 --- a/src/components/Welcome.astro +++ b/src/components/Welcome.astro @@ -1,5 +1,5 @@ --- -import { Image } from 'astro:assets'; +import { Image } from "astro:assets"; import profileImage from "@/assets/images/profile.jpg"; import socialEmail from "@/assets/images/social-email.svg"; import socialFacebook from "@/assets/images/social-facebook.svg"; @@ -22,19 +22,39 @@ import socialX from "@/assets/images/social-x.svg"; href="https://www.linkedin.com/in/dhemas-nurjaya-030890bb" aria-label="Linkedin" > - LinkedIn + LinkedIn - Github + Github X - Facebook + Facebook - Email + Email
diff --git a/src/pages/index.astro b/src/pages/index.astro index 590fa94..9a34230 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,9 +6,6 @@ import Layout from "@/layouts/Layout.astro"; // Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh. --- - + diff --git a/src/pages/posts/[id].astro b/src/pages/posts/[id].astro index d624698..b7c08d8 100644 --- a/src/pages/posts/[id].astro +++ b/src/pages/posts/[id].astro @@ -1,5 +1,10 @@ --- -import { getCollection, render, type CollectionEntry, type RenderResult } from "astro:content"; +import { + getCollection, + render, + type CollectionEntry, + type RenderResult, +} from "astro:content"; import Layout from "@/layouts/Layout.astro"; import BlogPost from "@/components/BlogPost.astro"; @@ -13,7 +18,7 @@ export async function getStaticPaths() { params: { id }, props: { post, content }, }; - }) + }), ); return paths; }