formatter-development

Implement Biome formatting rules using its IR-based formatter infrastructure.

25.5k|1.2k|Updated Jul 27, 2023
One-click install
npx skills add https://github.com/biomejs/biome --skill formatter-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formatter-development
Source: https://github.com/biomejs/biome/tree/main/.claude/skills/formatter-development
Command: npx skills add https://github.com/biomejs/biome --skill formatter-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide for developers contributing to Biome's formatting capabilities, enabling them to implement new formatting rules and ensure code consistency.

Core Features & Use Cases

  • IR-based Formatter Infrastructure: Understand and utilize Biome's Intermediate Representation (IR) for defining formatting logic.
  • Comment Handling: Learn strategies for correctly managing comments within the formatted output.
  • Prettier Comparison: Integrate Prettier for robust validation of Biome's formatting output across various languages.
  • Use Case: A developer needs to add support for formatting a new JavaScript syntax feature in Biome. They would use this skill to understand how to define the FormatNodeRule, generate boilerplate, and test their implementation against Prettier.

Quick Start

Use the formatter-development skill to generate boilerplate for a new HTML formatter rule.

Frequently Asked Questions about formatter-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a new formatting rule in Biome?

You implement Biome formatting rules by defining a `FormatNodeRule` using its IR-based formatter infrastructure. This requires Rust knowledge and utilizing Biome's internal crates to define syntax node formatting and manage comments.

What is Biome's IR-based formatter infrastructure?

Biome's IR-based formatter infrastructure is an Intermediate Representation system used to define formatting logic. It allows developers to structure syntax node formatting and manage comment placement within the generated output.

Do I need to know Rust to contribute to Biome's formatter?

Yes, you need Rust knowledge to contribute to Biome's formatter. The development process requires understanding Biome's internal crates and using build tools like `just` and `pnpm` to compile and test the formatting rules.

How does Biome validate formatting output against Prettier?

Biome integrates Prettier for robust validation of its formatting output across JavaScript, CSS, JSON, and HTML. This comparison ensures Biome's formatting rules produce consistent results matching Prettier's established standards.

How do I handle comments when implementing Biome code formatting?

Handling comments in Biome code formatting involves learning specific strategies within the IR-based infrastructure to correctly manage comment placement. This ensures comments are preserved and positioned properly within the formatted output.