Skip to content

Biome Implementation#7

Open
eugenegraves wants to merge 14 commits intomainfrom
biome
Open

Biome Implementation#7
eugenegraves wants to merge 14 commits intomainfrom
biome

Conversation

@eugenegraves
Copy link
Copy Markdown
Collaborator

@eugenegraves eugenegraves commented Nov 12, 2025

Summary

  • add a Biome option to the CLI, wiring --biome / interactive selections into codeQualityTool
  • scaffold Biome config files (biome.json, .biomeignore) alongside Tailwind, env, and git assets
  • align generated biome.json with the ESLint + Prettier parity rules (As much as possible) we curated (formatter defaults, a11y/style rule overrides, tsconfig/JSON carve-outs)
  • emit Biome-friendly package scripts (format, lint, check) that invoke the pinned CLI via npx @biomejs/biome

Summary by CodeRabbit

  • New Features

    • Added Biome as a supported code‑quality tool.
    • Generates Biome configuration and ignore files for formatting, linting, import organization, and common ignores.
  • Behavior Change

    • When Biome is selected, project scripts are set to Biome commands and Biome is added as a dev dependency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 12, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d942ba2 and 4324ee0.

📒 Files selected for processing (3)
  • src/data.ts
  • src/generators/configurations/generatePackageJson.ts
  • src/generators/configurations/scaffoldConfigurationFiles.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/generators/configurations/scaffoldConfigurationFiles.ts
  • src/data.ts
  • src/generators/configurations/generatePackageJson.ts

📝 Walkthrough

Walkthrough

Adds Biome support: introduces a new dependency entry for Biome, a package.json generation branch that inserts Biome as a devDependency and adjusts scripts, template files biome.json and .biomeignore, and scaffold logic to copy those templates when Biome is selected.

Changes

Cohort / File(s) Summary
Package JSON generator
src/generators/configurations/generatePackageJson.ts
Imports biomeDependency; adds codeQualityTool === 'biome' branch to resolve and insert @biomejs/biome into devDependencies and adjust/omit default format/lint script entries.
Scaffold configuration files
src/generators/configurations/scaffoldConfigurationFiles.ts
Adds branch for codeQualityTool === 'biome' to copy biome.json and .biomeignore from templates; clarifies unsupported-tool logging.
Biome templates
src/templates/configurations/biome.json, src/templates/configurations/.biomeignore
Adds Biome configuration and ignore file with formatter/linter rules, overrides, organizeImports, includes/ignores, and common ignore patterns.
Dependency data
src/data.ts
Adds exported biomeDependency: AvailableDependency with value: '@biomejs/biome' and latestVersion: '2.3.5'.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as Scaffolder CLI
    participant Gen as Generator
    participant Data as Dependency Map
    participant FS as Template Filesystem

    CLI->>Gen: create project (options include codeQualityTool)
    Gen->>Data: read dependency entries (includes biomeDependency)
    alt codeQualityTool == "biome"
        Gen->>Gen: resolveVersion(biomeDependency)
        Gen->>Gen: add devDependency "@biomejs/biome": resolvedVersion
        Gen->>Gen: adjust/skip default format/lint scripts
        Gen->>FS: copy `.../templates/configurations/biome.json`
        Gen->>FS: copy `.../templates/configurations/.biomeignore`
    else codeQualityTool == "eslint+prettier"
        Gen->>Gen: add eslint & prettier devDependencies and scripts
        Gen->>FS: copy eslint/prettier templates
    else
        Gen->>Gen: log unsupported tool message
    end
    Gen->>FS: write `package.json`
    FS-->>CLI: project scaffolded
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • absolutejs

Poem

🐇 I hopped through templates, a bundle to hide,
Brought Biome along for a tidy new ride.
Rules, ignores, and a devDependency snug,
Scripts pruned like carrots — compact, not a shrug.
Hop, lint, format — the scaffold is done with a thud.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Biome Implementation' directly and clearly summarizes the main change: adding Biome as a code-quality tool option to the CLI with configuration scaffolding and package scripts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch biome

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/generators/configurations/generatePackageJson.ts (1)

78-93: Update Biome version from 1.7.0 to 2.3.5 and add latestVersion metadata for consistency.

