ตัวจัดรูปแบบและโค้ด
JavaScript / TypeScript Formatter
ตัวจัดรูปแบบ JavaScript และ TypeScript ฟรี กฎเริ่มต้นของ Prettier ที่ทำงานทั้งหมดในเบราว์เซอร์ — ตรวจจับ TypeScript โดยอัตโนมัติจากคำอธิบายประเภท วาง, คลิก, คัดลอก
หมายเหตุจากบรรณาธิการ
Understanding · JS, set to a house style.
บทเชิงลึกนี้มีให้บริการเฉพาะภาษาอังกฤษในขณะนี้ เครื่องมือแปลงด้านบนทำงานในภาษาของคุณ บทความอธิบายแบบยาวยังไม่ได้แปล
คำถามที่พบบ่อย
Quick answers.
›Does it handle TypeScript?
Yes — the tool auto-detects TypeScript from type annotations (`: string`, `interface Foo`, `type X = ...`) and routes to Prettier's TS parser. You don't have to toggle anything.
›Which Prettier options does it use?
Prettier's out-of-box defaults: 2-space indent, semicolons, double quotes, 80-column print width, trailing commas. These match the vast majority of published codebases.
›Will it change my code's behaviour?
No — Prettier only reformats; it never changes semantics. The output runs identically to the input, byte-for-byte after transpilation.
›Can it minify JavaScript?
No — Prettier is a formatter, not a minifier. For production minification use Terser, esbuild or SWC locally. They produce far smaller output than a whitespace collapser would.
ผู้คนยังค้นหา
เครื่องมือที่เกี่ยวข้อง
More in this room.
- JSON Formatter & Validatorจัดรูปแบบ, ย่อขนาดและตรวจสอบ JSON — ฟรี, ไม่ต้องลงทะเบียน
- SQL Formatterจัดรูปแบบและจัดย่อหน้าคำสั่ง SQL ที่ไม่สวยงาม
- XML Formatter & Validatorจัดรูปแบบ, ย่อขนาดและตรวจสอบ XML — ทันที
- HTML Formatterจัดรูปแบบและย่อขนาด HTML — ค่าเริ่มต้นของ Prettier
- CSS Formatterจัดรูปแบบและย่อขนาดสไตล์ชีท CSS
- ตัวจัดรูปแบบ YAMLปรับการเยื้องและโครงสร้าง YAML ให้เป็นมาตรฐาน