Skip to content

Auto-formatted parse-email-address subpackage#26729

Open
EvanHahn wants to merge 2 commits intomainfrom
parse-email-address-biome-auto-format
Open

Auto-formatted parse-email-address subpackage#26729
EvanHahn wants to merge 2 commits intomainfrom
parse-email-address-biome-auto-format

Conversation

@EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Mar 6, 2026

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Walkthrough

Adds a biome.json configuration enabling the formatter with 4-space indentation, LF line endings, 120-character width, and JS-specific rules (single quotes, no trailing commas, no bracket spacing); JSON and CSS formatters are disabled. Enables VCS integration with Git and a .gitignore. Adds @biomejs/biome to devDependencies. Updates npm scripts to run biome format before linting. ESLint presets changed to their -no-style variants. Minor formatting change in ghost/parse-email-address/src/index.ts.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: auto-formatting the parse-email-address subpackage with Biome.
Description check ✅ Passed The description is directly related to the changeset, explaining the introduction of Biome auto-formatter and its usage.
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch parse-email-address-biome-auto-format

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.

@EvanHahn EvanHahn force-pushed the parse-email-address-biome-auto-format branch from 2a04eda to b5038b1 Compare March 6, 2026 16:44
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only file that changed because of auto-formatting.

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.24%. Comparing base (11c673f) to head (5eb502f).

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     
Flag Coverage Δ
admin-tests 54.31% <ø> (ø)
e2e-tests 73.24% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from EvanHahn/update-eslint-plugin to main March 6, 2026 17:09
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/
@EvanHahn EvanHahn force-pushed the parse-email-address-biome-auto-format branch from b5038b1 to 8a449cd Compare March 6, 2026 17:10
Copy link
Contributor

@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.

🧹 Nitpick comments (1)
biome.json (1)

2-2: Update schema version to match installed Biome package.

The schema references version 2.4.2 but the installed @biomejs/biome package is version 2.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

📥 Commits

Reviewing files that changed from the base of the PR and between 11c673f and 8a449cd.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • biome.json
  • ghost/parse-email-address/.eslintrc.js
  • ghost/parse-email-address/package.json
  • ghost/parse-email-address/src/index.ts
  • ghost/parse-email-address/test/.eslintrc.js
  • package.json

@EvanHahn EvanHahn requested a review from 9larsons March 6, 2026 17:39
Copy link
Contributor

@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: 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e55ea86-0a0c-46e0-ba3d-3a9717c14f4d

📥 Commits

Reviewing files that changed from the base of the PR and between 8a449cd and 5eb502f.

📒 Files selected for processing (1)
  • biome.json

Comment on lines +8 to +10
"files": {
"ignoreUnknown": false
},
Copy link
Contributor

@coderabbitai coderabbitai bot Mar 6, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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.json

Repository: 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/ignore keys were replaced by includes (plural). [1]
  • files.includes is the top-level gate: tool-specific scopes like linter.includes / formatter.includes are applied after files.includes, and can’t “re-include” files outside it. [2]
  • files.includes supports:
    • 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 for dist/, build/, etc.). [2][3]
  • Directory exclusion nuance: !test (exclude a whole directory) is only supported in files.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:

  1. Root config + package configs that inherit root
  • Put a biome.json at repo root.
  • In each package, add packages/<name>/biome.json with extends: "//" (Biome’s shortcut for “extend the root config”). [4]
  • Nested configs must be marked non-root ("root": false), and Biome notes that extends: "//" implies it isn’t a root config. [5][4]
  1. Package opts out of inheriting root
  • Create packages/<name>/biome.json without extends: "//" (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:

  1. Add files.includes at root level:
🔧 Suggested fix (Option 1)
  "files": {
    "ignoreUnknown": false,
    "includes": ["ghost/parse-email-address/**"]
  },
  1. Move biome.json into ghost/parse-email-address/, add "root": false and extends: "//" 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.

Suggested change
"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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@EvanHahn Up to you on this. I'm ok with keeping this opened up.

Copy link
Contributor

Choose a reason for hiding this comment

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

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!

Copy link
Contributor

@9larsons 9larsons left a comment

Choose a reason for hiding this comment

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

Curious to see how this plays out!

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.

2 participants