The Biome package version is 3 major versions behind the latest (1.7.0 → 2.3.5), and the generated template's schema version (1.7.0) no longer matches the root codebase's schema (2.1.2). Additionally, Biome's version is hardcoded instead of following the same pattern as eslint+prettier dependencies, which use a latestVersion property.

  • Add a Biome dependency definition in src/data.ts with latestVersion: '2.3.5' (matching other code quality tools)
  • Update src/templates/configurations/biome.json schema from 1.7.0 to 2.3.5 to align with the package version
  • Use the dependency metadata in generatePackageJson.ts instead of hardcoding '1.7.0'
🧹 Nitpick comments (1)
src/generators/configurations/generatePackageJson.ts (1)

165-172: Consider conditional script initialization to avoid override pattern.

The scripts are initialized with ESLint/Prettier defaults (lines 166-172), then later overridden for Biome (lines 223-228). While this works correctly and preserves DB scripts, it's slightly inefficient since the initial format and lint values are discarded.

Consider conditionally initializing the code-quality scripts based on codeQualityTool:

 // ---- Scripts (initialize first, then override for Biome below) ----
+const baseScripts = {
+  dev: 'bash -c \'trap "exit 0" INT; bun run --watch src/backend/server.ts\'',
+  test: 'echo "Error: no test specified" && exit 1',
+  typecheck: 'bun run tsc --noEmit'
+};
+
+const codeQualityScripts = codeQualityTool === 'biome' 
+  ? {
+      format: 'npx @biomejs/biome format . --write',
+      lint: 'npx @biomejs/biome lint .',
+      check: 'npx @biomejs/biome check .'
+    }
+  : {
+      format: `prettier --write "./**/*.{js,ts,css,json,mjs,md${flags.requiresReact ? ',jsx,tsx' : ''}${flags.requiresSvelte ? ',svelte' : ''}${flags.requiresVue ? ',vue' : ''}${flags.requiresHtml || flags.requiresHtmx ? ',html' : ''}}"`,
+      lint: 'eslint ./src'
+    };
+
 const scripts: PackageJson['scripts'] = {
-  dev: 'bash -c \'trap "exit 0" INT; bun run --watch src/backend/server.ts\'',
-  format: `prettier --write "./**/*.{js,ts,css,json,mjs,md${flags.requiresReact ? ',jsx,tsx' : ''}${flags.requiresSvelte ? ',svelte' : ''}${flags.requiresVue ? ',vue' : ''}${flags.requiresHtml || flags.requiresHtmx ? ',html' : ''}}"`,
-  lint: 'eslint ./src',
-  test: 'echo "Error: no test specified" && exit 1',
-  typecheck: 'bun run tsc --noEmit'
+  ...baseScripts,
+  ...codeQualityScripts
 };

Then remove the override block at lines 223-228.

Also applies to: 223-228

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdd3f39 and 4ea6419.

📒 Files selected for processing (4)
  • src/generators/configurations/generatePackageJson.ts (5 hunks)
  • src/generators/configurations/scaffoldConfigurationFiles.ts (1 hunks)
  • src/templates/configurations/.biomeignore (1 hunks)
  • src/templates/configurations/biome.json (1 hunks)
🔇 Additional comments (5)
src/templates/configurations/.biomeignore (1)

15-16: Potential redundancy with biome.json overrides.

The tsconfig.json and tsconfig.*.json patterns listed here will completely exclude these files from Biome processing. However, biome.json (lines 65-77) defines overrides that disable the formatter and linter for these same files. If they're ignored via .biomeignore, the overrides become unnecessary.

Consider whether:

  1. Complete exclusion via .biomeignore is preferred (simpler, more explicit)
  2. Processing with disabled rules via overrides is preferred (allows potential future rule enablement)
  3. Both are intentionally kept as defense-in-depth

If exclusion via .biomeignore is sufficient, the tsconfig-specific entries can be removed from the overrides in biome.json.

src/generators/configurations/scaffoldConfigurationFiles.ts (1)

65-78: LGTM! Clean integration of Biome configuration scaffolding.

The implementation follows the established pattern for eslint+prettier, properly copies both required Biome files, and provides clear user feedback when no tool is selected.

