Skip to content

Add Biome pre-commit hook#238

Open
subhajitlucky wants to merge 2 commits into
john-bampton:mainfrom
subhajitlucky:add-biome-pre-commit
Open

Add Biome pre-commit hook#238
subhajitlucky wants to merge 2 commits into
john-bampton:mainfrom
subhajitlucky:add-biome-pre-commit

Conversation

@subhajitlucky
Copy link
Copy Markdown

@subhajitlucky subhajitlucky commented May 13, 2026

Summary

  • add biome.json with shared formatting defaults for web assets
  • use the standard biomejs/pre-commit hook for CSS, JS, JSON, and related files
  • format the existing Biome-covered web assets so the hook can run cleanly
  • keep existing YAML Prettier/YAML lint hooks in place

Verification

  • npx --yes @biomejs/biome@2.3.8 check --write --files-ignore-unknown=true .
  • parsed .pre-commit-config.yaml with PyYAML
  • git diff --check
  • git diff --check HEAD~1..HEAD

Fixes #120

Copilot AI review requested due to automatic review settings May 13, 2026 05:05
@deepsource-io
Copy link
Copy Markdown
Contributor

deepsource-io Bot commented May 13, 2026

DeepSource Code Review

We reviewed changes in b594820...43e0211 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 May 13, 2026 5:42a.m. Review ↗
Python May 13, 2026 5:42a.m. Review ↗
JavaScript May 13, 2026 5:42a.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
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 integrates Biome into the project's pre-commit workflow and adds a biome.json configuration file for formatting and linting. Feedback was provided to correct the biome.json structure by using the ignore field instead of unsupported negative patterns in includes. Additionally, it was suggested to expand the file regex in the pre-commit configuration to cover a broader range of supported web assets like TypeScript and JSX.

Comment thread biome.json
Comment on lines +4 to +10
"includes": [
"**",
"!docs/bootstrap",
"!docs/featured.json",
"!docs/manifest.json",
"!docs/users.json"
]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Biome uses the singular include key instead of includes. Furthermore, Biome does not support negative patterns (starting with !) within the include array. To exclude specific files or directories, you should use the ignore field. Since include defaults to all files in the project, you can simply provide the ignore list to achieve the desired filtering.

    "ignore": [
      "docs/bootstrap",
      "docs/featured.json",
      "docs/manifest.json",
      "docs/users.json"
    ]

Comment thread .pre-commit-config.yaml Outdated
name: run biome
description: format and lint web assets with Biome
entry: biome check --write --files-ignore-unknown=true
files: \.(css|js|json)$
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current regex only matches .css, .js, and .json files. Biome supports a wider range of web-related extensions including TypeScript (.ts, .tsx), JSX (.jsx), and various module formats (.mjs, .cjs). Consider expanding the regex to ensure these files are also processed if they exist in the project.

        files: \.(css|js|jsonc?|jsx?|tsx?|m[jt]s|c[jt]s)$

@subhajitlucky subhajitlucky force-pushed the add-biome-pre-commit branch from 0fe74a4 to 630a005 Compare May 13, 2026 05:08
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

This PR introduces Biome as a formatter/linter for web assets in the repository and wires it into the existing pre-commit setup, while keeping the current YAML formatting/linting hooks intact.

Changes:

  • Added a root biome.json configuration to define shared formatting defaults and enable Biome’s recommended lint rules.
  • Added a local pre-commit hook to run biome check --write on staged CSS/JS/JSON files (with Biome pinned as a Node dependency).

Reviewed changes

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

File Description
biome.json Adds Biome configuration for formatting defaults and recommended linting.
.pre-commit-config.yaml Adds a local Node-based Biome hook for CSS/JS/JSON while retaining existing YAML Prettier/yamllint hooks.

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

@subhajitlucky
Copy link
Copy Markdown
Author

Follow-up pushed in 43e0211:

  • expanded the Biome pre-commit file matcher to include HTML, so layouts/layout.html is covered alongside JS/TS/JSON/CSS assets.
  • verified Biome 2.3.8 accepts the current files.includes force-ignore config. The bundled 2.3.8 schema does not expose a files.ignore property, so I left that structure unchanged rather than introducing an invalid config key.

Verification:

  • npx --yes @biomejs/biome@2.3.8 check biome.json layouts/layout.html --diagnostic-level=info
  • npx --yes prettier@3.8.3 --check .pre-commit-config.yaml
  • git diff --check

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants