+
Skip to content

Conversation

avshalomt2
Copy link
Contributor

@avshalomt2 avshalomt2 commented Aug 5, 2025

Summary

We use .graphqls files for GraphQL definition files that contain only types (SDL), like this:

scalar Time
scalar UUID

type Tenant {
  id: UUID!
  name: String!
  isActive: Boolean!
  createdAt: Time!
  updatedAt: Time!
}

type DashboardUser {
  name: String!
  givenName: String
  familyName: String
  email: String!
  createdAt: Time
}

type Query {
  tenants: [Tenant!]!
  dashboardUsers(tenantId: UUID): [DashboardUser!]!
}

We want biome to format those, and as we seen that you already have tests that parse this format, the format we use in .graphqls types, we thought that it will be easy and correct to just detect .graphqls files as matching the already existing GraphQL syntax.

Test Plan

The .graphqls (SDL) syntax is as the one you currently parse as .graphql, so I just added a sanity test that verifies the current behavior, with the .graphqls file extension.

Docs

I didn't find any documentation about what file extensions are matched to what syntax, so assuming they don't exist, I don't see a reason for any documentation change.
Added a reference in a comment to describe the file different file extensions.

Copy link

changeset-bot bot commented Aug 5, 2025

🦋 Changeset detected

Latest commit: 926b7d8

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

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

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

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

GraphQL file handling was extended to accept the ".graphqls" extension and "graphqls" language ID in GraphqlFileSource: try_from_extension and try_from_language_id now recognise "graphqls" alongside "graphql" and "gql". Documentation comments explaining the .graphql vs .graphqls distinction were added. A CLI formatter test was added to exercise formatting of a .graphqls file. No public signatures or error-handling changes were made.

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the A-Parser Area: parser label Aug 5, 2025
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: 0

🧹 Nitpick comments (2)
crates/biome_graphql_syntax/src/file_source.rs (2)

42-44: Nice addition – please document & test the new extension

"graphqls" is now recognised – great.
Two quick follow-ups:

  1. Add a brief note in the rustdoc of either this function or the module header that .graphqls is accepted.
  2. Drop a unit-test (similar to the existing ones for .graphql) to lock the behaviour in.

Keeps future regressions at bay and fulfils the “update documentation” guideline.


55-57: Avoid duplication of the extension / language-ID lists

The "graphqls" | "graphql" | "gql" pattern is now duplicated in two match arms.
Consider hoisting this into a small constant slice and using matches!(value, v if ALLOWED.contains(&v)) to keep the list single-sourced.

Not urgent, but tidies things up for the next extension we add.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b541fb and 2556883.

📒 Files selected for processing (1)
  • crates/biome_graphql_syntax/src/file_source.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_graphql_syntax/src/file_source.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_graphql_syntax/src/file_source.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_graphql_syntax/src/file_source.rs

@ematipico
Copy link
Member

What's the difference between .graphql files and .graphqls files?

@github-actions github-actions bot added the A-CLI Area: CLI label Aug 5, 2025
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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2556883 and 1e07de4.

