Add Biome (#668)

This commit is contained in:
Glenn Jocher
2025-11-29 00:36:18 +01:00
committed by GitHub
parent d321e2edff
commit 7f1643b055
2 changed files with 19 additions and 0 deletions
+2
View File
@@ -31,6 +31,7 @@ AI-powered formatting, labeling, and PR summaries for Python, Swift, and Markdow
- **Python Code:** Formatted using [Ruff](https://github.com/astral-sh/ruff), an extremely fast Python linter and formatter
- **Python Docstrings:** Google-style formatting enforced with Ultralytics Python docstring formatter (optional)
- **JavaScript/TypeScript:** Formatted with [Biome](https://biomejs.dev/), an extremely fast formatter for JS, TS, JSX, TSX, and JSON (optional, auto-detected via `biome.json`)
- **Markdown Files:** Styled with [Prettier](https://github.com/prettier/prettier) to ensure consistent documentation appearance
- **Swift Code:** Formatted with [`swift-format`](https://github.com/swiftlang/swift-format) _(requires `macos-latest` runner)_
- **Spell Check:** Common misspellings caught using [codespell](https://github.com/codespell-project/codespell)
@@ -82,6 +83,7 @@ jobs:
labels: true # Auto-label issues/PRs using AI
python: true # Format Python with Ruff
python_docstrings: false # Format Python docstrings (default: false)
biome: true # Format JS/TS with Biome (auto-detected via biome.json)
prettier: true # Format YAML, JSON, Markdown, CSS
swift: false # Format Swift (requires macos-latest)
dart: false # Format Dart/Flutter
+17
View File
@@ -26,6 +26,10 @@ inputs:
description: "Run Markdown formatting (deprecated in favor of prettier)"
required: false
default: "false"
biome:
description: "Run Biome formatting"
required: false
default: "false"
prettier:
description: "Run Prettier formatting for JavaScript, JSX, Angular, Vue, Flow, TypeScript, CSS, HTML, JSON, GraphQL, Markdown, YAML"
required: false
@@ -171,6 +175,19 @@ runs:
shell: bash
continue-on-error: true
# Biome (JavaScript, TypeScript, JSON, JSX, TSX) ------------------------------------------------------------------
- name: Run Biome
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && inputs.biome == 'true' && (github.event.action == 'opened' || github.event.action == 'synchronize')
run: |
if [ -f "biome.json" ] || [ -f "biome.jsonc" ]; then
npm install --global @biomejs/biome@latest
npx biome check --write --unsafe --line-width 120 .
else
echo "⚠️ No biome.json or biome.jsonc found, skipping Biome formatting"
fi
shell: bash
continue-on-error: true
# Prettier (JavaScript, JSX, Angular, Vue, Flow, TypeScript, CSS, HTML, JSON, GraphQL, Markdown, YAML) -------------
- name: Run Prettier
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && (inputs.prettier == 'true' || inputs.markdown == 'true') && (github.event.action == 'opened' || github.event.action == 'synchronize')