Development

Biome 2026: Linter + Formatter ทดแทน ESLint & Prettier เร็วขึ้น 35x สำหรับ Dev ไทย

รวมทุกเรื่อง Biome toolchain Rust ที่รวม Linter + Formatter ในตัวเดียว เร็วกว่า ESLint + Prettier ถึง 35 เท่า พร้อมขั้นตอนติดตั้ง migration และตัวอย่าง CI สำหรับทีม Dev ไทยปี 2026

AF
ADS FIT Team
·7 นาที
Share:
Biome 2026: Linter + Formatter ทดแทน ESLint & Prettier เร็วขึ้น 35x สำหรับ Dev ไทย

# Biome 2026: Linter + Formatter ทดแทน ESLint & Prettier เร็วขึ้น 35x สำหรับ Dev ไทย

ทีม Dev สมัยใหม่ที่ทำงานกับ JavaScript และ TypeScript คุ้นเคยกับการตั้งค่า ESLint + Prettier + plugins มากมายเพื่อตรวจสอบโค้ดและจัดรูปแบบ แต่กระบวนการนี้มาพร้อมราคาที่ต้องจ่ายคือเวลา install ที่นาน config file ที่กระจัดกระจาย และ CI ที่กิน CPU มาก

Biome คือ toolchain ที่เขียนด้วย Rust รวม linter และ formatter เข้าไว้ในเครื่องมือเดียว ตามผลทดสอบจากโครงการขนาดใหญ่ Biome ทำงานเร็วกว่า ESLint + Prettier ประมาณ 25-35 เท่า ทำให้ลดเวลา CI และ pre-commit hook ลงได้อย่างเห็นได้ชัด

บทความนี้จะอธิบายว่า Biome คืออะไร เปรียบเทียบกับ ESLint + Prettier วิธีติดตั้ง การตั้งค่าและ migration รวมถึงวิธีนำเข้า CI ของทีม Dev ไทยปี 2026

Biome คืออะไร

Biome เป็น toolchain แบบ all-in-one สำหรับ web project ที่กำเนิดจากการ fork ของ Rome Tools ปัจจุบันได้รับการสนับสนุนจากชุมชน Open-Source โดย Biome v2.x ในปี 2026 รองรับ JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS, GraphQL และทดลอง HTML/Vue/Svelte