src/templates/configurations/biome.json (3)

31-36: Verify disabled accessibility rules align with project requirements.

Three accessibility rules are explicitly disabled:

  • useHtmlLang (requires lang attribute on <html>)
  • noBlankTarget (warns about target="_blank" without rel="noopener")
  • useButtonType (requires explicit type on <button>)

These are typically valuable accessibility and security safeguards. Ensure these are intentionally disabled to match existing ESLint+Prettier parity, or if they should be enabled.


72-77: JSON formatter explicitly disabled - verify intent.

The override disables both the formatter and linter for all JSON files (lines 72-77). This means JSON files won't benefit from Biome's formatting or linting capabilities.

If the intent is to preserve manual JSON formatting (e.g., for specific alignment or comments in JSONC files), this is reasonable. However, if consistent JSON formatting is desired, consider enabling the formatter while keeping rules minimal.


1-84: LGTM! Comprehensive Biome configuration.

The configuration is well-structured and covers:

  • Appropriate file inclusion/exclusion patterns
  • Consistent formatting rules (tabs, width 4, line width 80)
  • Balanced linter rules with reasonable overrides
  • File-type-specific overrides for Markdown, YAML, JSON, and config files
  • Import organization enabled

The configuration appears to successfully target ESLint+Prettier parity as mentioned in the PR objectives.

Comment thread src/generators/configurations/generatePackageJson.ts Outdated
Comment thread src/generators/configurations/generatePackageJson.ts Outdated
Comment thread src/generators/configurations/scaffoldConfigurationFiles.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/generators/configurations/generatePackageJson.ts (1)

211-211: Remove AI-generated comment.

This section comment should be removed as per previous review feedback.

🧹 Nitpick comments (1)
src/generators/configurations/generatePackageJson.ts (1)

124-130: Minor formatting: else if placement.

The blank line before else if is unconventional. Consider placing else if directly after the closing brace for consistency with standard JavaScript/TypeScript formatting.

-	}
-	
-	else if (codeQualityTool === 'biome') {
+	} else if (codeQualityTool === 'biome') {
 		devDependencies[biomeDependency.value] = resolveVersion(
 			biomeDependency.value,
 			biomeDependency.latestVersion
 		);
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49e8722 and d942ba2.

📒 Files selected for processing (2)
  • src/data.ts (1 hunks)
  • src/generators/configurations/generatePackageJson.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-23T22:49:50.518Z
Learnt from: absolutejs
Repo: absolutejs/create-absolutejs PR: 15
File: src/data.ts:138-156
Timestamp: 2025-11-23T22:49:50.518Z
Learning: In the create-absolutejs repository, React-specific ESLint plugins (eslint-plugin-jsx-a11y, eslint-plugin-react, eslint-plugin-react-compiler, eslint-plugin-react-hooks) should only be installed conditionally when the project uses React (flags.requiresReact is true), not for all projects using eslint+prettier.

Applied to files:

  • src/generators/configurations/generatePackageJson.ts
🧬 Code graph analysis (2)
src/data.ts (1)
src/types.ts (1)
  • AvailableDependency (31-36)
src/generators/configurations/generatePackageJson.ts (1)
src/data.ts (1)
  • biomeDependency (171-174)

Comment thread src/data.ts Outdated
Comment on lines +171 to +174
export const biomeDependency: AvailableDependency = {
latestVersion: '2.3.5',
value: '@biomejs/biome'
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

latest version @biomejs/biome npm package

💡 Result:

Latest published version: 2.2.3. [1][2]

Sources:
[1] npm package page for @biomejs/biome.
[2] Release history for @biomejs/biome.


Update @biomejs/biome version to the latest available release.

Version 2.3.5 does not exist; the latest published version is 2.2.3. Update latestVersion to '2.2.3'.

🤖 Prompt for AI Agents
In src/data.ts around lines 171 to 174, the biomeDependency object incorrectly
sets latestVersion to '2.3.5' which is not published; update the latestVersion
field to the correct published release '2.2.3' so the AvailableDependency
reflects the real latest package version.

Comment thread src/generators/configurations/generatePackageJson.ts
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.

3 participants