Skip to content

dprint

เครื่องมือจัดรูปแบบโค้ดยุคใหม่ที่เร็วและปรับแต่งได้

Why dprint

dprint เป็นเครื่องมือจัดรูปแบบโค้ดที่เร็วและปรับแต่งได้

คุณสมบัติdprintPrettier
ความเร็ว⚡ เร็วมาก⏳ ช้ากว่า
การทำงาน✅ Standalone❌ ต้องใช้ Config
ภาษา supportedหลายภาษาJS/TS/CSS เท่านั้น
การปรับแต่ง✅ ผ่าน JSON✅ ผ่าน JSON

ประโยชน์หลัก:

  • ⚡ ความเร็วสูงจาก Rust
  • 🔌 ระบบปลั๊กอินสำหรับหลายภาษา
  • ⚙️ ปรับแต่งกฎได้ละเอียด

Get started

bash
npm install dprint --save-dev
bash
yarn add dprint --dev
bash
pnpm add dprint --save-dev

เพิ่มสคริปต์ใน package.json:

json
{
  "scripts": {
    "format": "dprint fmt"
  }
}

Config

  1. สร้างไฟล์กำหนดค่า:
bash
dprint init
  1. ตัวอย่าง dprint.json:
json
{
  "$schema": "https://dprint.dev/schemas/v0.json",
  "typescript": {
    "lineWidth": 80,
    "indentWidth": 2
  }
}

dprint.dev faviconเว็บไซต์หลัก | github.com faviconGitHub

Last updated: