From ef3e4a8f74ea65cfed58c1276696f50a8779f816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 22 Sep 2024 23:05:42 +0100 Subject: feat: Show hints when using `window` global (#25805) This commit adds better handling for terminal errors when `window` global is used. This global is removed in Deno 2, and while we have lints to help with that, an information and hints are helpful to guide users to working code. Ref https://github.com/denoland/deno/issues/25797 --- cli/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli') diff --git a/cli/main.rs b/cli/main.rs index a7e1c8342..84c3704ca 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -380,6 +380,11 @@ fn get_suggestions_for_terminal_errors(e: &JsError) -> Vec { "Run again with `--unstable-broadcast-channel` flag to enable this API.", ), ]; + } else if msg.contains("window is not defined") { + return vec![ + FixSuggestion::info("window global is not available in Deno 2."), + FixSuggestion::hint("Replace `window` with `globalThis`."), + ]; } } -- cgit v1.2.3