Skip to content
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: add GritQL formatting options #4824

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add GritQL formatting options
  • Loading branch information
ematipico committed Jan 2, 2025
commit 5d7665903d2c2827e75cc36e11f9bc939a639f9e
4 changes: 2 additions & 2 deletions crates/biome_cli/tests/cases/assist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn assist_emit_diagnostic() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -79,7 +79,7 @@ fn assist_writes() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", "--write", file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", "--write", file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down
8 changes: 4 additions & 4 deletions crates/biome_cli/tests/cases/biome_json_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn formatter_biome_json() {
"--indent-width",
"8",
"--write",
file_path.as_os_str().to_str().unwrap(),
file_path.as_str(),
]
.as_slice(),
),
Expand Down Expand Up @@ -87,7 +87,7 @@ fn linter_biome_json() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["lint", "--write", file_path.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["lint", "--write", file_path.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -136,7 +136,7 @@ fn check_biome_json() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", "--write", file_path.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", "--write", file_path.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -181,7 +181,7 @@ fn ci_biome_json() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["ci", input_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["ci", input_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down
32 changes: 9 additions & 23 deletions crates/biome_cli/tests/cases/config_extends.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn extends_config_ok_formatter_no_linter() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", test_file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -77,7 +77,7 @@ fn extends_config_ok_linter_not_formatter() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", test_file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -115,7 +115,7 @@ fn extends_should_raise_an_error_for_unresolved_configuration() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", test_file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -153,14 +153,7 @@ fn extends_should_raise_an_error_for_unresolved_configuration_and_show_verbose()
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"check",
"--verbose",
test_file.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["check", "--verbose", test_file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -198,14 +191,7 @@ fn extends_resolves_when_using_config_path() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"check",
"--config-path=config/",
test_file.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["check", "--config-path=config/", test_file.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -245,7 +231,7 @@ fn applies_extended_values_in_current_config() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", "--write", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", "--write", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -282,7 +268,7 @@ fn respects_unaffected_values_from_extended_config() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", "--write", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", "--write", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -322,7 +308,7 @@ fn allows_reverting_fields_in_extended_config_to_default() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", "--write", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", "--write", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -370,7 +356,7 @@ fn extends_config_merge_overrides() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["lint", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["lint", test_file.as_str()].as_slice()),
);

assert_cli_snapshot(SnapshotPayload::new(
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/tests/cases/cts_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn should_allow_using_export_statements() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["lint", file_path.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["lint", file_path.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down
19 changes: 2 additions & 17 deletions crates/biome_cli/tests/cases/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ fn logs_the_appropriate_messages_according_to_set_diagnostics_level() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"lint",
"--diagnostic-level=error",
test.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["lint", "--diagnostic-level=error", test.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -213,15 +206,7 @@ fn max_diagnostics_are_lifted() {
let (mut fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"ci",
"--max-diagnostics",
"none",
file_path.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["ci", "--max-diagnostics", "none", file_path.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand Down
36 changes: 11 additions & 25 deletions crates/biome_cli/tests/cases/editorconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ max_line_length = 300
"format",
"--write",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
test_file.as_str(),
]
.as_slice(),
),
Expand Down Expand Up @@ -83,7 +83,7 @@ max_line_length = 300
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", "--write", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", "--write", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -120,14 +120,7 @@ max_line_length = 300
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"check",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["check", "--use-editorconfig=true", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -175,7 +168,7 @@ max_line_length = 300
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["check", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["check", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -231,7 +224,7 @@ indent_style = tab
"format",
"--write",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
test_file.as_str(),
]
.as_slice(),
),
Expand Down Expand Up @@ -275,7 +268,7 @@ max_line_length = 90
"check",
"--line-width=100",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
test_file.as_str(),
]
.as_slice(),
),
Expand Down Expand Up @@ -335,8 +328,8 @@ indent_style = space
[
"check",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
test_file2.as_os_str().to_str().unwrap(),
test_file.as_str(),
test_file2.as_str(),
]
.as_slice(),
),
Expand Down Expand Up @@ -375,14 +368,7 @@ max_line_length = 300
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(
[
"ci",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
]
.as_slice(),
),
Args::from(["ci", "--use-editorconfig=true", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -430,7 +416,7 @@ max_line_length = 300
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["ci", test_file.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["ci", test_file.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -472,7 +458,7 @@ insert_final_newline = false
"format",
"--write",
"--use-editorconfig=true",
test_file.as_os_str().to_str().unwrap(),
test_file.as_str(),
]
.as_slice(),
),
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_cli/tests/cases/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn format_graphql_files() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", file_path.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", file_path.as_str()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");
Expand All @@ -58,7 +58,7 @@ fn format_and_write_graphql_files() {
let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["format", "--write", file_path.as_os_str().to_str().unwrap()].as_slice()),
Args::from(["format", "--write", file_path.as_str()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");
Expand Down Expand Up @@ -89,7 +89,7 @@ fn lint_single_rule() {
[
"lint",
"--only=nursery/useDeprecatedReason",
file_path.as_os_str().to_str().unwrap(),
file_path.as_str(),
]
.as_slice(),
),
Expand Down
Loading
Loading