Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
run: |
npm install -g prettier
prettier --version
- name: Install biome
run: |
npm install -g @biomejs/biome
biome --version
- name: test
run: |
cargo test --workspace \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Found 8 testable patterns.
done();
- console.log("This should be removed by grit patterns test --update");
}
-


✓ no_eq_null
24 changes: 9 additions & 15 deletions crates/gritmodule/src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,31 +185,24 @@ async fn format_temp_dir(dir: &TempDir, languages: Vec<&PatternLanguage>) -> Res
if languages.contains(&&PatternLanguage::Tsx)
|| languages.contains(&&PatternLanguage::JavaScript)
|| languages.contains(&&PatternLanguage::TypeScript)
|| languages.contains(&&PatternLanguage::Json)
{
let output = Command::new("npx")
// npx has an interactive prompt asking if you want to install the package if it isn't installed.
// we pass `--yes` to avoid the interactive prompt
.arg("--yes")
.arg("prettier")
.arg("--parser")
.arg("babel-ts")
log::debug!("Formatting with biome");
let output = Command::new("biome")
.arg("format")
.arg("--write")
.arg(dir.path().join("**/*"))
.output()
.await?;

log::debug!("prettier output: {:?}", output);
}

if languages.contains(&&PatternLanguage::Json)
|| languages.contains(&&PatternLanguage::Html)
log::debug!("biome output: {:?}", output)
} else if languages.contains(&&PatternLanguage::Html)
|| languages.contains(&&PatternLanguage::Css)
|| languages.contains(&&PatternLanguage::MarkdownBlock)
|| languages.contains(&&PatternLanguage::MarkdownInline)
|| languages.contains(&&PatternLanguage::Yaml)
{
info!("Formatting with prettier into {}", dir.path().display());
Command::new("npx")
log::debug!("Formatting with prettier");
let output = Command::new("npx")
// npx has an interactive prompt asking if you want to install the package if it isn't installed.
// we pass `--yes` to avoid the interactive prompt
.arg("--yes")
Expand All @@ -218,6 +211,7 @@ async fn format_temp_dir(dir: &TempDir, languages: Vec<&PatternLanguage>) -> Res
.arg(dir.path().join("**/*"))
.output()
.await?;
log::debug!("prettier output: {:?}", output);
}

Ok(())
Expand Down