Skip to content

Conversation

@akramcodez
Copy link
Contributor

Closes #57

Overview

This PR migrates the project from Prettier to Biome for code formatting. Biome is a faster alternative that provides both formatting and linting capabilities in a single tool.

Changes

New Files:

  • biome.json - Biome configuration matching Prettier settings
  • .husky/pre-commit - Pre-commit hook for automatic formatting

Modified Files:

  • package.json - Updated dependencies and scripts
  • CONTRIBUTING.md - Added Biome setup guide
  • eslint.config.js - Updated comment reference
  • ~195 source files - Import organization and minor formatting fixes

Deleted Files:

  • .prettierignore - Replaced by Biome's files configuration

Configuration

The Biome configuration exactly matches our previous Prettier settings:

  • Tabs for indentation
  • Semicolons always
  • Single quotes
  • No bracket spacing
  • Arrow parentheses as needed
  • Trailing commas everywhere
  • Import organization enabled (new feature)

Pre-commit Hooks

Implemented with husky and lint-staged to automatically format staged files before commit.

Files Changed: ~200

Why so many files?

  1. Import Organization (180 files) - Biome sorts all imports alphabetically. This is a one-time change for consistent import ordering going forward.

  2. Minor Formatting (15 files) - Small formatting differences between Prettier and Biome.

  3. Configuration (5 files) - New Biome config, dependencies, documentation.

This is a one-time migration. Future PRs will have minimal formatting diffs.

Testing

All checks pass:

  • 1996 tests pass
  • Format check passes
  • TypeScript check passes
  • ESLint passes
  • Build succeeds

Migration for Contributors

After pulling this change:

  1. Run pnpm install (sets up pre-commit hooks automatically)
  2. Install Biome VS Code extension: biomejs.biome
  3. Uninstall or disable Prettier extension
  4. Run pnpm format to format any existing changes

Available Scripts

pnpm format          # Format all files
pnpm format:check    # Check formatting without modifying
pnpm test:format     # CI format check

- Replace Prettier with Biome (@biomejs/biome ^1.9.4)
- Add biome.json config matching previous Prettier settings
- Add pre-commit hooks with husky + lint-staged
- Update CONTRIBUTING.md with Biome setup guide
- Enable import organization for consistent imports
- Update npm scripts: format, format:check, test:format

Closes Nano-Collective#57
Copilot AI review requested due to automatic review settings December 14, 2025 13:58
Copy link
Contributor

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 successfully migrates the project from Prettier to Biome for code formatting and linting. Biome provides faster performance and combines formatting with linting capabilities in a single tool.

Key Changes:

  • Replaced Prettier with Biome for formatting (~200 files reformatted)
  • Implemented pre-commit hooks with husky and lint-staged for automatic formatting
  • Organized imports alphabetically across all source files

Reviewed changes

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

Show a summary per file
File Description
biome.json New Biome configuration matching previous Prettier settings
package.json Updated dependencies, scripts, and lint-staged configuration
.husky/pre-commit New pre-commit hook for automatic formatting
CONTRIBUTING.md Added Biome setup guide and migration instructions
eslint.config.js Updated comment reference from Prettier to Biome
.prettierignore Removed (replaced by Biome's files configuration)
pnpm-lock.yaml Updated lockfile with new dependencies
~195 source files Import organization and minor formatting adjustments
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

@akramcodez
Copy link
Contributor Author

PTAL @will-lamerton, thanks.

@mrspence
Copy link
Member

mrspence commented Dec 14, 2025

Hey @akramcodez working well my end - looking great 👍 Cheers for doing this one

  • Commit detection working ✅
  • Contributor docs updated ✅
  • Formatting configured ✅

Next couple of PR merges might be a challenge with the import reorganisation.. could be worth timing when this one is merged in (@will-lamerton)

spinualexandru
spinualexandru previously approved these changes Dec 15, 2025
Copy link
Collaborator

@spinualexandru spinualexandru left a comment

Choose a reason for hiding this comment

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

This looks good, I love biome. Let's merge this after #135 as this oen is easier to run the linter against.

@will-lamerton
Copy link
Member

@spinualexandru - sounds good to me :)

will-lamerton
will-lamerton previously approved these changes Dec 15, 2025
@will-lamerton
Copy link
Member

@akramcodez Approve of this as well. Love it, thanks for doing :D will merge after another big PR as suggested by @spinualexandru - thanks!

@Avtrkrb
Copy link
Collaborator

Avtrkrb commented Dec 15, 2025

@akramcodez You have conflicts preventing me from merging your changes. Could you resolve them please ?

@akramcodez
Copy link
Contributor Author

@Avtrkrb I’ve resolved all the merge conflicts. Let me know if there are any issues.

@akramcodez
Copy link
Contributor Author

@Avtrkrb I've enabled the Biome linter in biome.json as requested. I disabled some specific rules (e.g., useTemplate, useArrowFunction) and the recommended set to keep the noise down and match our current ESLint configuration (warnings over errors). This ensures Biome acts as a fast, compatible secondary linter without blocking our workflow.

@Avtrkrb
Copy link
Collaborator

Avtrkrb commented Dec 15, 2025

@mrspence or @will-lamerton or @spinualexandru Need another approval on this please.

@Avtrkrb Avtrkrb merged commit 2f0a4a6 into Nano-Collective:main Dec 15, 2025
2 checks passed
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.

Linting & Formatting - Switch to Biome

5 participants