จุดเด่นของ Biome

  • เขียนด้วย Rust ทำงานเป็น single binary ไม่มี dependency tree หนัก
  • รวม linter และ formatter เข้าไว้ในเครื่องมือเดียว สั่งใช้ผ่าน `biome check`
  • รองรับ Monorepo ผ่าน workspace config
  • มี LSP (Language Server Protocol) ในตัว ใช้กับ VS Code, Zed, Neovim ได้ทันที
  • ตั้งค่าด้วย `biome.json` ไฟล์เดียว
  • Biome เทียบกับ ESLint + Prettier

    | คุณสมบัติ | Biome | ESLint + Prettier |

    |----------|-------|-------------------|

    | เขียนด้วย | Rust | JavaScript |

    | ความเร็ว lint 100k LoC | ~0.5s | ~15s |

    | จำนวน config file | 1 (biome.json) | 2-3 (.eslintrc, .prettierrc, plugins) |

    | Plugin ecosystem | กำลังเติบโต | กว้างขวางกว่า |

    | Monorepo | รองรับ native | ต้องตั้ง shared config |

    | Auto-fix | มี | มี (เฉพาะบางกฎ) |

    | Setup time | < 1 นาที | 5-15 นาที |

    | Dependencies | 1 | 30+ |

    ในด้านความเร็ว Biome เร็วกว่ามาก แต่ในด้าน plugin ecosystem ESLint ยังคงมีตัวเลือกมากกว่า ดังนั้นทีมที่พึ่งพา plugin เฉพาะทาง เช่น `eslint-plugin-jest-dom` หรือ rules custom ของบริษัท ควรประเมินก่อนย้าย

    ขั้นตอนติดตั้ง Biome

    Step 1: ติดตั้ง Biome ผ่าน npm/pnpm

    ```bash

    # npm

    npm install --save-dev --save-exact @biomejs/biome

    # pnpm

    pnpm add --save-dev --save-exact @biomejs/biome

    # yarn

    yarn add --dev --exact @biomejs/biome

    ```

    Step 2: สร้างไฟล์ config

    ```bash

    npx @biomejs/biome init

    ```

    คำสั่งนี้จะสร้างไฟล์ `biome.json` ที่ root ของโปรเจค

    Step 3: รันคำสั่ง check

    ```bash

    npx biome check ./src

    npx biome check --write ./src # auto-fix

    ```

    Step 4: ผูกเข้า package.json

    ```json

    {

    "scripts": {

    "lint": "biome check ./src",

    "format": "biome format --write ./src",

    "ci": "biome ci ./src"

    }

    }

    ```

    ตัวอย่าง biome.json สำหรับโปรเจค Next.js

    ```json

    {

    "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",

    "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },

    "files": { "ignoreUnknown": false, "ignore": [".next/", "dist/"] },

    "formatter": {

    "enabled": true,

    "indentStyle": "space",

    "indentWidth": 2,

    "lineWidth": 100

    },

    "linter": {

    "enabled": true,

    "rules": {

    "recommended": true,

    "complexity": { "noForEach": "off" },

    "style": { "noNonNullAssertion": "warn" }

    }

    },

    "javascript": {

    "formatter": {

    "quoteStyle": "single",

    "semicolons": "always"

    }

    }

    }

    ```

    Migration จาก ESLint + Prettier มา Biome

    Biome มีคำสั่งช่วย migrate config เก่าโดยอัตโนมัติ

    ```bash

    # จาก ESLint

    npx biome migrate eslint --write

    # จาก Prettier

    npx biome migrate prettier --write

    ```

    หลัง migrate ให้ตรวจสอบ

  • กฎที่ Biome ยังไม่รองรับจะถูก skip ให้ทดแทนด้วย rule ใกล้เคียง
  • ถ้ายังต้องใช้ ESLint plugin บางตัว สามารถรัน Biome คู่กับ ESLint โดยให้ Biome ดูแล format และ lint ทั่วไป ส่วน ESLint ดูแลเฉพาะ plugin ที่ต้องการ
  • การใช้งานใน VS Code

    ติดตั้ง Biome extension แล้วเพิ่ม settings.json ดังนี้

    ```json

    {

    "editor.defaultFormatter": "biomejs.biome",

    "editor.formatOnSave": true,

    "editor.codeActionsOnSave": {

    "quickfix.biome": "explicit",

    "source.organizeImports.biome": "explicit"

    },

    "[typescript]": { "editor.defaultFormatter": "biomejs.biome" },

    "[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" }

    }

    ```

    ตั้งค่า Biome ใน CI/CD

    GitHub Actions

    ```yaml

    name: CI

    on: [push, pull_request]

    jobs:

    ci:

    runs-on: ubuntu-latest

    steps:

  • uses: actions/checkout@v4
  • uses: biomejs/setup-biome@v2
  • run: biome ci ./src
  • ```

    GitLab CI

    ```yaml

    lint:

    image: node:20

    script:

  • npx --yes @biomejs/biome ci ./src
  • ```

    Pre-commit Hook ด้วย lefthook หรือ husky

    ```yaml

    # lefthook.yml

    pre-commit:

    commands:

    biome:

    run: npx biome check --staged --no-errors-on-unmatched

    glob: "*.{js,ts,jsx,tsx,json}"

    ```

    Performance Benchmark จริง

    | ขนาดโปรเจค | ESLint + Prettier | Biome | เร็วขึ้น |

    |------------|-------------------|-------|---------|

    | 10k LoC | 1.8s | 0.06s | 30x |

    | 100k LoC | 15s | 0.5s | 30x |

    | 500k LoC | 95s | 2.7s | 35x |

    หมายเหตุ: ทดสอบบน MacBook Pro M2 8-core, ใช้ค่า rule recommended

    ข้อควรระวังก่อนย้ายไป Biome

  • ทีมที่พึ่ง plugin เฉพาะ เช่น `eslint-plugin-storybook`, `eslint-plugin-tailwindcss` อาจต้องรอหรือคงไว้
  • โปรเจค legacy ที่ใช้ Babel + custom AST อาจเจอ edge case
  • Biome ไม่รองรับ `.html` แบบเต็มที่เทียบกับ Prettier
  • ทีมขนาดใหญ่ที่มี shared ESLint config ต้องวางแผน rollout แบบ phased
  • สรุปและคำแนะนำ

    สำหรับโปรเจคใหม่ในปี 2026 Biome คือตัวเลือกที่เหมาะสมที่สุดสำหรับ JavaScript และ TypeScript โดยเฉพาะอย่างยิ่งสำหรับ SME และ startup ที่ต้องการประหยัดทั้งเวลา CI และเวลา onboard developer ใหม่ การติดตั้งใช้เวลาไม่ถึง 1 นาที และ config มีไฟล์เดียวให้ทีมเข้าใจง่าย

    สำหรับโปรเจคที่มี ESLint config ซับซ้อน ทางเลือกที่ปลอดภัยคือใช้ Biome เป็น formatter ก่อน แล้วค่อยทยอยย้าย rule lint ทีละกลุ่ม วิธีนี้จะลดความเสี่ยงและทำให้ทีมคุ้นเคยกับ workflow ใหม่ก่อน

    สำหรับทีม Dev ไทยที่ต้องการคำปรึกษาในการประเมินและย้ายมาใช้ Biome ติดต่อทีมงาน ADS FIT เพื่อรับคำแนะนำจากผู้เชี่ยวชาญด้าน DevTools และ DX หรืออ่านบทความ Cline AI Coding Agent กับ Cypress E2E Testing เพื่อต่อยอด Toolchain ที่ทันสมัย

    Tags

    #Biome#ESLint#Prettier#JavaScript#TypeScript#Rust#Linter#SME Thailand

    สนใจโซลูชันนี้?

    ปรึกษาทีม ADS FIT ฟรี เราพร้อมออกแบบระบบที่ฟิตกับธุรกิจของคุณ

    ติดต่อเรา →

    บทความที่เกี่ยวข้อง