Auto-formatted parse-email-address subpackage#26729
Conversation
WalkthroughAdds a 🚥 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 |
2a04eda to
b5038b1
Compare
There was a problem hiding this comment.
This is the only file that changed because of auto-formatting.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26729 +/- ##
=======================================
Coverage 73.24% 73.24%
=======================================
Files 1534 1534
Lines 120762 120762
Branches 14610 14610
=======================================
Hits 88447 88447
- Misses 31284 31300 +16
+ Partials 1031 1015 -16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
closes https://linear.app/ghost/issue/NY-1140 ref #26728 ref TryGhost/eslint-plugin-ghost@7d5e5c3 *This should have no user impact.* This introduces the [Biome] auto-formatter into the repository. It only adds it to the `@tryghost/parse-email-address` subproject as a test. In the future, we'll add it to all subprojects. `yarn fmt` auto-formats the code with Biome. `yarn lint`, in addition to doing other checks with ESLint, also checks that the code is formatted correctly. [Biome]: https://biomejs.dev/
b5038b1 to
8a449cd
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
biome.json (1)
2-2: Update schema version to match installed Biome package.The schema references version
2.4.2but the installed@biomejs/biomepackage is version2.4.6. Update the schema URL to match the installed version for consistency and to ensure access to any configuration options added in the patch releases between versions.Suggested fix
- "$schema": "https://biomejs.dev/schemas/2.4.2/schema.json", + "$schema": "https://biomejs.dev/schemas/2.4.6/schema.json",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@biome.json` at line 2, Update the "$schema" value in biome.json to match the installed `@biomejs/biome` version by changing the schema URL from "https://biomejs.dev/schemas/2.4.2/schema.json" to "https://biomejs.dev/schemas/2.4.6/schema.json"; locate the "$schema" key in biome.json and replace the version segment "2.4.2" with "2.4.6" so the schema aligns with the installed package.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@biome.json`:
- Line 2: Update the "$schema" value in biome.json to match the installed
`@biomejs/biome` version by changing the schema URL from
"https://biomejs.dev/schemas/2.4.2/schema.json" to
"https://biomejs.dev/schemas/2.4.6/schema.json"; locate the "$schema" key in
biome.json and replace the version segment "2.4.2" with "2.4.6" so the schema
aligns with the installed package.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2dc66242-39f6-44a8-90c9-9dee7145a9ba
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (6)
biome.jsonghost/parse-email-address/.eslintrc.jsghost/parse-email-address/package.jsonghost/parse-email-address/src/index.tsghost/parse-email-address/test/.eslintrc.jspackage.json
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@biome.json`:
- Around line 8-10: The Biome config is using the wrong scoping property and
will format the whole repo; update biome.json to use "files.includes" (plural)
to limit formatting to `@tryghost/parse-email-address` (replace the current
"files.ignoreUnknown" block or add an "includes" array under "files"), or
instead move biome.json into ghost/parse-email-address/, set "root": false and
add "extends": "//" so the package inherits root settings; adjust the schema
path if you move the file.
| "files": { | ||
| "ignoreUnknown": false | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if there are other packages that could be unintentionally affected
echo "=== Packages in ghost/ directory ==="
fd -t d -d 1 . ghost/ | head -20
echo ""
echo "=== Check if any package already has its own biome.json ==="
fd biome.json ghost/Repository: TryGhost/Ghost
Length of output: 219
🏁 Script executed:
# Look for any git context or recent changes to understand PR intent
git log --oneline -n 10 -- biome.json 2>/dev/null || echo "No git history available"
# Check if there are any other config files at root that hint at monorepo structure
echo ""
echo "=== Root level config files ==="
fd -t f -d 1 . . | grep -E '\.(json|yaml|yml|js|ts)$' | grep -v node_modules | head -20
# Check the actual biome.json to understand its full scope
echo ""
echo "=== Full biome.json content ==="
cat -n biome.jsonRepository: TryGhost/Ghost
Length of output: 1276
🌐 Web query:
Biome 2.4.6 files section include pattern monorepo scoping
💡 Result:
files.includes in Biome v2 (including 2.4.6)
- In Biome v2, the old
include/ignorekeys were replaced byincludes(plural). [1] files.includesis the top-level gate: tool-specific scopes likelinter.includes/formatter.includesare applied afterfiles.includes, and can’t “re-include” files outside it. [2]files.includessupports:- normal glob patterns (e.g.
src/**/*.ts) - negated patterns starting with
!(exclude from lint/format) - “force-ignore” patterns starting with
!!(exclude even from scanner/project indexing, useful fordist/,build/, etc.). [2][3]
- normal glob patterns (e.g.
- Directory exclusion nuance:
!test(exclude a whole directory) is only supported infiles.includes; elsewhere you generally need something like!/test/**. [2]
Monorepo scoping (how to apply it per package)
Biome resolves configuration by folder: running Biome inside a package uses that package’s biome.json, and monorepos are supported “out of the box” in v2. [4]
Typical setups:
- Root config + package configs that inherit root
- Put a
biome.jsonat repo root. - In each package, add
packages/<name>/biome.jsonwithextends: "//"(Biome’s shortcut for “extend the root config”). [4] - Nested configs must be marked non-root (
"root": false), and Biome notes thatextends: "//"implies it isn’t a root config. [5][4]
- Package opts out of inheriting root
- Create
packages/<name>/biome.jsonwithoutextends: "//"(and set"root": false), so it doesn’t inherit the root settings. [5]
Practical example: scope Biome to only packages/*/(src|test) in a monorepo
{
"files": {
"includes": [
"packages/**/src/**",
"packages/**/test/**",
"!**/dist/**",
"!**/build/**",
"!!**/dist",
"!!**/build"
]
}
}- The
!…patterns stop lint/format on those paths; the!!…patterns additionally stop scanner/project indexing (recommended for generated/output dirs). [2][3]
Sources: Biome configuration reference & guides. [2][3][4][5][1]
Correct scoping syntax: use includes (plural) to limit formatter to ghost/parse-email-address.
The PR is scoped to @tryghost/parse-email-address, but this root-level configuration lacks an includes pattern. Without it, Biome will apply formatting to all files in the repository. For Biome v2.4.6, the correct syntax is includes (plural), not include.
Choose one approach:
- Add
files.includesat root level:
🔧 Suggested fix (Option 1)
"files": {
"ignoreUnknown": false,
"includes": ["ghost/parse-email-address/**"]
},- Move
biome.jsonintoghost/parse-email-address/, add"root": falseandextends: "//"to inherit root settings, then update the schema path.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "files": { | |
| "ignoreUnknown": false | |
| }, | |
| "files": { | |
| "ignoreUnknown": false, | |
| "includes": ["ghost/parse-email-address/**"] | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@biome.json` around lines 8 - 10, The Biome config is using the wrong scoping
property and will format the whole repo; update biome.json to use
"files.includes" (plural) to limit formatting to `@tryghost/parse-email-address`
(replace the current "files.ignoreUnknown" block or add an "includes" array
under "files"), or instead move biome.json into ghost/parse-email-address/, set
"root": false and add "extends": "//" so the package inherits root settings;
adjust the schema path if you move the file.
There was a problem hiding this comment.
@EvanHahn Up to you on this. I'm ok with keeping this opened up.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
9larsons
left a comment
There was a problem hiding this comment.
Curious to see how this plays out!
closes https://linear.app/ghost/issue/NY-1140
ref #26728
ref TryGhost/eslint-plugin-ghost@7d5e5c3
This should have no user impact.
This introduces the Biome auto-formatter into the repository. It only adds it to the
@tryghost/parse-email-addresssubproject as a test. In the future, we'll add it to all subprojects.yarn fmtauto-formats the code with Biome.yarn lint, in addition to doing other checks with ESLint, also checks that the code is formatted correctly.