Biome Implementation#7
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds 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 Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
latestVersionproperty.
- Add a Biome dependency definition in
src/data.tswithlatestVersion: '2.3.5'(matching other code quality tools)- Update
src/templates/configurations/biome.jsonschema from1.7.0to2.3.5to align with the package version- Use the dependency metadata in
generatePackageJson.tsinstead 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
formatandlintvalues 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
📒 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.jsonandtsconfig.*.jsonpatterns 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:
- Complete exclusion via
.biomeignoreis preferred (simpler, more explicit)- Processing with disabled rules via overrides is preferred (allows potential future rule enablement)
- Both are intentionally kept as defense-in-depth
If exclusion via
.biomeignoreis sufficient, the tsconfig-specific entries can be removed from the overrides inbiome.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(requireslangattribute on<html>)noBlankTarget(warns abouttarget="_blank"withoutrel="noopener")useButtonType(requires explicittypeon<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.
Minor Improvments
There was a problem hiding this comment.
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 ifplacement.The blank line before
else ifis unconventional. Consider placingelse ifdirectly 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
📒 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)
| export const biomeDependency: AvailableDependency = { | ||
| latestVersion: '2.3.5', | ||
| value: '@biomejs/biome' | ||
| }; |
There was a problem hiding this comment.
🧩 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.
Summary
--biome/ interactive selections intocodeQualityToolbiome.json,.biomeignore) alongside Tailwind, env, and git assetsbiome.jsonwith the ESLint + Prettier parity rules (As much as possible) we curated (formatter defaults, a11y/style rule overrides, tsconfig/JSON carve-outs)format,lint,check) that invoke the pinned CLI vianpx @biomejs/biomeSummary by CodeRabbit
New Features
Behavior Change