From 487aa1e3be0580663540212ed3509489009e2e3d Mon Sep 17 00:00:00 2001 From: MujahedSafaa <168719085+MujahedSafaa@users.noreply.github.com> Date: Wed, 4 Sep 2024 19:29:23 +0300 Subject: [PATCH] chore: update no-window lint rule message for Deno 2.0 (#1320) --- docs/rules/no_window_global.md | 6 +++--- src/rules/no_window.rs | 3 +-- www/static/docs.json | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/rules/no_window_global.md b/docs/rules/no_window_global.md index 6a9591ea8..e814c81cd 100644 --- a/docs/rules/no_window_global.md +++ b/docs/rules/no_window_global.md @@ -1,8 +1,8 @@ Disallows the use of the `window` object. -Using the `window` global is deprecated and scheduled for removal in Deno 2.0. -Deno does not have a window and `typeof window === "undefined"` is often used to -tell if the code is running in the browser. +The `window` global is no longer available in Deno. Deno does not have a window +and `typeof window === "undefined"` is often used to tell if the code is running +in the browser. ### Invalid: diff --git a/src/rules/no_window.rs b/src/rules/no_window.rs index 4b310949b..e1431bfd1 100644 --- a/src/rules/no_window.rs +++ b/src/rules/no_window.rs @@ -16,8 +16,7 @@ use if_chain::if_chain; pub struct NoWindow; const CODE: &str = "no-window"; -const MESSAGE: &str = - "window is deprecated and scheduled for removal in Deno 2.0"; +const MESSAGE: &str = "Window is no longer available in Deno"; const HINT: &str = "Instead, use `globalThis`"; const FIX_DESC: &str = "Rename window to globalThis"; diff --git a/www/static/docs.json b/www/static/docs.json index a02b191fb..4e9a743d2 100644 --- a/www/static/docs.json +++ b/www/static/docs.json @@ -578,7 +578,7 @@ }, { "code": "no-window", - "docs": "Disallows the use of the `window` object.\n\nUsing the `window` global is deprecated and scheduled for removal in Deno 2.0.\nDeno does not have a window and `typeof window === \"undefined\"` is often used to\ntell if the code is running in the browser.\n\n### Invalid:\n\n```typescript\nconst a = await window.fetch(\"https://deno.land\");\n\nconst b = window.Deno.metrics();\nconsole.log(window);\n\nwindow.addEventListener(\"load\", () => {\n console.log(\"Loaded.\");\n});\n```\n\n### Valid:\n\n```typescript\nconst a1 = await fetch(\"https://deno.land\");\nconst a2 = await globalThis.fetch(\"https://deno.land\");\nconst a3 = await self.fetch(\"https://deno.land\");\n\nconst b1 = Deno.metrics();\nconst b2 = globalThis.Deno.metrics();\nconst b3 = self.Deno.metrics();\nconsole.log(globalThis);\n\naddEventListener(\"load\", () => {\n console.log(\"Loaded.\");\n});\n```\n", + "docs": "Disallows the use of the `window` object.\n\nThe `window` global is no longer available in Deno. Deno does not have a window\nand `typeof window === \"undefined\"` is often used to tell if the code is running\nin the browser.\n\n### Invalid:\n\n```typescript\nconst a = await window.fetch(\"https://deno.land\");\n\nconst b = window.Deno.metrics();\nconsole.log(window);\n\nwindow.addEventListener(\"load\", () => {\n console.log(\"Loaded.\");\n});\n```\n\n### Valid:\n\n```typescript\nconst a1 = await fetch(\"https://deno.land\");\nconst a2 = await globalThis.fetch(\"https://deno.land\");\nconst a3 = await self.fetch(\"https://deno.land\");\n\nconst b1 = Deno.metrics();\nconst b2 = globalThis.Deno.metrics();\nconst b3 = self.Deno.metrics();\nconsole.log(globalThis);\n\naddEventListener(\"load\", () => {\n console.log(\"Loaded.\");\n});\n```\n", "tags": [ "recommended" ]