-
-
Notifications
You must be signed in to change notification settings - Fork 716
feat(core): add support for .graphqls
files
#7118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add support for .graphqls
files
#7118
Conversation
🦋 Changeset detectedLatest commit: 926b7d8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughGraphQL 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
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this 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:
- Add a brief note in the rustdoc of either this function or the module header that
.graphqls
is accepted.- 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 listsThe
"graphqls" | "graphql" | "gql"
pattern is now duplicated in two match arms.
Consider hoisting this into a small constant slice and usingmatches!(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
📒 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 forjust 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
What's the difference between |
There was a problem hiding this 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
📒 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 forjust 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 referencesSPACING_GRAPHQLS_SANITY_AFTER
which doesn't exist due to the duplicate constant name issue above. Once that's resolved, this test should work properly.
Added a comment with links that describe the difference between operation files (.graphql) and SDL files (.grqphqls) |
Thank you. Please address the CI failures:
|
@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 |
.graphqls
files
d899ca8
to
42aeb74
Compare
Thanks @ematipico for address it! |
Summary
We use
.graphqls
files for GraphQL definition files that contain only types (SDL), like this: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.