From fc9b1ebc7d1b76b63678b85fc580aab48f2e5014 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:43:23 +0100 Subject: [PATCH] fix(migrate): suppress node warnings (#3259) --- CHANGELOG.md | 7 +++++++ crates/biome_cli/src/execute/migrate/node.rs | 3 +++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b38ab24a1029..43289ff5e6ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b ## Unreleased +### CLI + +#### Bug fixes + +- Fix [#3104](https://github.com/biomejs/biome/issues/3104) by suppressing node warnings when using `biome migrate`. Contributed by @SuperchupuDev + ### Parser #### New features @@ -33,6 +39,7 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b - Fix [#3201](https://github.com/biomejs/biome/issues/3201) by correctly injecting the source code of the file when printing the diagnostics. Contributed by @ematipico - Fix [#3179](https://github.com/biomejs/biome/issues/3179) where comma separators are not correctly removed after running `biome migrate` and thus choke the parser. Contributed by @Sec-ant - Fix [#3232](https://github.com/biomejs/biome/issues/3232) by correctly using the colors set by the user. Contributed by @ematipico + #### Enhancement - Reword the reporter message `No fixes needed` to `No fixes applied`. diff --git a/crates/biome_cli/src/execute/migrate/node.rs b/crates/biome_cli/src/execute/migrate/node.rs index 434dc46a4542..a488238ddea6 100644 --- a/crates/biome_cli/src/execute/migrate/node.rs +++ b/crates/biome_cli/src/execute/migrate/node.rs @@ -6,6 +6,7 @@ use crate::{diagnostics::MigrationDiagnostic, CliDiagnostic}; /// returns the JSONified content of its default export. pub(crate) fn load_config(specifier: &str) -> Result { let content_output = Command::new("node") + .env("NODE_NO_WARNINGS", "1") .arg("--eval") .arg(format!( "{UNCYCLE_FUNCTION} import('{specifier}').then((c) => console.log(JSON.stringify(uncycle(c.default))))" @@ -19,6 +20,7 @@ pub(crate) fn load_config(specifier: &str) -> Result }, Ok(output) => { let path_output = Command::new("node") + .env("NODE_NO_WARNINGS", "1") .arg("--print") .arg(format!( "require.resolve('{specifier}')" @@ -28,6 +30,7 @@ pub(crate) fn load_config(specifier: &str) -> Result if !output.stderr.is_empty() { // Try with `require` before giving up. let output2 = Command::new("node") + .env("NODE_NO_WARNINGS", "1") .arg("--eval") .arg(format!( "{UNCYCLE_FUNCTION} console.log(JSON.stringify(uncycle(require('{specifier}'))))"