Skip to content

feat: graphql as valid graphql tag#9163

Merged
ematipico merged 7 commits intobiomejs:mainfrom
JUSTIVE:feat/graphql-as-graphql-tag
Feb 23, 2026
Merged

feat: graphql as valid graphql tag#9163
ematipico merged 7 commits intobiomejs:mainfrom
JUSTIVE:feat/graphql-as-graphql-tag

Conversation

@JUSTIVE
Copy link
Contributor

@JUSTIVE JUSTIVE commented Feb 20, 2026

Summary

As discussed on #9121, adds supports relay's GraphQL tag by making graphql`` as valid graphql tag.

Test Plan

added testcase on biome_service/src/workspace/server.tests.rs

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 71d5350

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the A-Project Area: project label Feb 20, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

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

Walkthrough

Adds a changeset entry (minor version bump) and updates the JavaScript file handler so is_graphql_tag recognises both gql and graphql. Tests updated to add a second GraphQL template literal in workspace server tests to verify formatting handles multiple embedded GraphQL blocks. No other public APIs or behaviour changes.

Possibly related PRs

Suggested labels

A-Parser, A-Formatter, L-JavaScript

Suggested reviewers

  • siketyan
  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding support for 'graphql' as a valid GraphQL tag identifier alongside 'gql'.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation (Relay's GraphQL tag support), referencing issue #9121, and noting the test case addition.

✏️ 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

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
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: 2

🧹 Nitpick comments (1)
crates/biome_service/src/file_handlers/javascript.rs (1)

697-704: Stale comment — update to reflect both tags.

The comment // gql\`` only documents half the branch now.

✏️ Suggested tweak
-    // gql``
+    // gql`` or graphql``
     if let Some(AnyJsExpression::JsIdentifierExpression(ident)) = tag
         && ident
             .name()
             .is_ok_and(|name| name.has_name("gql") || name.has_name("graphql"))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_service/src/file_handlers/javascript.rs` around lines 697 - 704,
The comment above the branch that checks
AnyJsExpression::JsIdentifierExpression(ident) currently reads "// gql``" but
the condition tests both has_name("gql") and has_name("graphql"); update that
inline comment to reflect both tags (e.g., "// gql`` or graphql``") so it
documents the branch correctly, near the ident.name() check in the
file_handlers::javascript.rs code block handling tag detection.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/two-signs-try.md:
- Line 2: The changeset currently marks the package "@biomejs/biome" as "patch"
but this PR introduces a new feature (recognising `graphql` as an embedded
template tag), so update the changeset entry to use the "minor" change type
instead of "patch" and ensure the changeset targets the `next` release line;
specifically replace the value "patch" with "minor" for the "@biomejs/biome"
entry in the .changeset/two-signs-try.md changeset so the release tooling will
treat it as a feature for the next branch.

In `@crates/biome_service/src/file_handlers/javascript.rs`:
- Around line 699-701: Add a snapshot test that covers tagged templates using
the tag name "graphql" (i.e., graphql`...`) to mirror the existing gql`...`
tests in graphql-tag.js; update the test file (graphql-tag.js) by duplicating
the existing gql snapshot test and replacing the tag identifier with "graphql"
so the new test generates/validates the same snapshot output for graphql`...`
templates and ensures the parser branch that checks
ident.name().is_ok_and(|name| name.has_name("gql") || name.has_name("graphql"))
is exercised.

---

Nitpick comments:
In `@crates/biome_service/src/file_handlers/javascript.rs`:
- Around line 697-704: The comment above the branch that checks
AnyJsExpression::JsIdentifierExpression(ident) currently reads "// gql``" but
the condition tests both has_name("gql") and has_name("graphql"); update that
inline comment to reflect both tags (e.g., "// gql`` or graphql``") so it
documents the branch correctly, near the ident.name() check in the
file_handlers::javascript.rs code block handling tag detection.

@JUSTIVE JUSTIVE changed the base branch from main to next February 20, 2026 20:00
@JUSTIVE JUSTIVE force-pushed the feat/graphql-as-graphql-tag branch from f86fcb4 to 5e20423 Compare February 20, 2026 20:02
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)
crates/biome_service/src/workspace/server.tests.rs (1)

573-581: LGTM – covers all three graphql invocation styles.

The three variants now tested together (gql\`, graphql(``), graphql``) give solid coverage for the new Relay-style tagged template. The cleanup moving `` ); `` onto its own line is also appreciated.

One optional thought: a separate, focused test for graphql\`in isolation (without thegql` and call-style variants) would make future failures easier to diagnose, but bundling them is perfectly fine here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_service/src/workspace/server.tests.rs` around lines 573 - 581,
The test file currently bundles three `graphql` invocation styles (gql``,
graphql(``), and graphql``) together; add a focused, isolated test that only
exercises the Relay-style tagged template invocation `graphql\`\`` (e.g., using
the `Baz`/`PeopleCount` query) so failures specific to that form are easier to
diagnose in future, or explicitly document and keep the combined test if you
prefer; implement the isolated test as a new test function that imports/uses the
same `Baz` query and asserts the expected parsing/behavior for `graphql\`\``
alone.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_service/src/workspace/server.tests.rs`:
- Around line 573-581: The test file currently bundles three `graphql`
invocation styles (gql``, graphql(``), and graphql``) together; add a focused,
isolated test that only exercises the Relay-style tagged template invocation
`graphql\`\`` (e.g., using the `Baz`/`PeopleCount` query) so failures specific
to that form are easier to diagnose in future, or explicitly document and keep
the combined test if you prefer; implement the isolated test as a new test
function that imports/uses the same `Baz` query and asserts the expected
parsing/behavior for `graphql\`\`` alone.

@JUSTIVE JUSTIVE requested a review from siketyan February 21, 2026 14:15
@JUSTIVE JUSTIVE changed the base branch from next to main February 23, 2026 08:40
@JUSTIVE JUSTIVE force-pushed the feat/graphql-as-graphql-tag branch from ef81dc7 to 7c8c203 Compare February 23, 2026 08:46
@JUSTIVE JUSTIVE force-pushed the feat/graphql-as-graphql-tag branch from 7c8c203 to 6fb84b2 Compare February 23, 2026 09:05
@JUSTIVE JUSTIVE requested a review from ematipico February 23, 2026 09:11
Co-authored-by: Maikel van Dort <maikel.van.dort@gmail.com>
@JUSTIVE JUSTIVE requested a review from Netail February 23, 2026 10:55
@ematipico ematipico merged commit f87acf6 into biomejs:main Feb 23, 2026
13 checks passed
@github-actions github-actions bot mentioned this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants