Skip to content

chore: add Biome pre-commit hook#230

Open
santoslgl01-web wants to merge 3 commits into
john-bampton:mainfrom
santoslgl01-web:fix/issue-120-biome-precommit
Open

chore: add Biome pre-commit hook#230
santoslgl01-web wants to merge 3 commits into
john-bampton:mainfrom
santoslgl01-web:fix/issue-120-biome-precommit

Conversation

@santoslgl01-web
Copy link
Copy Markdown
Contributor

Summary

  • Add a Biome configuration for consistent JavaScript, JSON, and CSS formatting/linting.
  • Wire Biome into the existing pre-commit setup with a local Node hook.
  • Exclude generated users.json and image assets from Biome checks.

Fixes #120

Testing

  • Parsed .pre-commit-config.yaml and biome.json successfully.
  • Ran: npx --yes @biomejs/biome@2.3.8 check biome.json

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Biome for linting and formatting by adding a new pre-commit hook and a corresponding biome.json configuration file. The review feedback suggests expanding the file extensions targeted by the pre-commit hook to include formats like .mjs and .jsonc. Additionally, several corrections were identified in the Biome configuration, including fixing the "include" property name, utilizing the "ignore" field for exclusions, and reconsidering the disabling of recommended correctness rules to maintain higher code quality.

Comment thread .pre-commit-config.yaml Outdated
Comment thread biome.json
Comment thread biome.json
@deepsource-io
Copy link
Copy Markdown
Contributor

deepsource-io Bot commented Apr 26, 2026

DeepSource Code Review

We reviewed changes in 7b01e03...b874097 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Apr 29, 2026 3:11a.m. Review ↗
Python Apr 29, 2026 3:11a.m. Review ↗
JavaScript Apr 29, 2026 3:11a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Copy link
Copy Markdown
Member

@jbampton jbampton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/biomejs/pre-commit#using-biomes-pre-commit-hooks

Biome is not installed so we don't want a local hook.

Please use the standard biome hook. Thanks

@jbampton jbampton self-assigned this Apr 27, 2026
@jbampton jbampton added this to Turbo Apr 27, 2026
@jbampton jbampton moved this to In Progress in Turbo Apr 27, 2026
@jbampton jbampton added the tests label Apr 27, 2026
@santoslgl01-web
Copy link
Copy Markdown
Contributor Author

Updated to use the standard Biome pre-commit hook from biomejs/pre-commit as requested, and expanded the file pattern to cover common Biome-supported extensions. I also re-validated the updated pre-commit config locally with pre-commit. One unrelated local environment limitation remains: the repo currently pins the isort pre-commit hook to a version that requires Python >=3.10, while this machine has Python 3.9, so a full pre-commit run could not complete here. Please take another look when you have a chance — happy to make any further adjustments.

@jbampton
Copy link
Copy Markdown
Member

You can install a newer version of Python.

@santoslgl01-web what OS are you using ?

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Biome to the repository to standardize formatting/linting for frontend assets and integrates it into the existing pre-commit workflow (Issue #120).

Changes:

  • Introduce a biome.json configuration (formatting, lint rules, import organization).
  • Add a Biome pre-commit hook to run checks/fixes on JS/TS/JSON/CSS-family files.
  • Exclude docs/users.json from the Biome hook (and attempt to exclude some paths in Biome config).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
biome.json Adds Biome configuration for formatting/linting and file targeting.
.pre-commit-config.yaml Registers the Biome hook in the pre-commit pipeline with file filters and excludes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread biome.json
{
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"files": {
"includes": ["**", "!docs/images", "!.git"]
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/users.json is excluded only in the pre-commit hook, but not in Biome’s own file include/exclude rules. That means running Biome directly (e.g. biome check --write .) could still reformat this generated file, which contradicts the PR summary and the existing .prettierignore behavior. Consider excluding docs/users.json in biome.json as well so manual/local Biome runs and CI behave consistently with pre-commit.

Suggested change
"includes": ["**", "!docs/images", "!.git"]
"includes": ["**", "!docs/images", "!docs/users.json", "!.git"]

Copilot uses AI. Check for mistakes.
Comment thread .pre-commit-config.yaml
Comment on lines +24 to +26
- repo: https://github.com/biomejs/pre-commit
rev: v2.3.8
hooks:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says Biome is wired into pre-commit via a “local Node hook”, but the change uses the upstream biomejs/pre-commit repo hook instead. Please either update the PR description to match the actual implementation or switch to a local hook if that’s a requirement (e.g., to avoid depending on the remote hook repository).

Copilot uses AI. Check for mistakes.
@santoslgl01-web
Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’m working on updating this from a newer Python environment so I can rerun the repo’s expected tooling cleanly. For reference, I’m on macOS (Darwin arm64). I’ll push a follow-up once the requested changes are addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Add Biome format and lint with pre-commit. Standardize the indentation

3 participants