Skip to content

Commit

Permalink
chore: update codegen to include GraphQL (#3301)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Jun 27, 2024
1 parent 55fd8ed commit f88b7b2
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 50 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/biome_configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true, features = ["serde"] }
biome_graphql_analyze = { workspace = true }
biome_graphql_syntax = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_formatter = { workspace = true, features = ["serde"] }
biome_js_syntax = { workspace = true, features = ["serde", "schema"] }
Expand All @@ -47,6 +49,7 @@ schema = [
"biome_formatter/serde",
"biome_json_syntax/schema",
"biome_css_syntax/schema",
"biome_graphql_syntax/schema",
]

[dev-dependencies]
Expand Down
76 changes: 48 additions & 28 deletions crates/biome_configuration/src/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion crates/biome_service/tests/workspace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[cfg(test)]
mod test {
use biome_analyze::RuleCategories;
use biome_configuration::linter::{RuleGroup, RuleSelector};
use biome_fs::BiomePath;
use biome_js_syntax::{JsFileSource, TextSize};
use biome_service::file_handlers::DocumentFileSource;
Expand Down Expand Up @@ -185,7 +187,7 @@ mod test {
content: r#"type Query {
me: User
}
type User {
id: ID
name: String
Expand All @@ -202,4 +204,35 @@ type User {

assert!(syntax.starts_with("GraphqlRoot"))
}

#[test]
fn correctly_pulls_lint_diagnostics() {
let workspace = create_server();

let graphql_file = FileGuard::open(
workspace.as_ref(),
OpenFileParams {
path: BiomePath::new("file.graphql"),
content: r#"query {
member @deprecated(abc: 123)
}"#
.into(),
version: 0,
document_file_source: None,
},
)
.unwrap();
let result = graphql_file.pull_diagnostics(
RuleCategories::all(),
10,
vec![RuleSelector::Rule(
RuleGroup::Nursery,
"useDeprecatedReason",
)],
vec![],
);
assert!(result.is_ok());
let diagnostics = result.unwrap().diagnostics;
assert_eq!(diagnostics.len(), 1)
}
}
4 changes: 4 additions & 0 deletions packages/@biomejs/backend-jsonrpc/src/workspace.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/@biomejs/biome/configuration_schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f88b7b2

Please sign in to comment.