📒 Files selected for processing (1)
  • crates/biome_cli/tests/commands/format.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_cli/tests/commands/format.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_cli/tests/commands/format.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_cli/tests/commands/format.rs
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.
📚 Learning: applies to crates/biome_formatter/tests/spec_test.rs : implement the `run` function in `spec_test.rs...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/tests/spec_test.rs : Implement the `run` function in `spec_test.rs` to execute formatting tests using the provided test infrastructure.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_formatter/tests/spec_tests.rs : update the `spec_tests.rs` file to generate ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : inside the `biome...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_service/src/workspace/watcher.tests.rs : add tests for watcher workspace met...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.161Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_formatter/tests/language.rs : implement the `htmltestformatlanguage` struct ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_formatter/**/lib.rs : add the provided formatting infrastructure code inside...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/**/lib.rs : Add the provided formatting infrastructure code inside your `lib.rs` file when creating a new formatter crate for a language (e.g., biome_html_formatter).

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_service/../biome_lsp/src/server.tests.rs : add end-to-end tests for watcher ...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.161Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Add end-to-end tests for watcher functionality in LSP tests (../biome_lsp/src/server.tests.rs)

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_formatter/**/cargo.toml : update the `cargo.toml` file to include the specif...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.334Z
Learning: Applies to crates/biome_formatter/**/Cargo.toml : Update the `Cargo.toml` file to include the specified `[dev-dependencies]` for testing utilities.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to benches/html_formatter.rs : benchmark for html formatter must be in `benches/html_formatt...
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.386Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_js_formatter/**/*.rs : import the `formatnode` trait and implement it for yo...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.620Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating a new AST node formatter.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_js_formatter/**/*.rs : for tokens that are not mandatory, use the provided h...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.620Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to crates/biome_parser/xtask/codegen/*.ungram : unions of nodes must start with `any*` (e.g....
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.325Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Unions of nodes must start with `Any*` (e.g., `AnyHtmlAttribute`).

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: test rules using quick tests in the appropriate test file (e.g., `biome_js_analyze/tests/quick_test....
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.422Z
Learning: Test rules using quick tests in the appropriate test file (e.g., `biome_js_analyze/tests/quick_test.rs`) and snapshot tests in `tests/specs/`.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: applies to **/tests/**/*.snap : use `.snap` files for snapshot testing with `cargo insta`...
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.386Z
Learning: Applies to **/tests/**/*.snap : Use `.snap` files for snapshot testing with `cargo insta`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: use rust's `dbg!()` macro for debugging and pass `--show-output` to `cargo` to display debug output ...
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.546Z
Learning: Use Rust's `dbg!()` macro for debugging and pass `--show-output` to `cargo` to display debug output during tests.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
🔇 Additional comments (2)
crates/biome_cli/tests/commands/format.rs (2)

162-175: LGTM!

The unformatted GraphQL schema content is appropriate for testing the formatter's ability to handle irregular spacing and indentation.


392-427: Test logic is sound, but depends on fixing the constant name.

The test correctly validates .graphqls file formatting functionality, but it references SPACING_GRAPHQLS_SANITY_AFTER which doesn't exist due to the duplicate constant name issue above. Once that's resolved, this test should work properly.

@avshalomt2
Copy link
Contributor Author

Added a comment with links that describe the difference between operation files (.graphql) and SDL files (.grqphqls)

@ematipico
Copy link
Member

Thank you. Please address the CI failures:

  • the title of the PR
  • missing snapshot for the new test

@ematipico
Copy link
Member

@avshalomt2 we would like to land this feature, can you address the failures? If you can't, let us know ASAP and we can take over for you

@ematipico ematipico changed the base branch from main to next August 13, 2025 11:52
@ematipico ematipico changed the title Support .graphqls extensions for GraphQL schema files feat(core): add support for .graphqls files Aug 13, 2025
@github-actions github-actions bot added A-Core Area: core A-Project Area: project A-Linter Area: linter A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages A-Diagnostic Area: diagnostocis L-HTML Language: HTML labels Aug 13, 2025
@ematipico ematipico force-pushed the support-graphqls-extensions-for-graphql branch from d899ca8 to 42aeb74 Compare August 13, 2025 12:05
@github-actions github-actions bot removed A-Core Area: core A-Project Area: project labels Aug 13, 2025
@github-actions github-actions bot removed A-Linter Area: linter A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-CSS Language: CSS A-Diagnostic Area: diagnostocis L-HTML Language: HTML labels Aug 13, 2025
@ematipico ematipico merged commit a78e878 into biomejs:next Aug 13, 2025
4 checks passed
@github-actions github-actions bot mentioned this pull request Aug 13, 2025
@avshalomt2
Copy link
Contributor Author

Thanks @ematipico for address it!
I wanted to post that I will only be able to work on it over the weekend, but you beat me, what an awesome project you have! 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Parser Area: parser L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载